<commit_before>/*
 * Copyright 2014 Square Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.flow.pathview;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.flow.util.Utils;
import flow.Flow;
import flow.Path;
import flow.PathContainer;
import flow.PathContext;
import flow.PathContextFactory;

import static flow.Flow.Direction.REPLACE;

/**
 * Provides basic right-to-left transitions. Saves and restores view state.
 * Uses {@link flow.PathContext} to allow customized sub-containers.
 */
public class SimplePathContainer extends PathContainer {
  private final PathContextFactory contextFactory;

  SimplePathContainer(int tagKey, PathContextFactory contextFactory) {
    super(tagKey);
    this.contextFactory = contextFactory;
  }

  @Override protected void performTraversal(final ViewGroup containerView,
      final TraversalState traversalState, final Flow.Direction direction,
      final Flow.TraversalCallback callback) {

    final PathContext context;
    final PathContext oldPath;
    if (containerView.getChildCount() > 0) {
      oldPath = PathContext.get(containerView.getChildAt(0).getContext());
    } else {
      oldPath = PathContext.root(containerView.getContext());
    }

    Path to = traversalState.toPath();

    ViewGroup newView;
    context = PathContext.create(oldPath, to, contextFactory);
    int layout = getLayout(to);
    newView = (ViewGroup) LayoutInflater.from(context)
        .cloneInContext(context)<commit_msg>public constructor on SimplePathContainer<commit_after>/*
 * Copyright 2014 Square Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.flow.pathview;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.flow.util.Utils;
import flow.Flow;
import flow.Path;
import flow.PathContainer;
import flow.PathContext;
import flow.PathContextFactory;

import static flow.Flow.Direction.REPLACE;

/**
 * Provides basic right-to-left transitions. Saves and restores view state.
 * Uses {@link flow.PathContext} to allow customized sub-containers.
 */
public class SimplePathContainer extends PathContainer {
  private final PathContextFactory contextFactory;

  public SimplePathContainer(int tagKey, PathContextFactory contextFactory) {
    super(tagKey);
    this.contextFactory = contextFactory;
  }

  @Override protected void performTraversal(final ViewGroup containerView,
      final TraversalState traversalState, final Flow.Direction direction,
      final Flow.TraversalCallback callback) {

    final PathContext context;
    final PathContext oldPath;
    if (containerView.getChildCount() > 0) {
      oldPath = PathContext.get(containerView.getChildAt(0).getContext());
    } else {
      oldPath = PathContext.root(containerView.getContext());
    }

    Path to = traversalState.toPath();

    ViewGroup newView;
    context = PathContext.create(oldPath, to, contextFactory);
    int layout = getLayout(to);
    newView = (ViewGroup) LayoutInflater.from(context)
        .cloneInContext(context)
{'fraction_non_alphanumeric': 0.08257085471992859, 'fraction_numerical': 0.004463289444320465, 'mean_word_length': 4.459196102314251, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4232797', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1163, 'n_words': 385}