<commit_before>package com.prolific.parallaxview;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import java.util.ArrayList;
import java.util.List;

public class ParallaxContainer extends FrameLayout implements ViewPager.OnPageChangeListener {

  protected Context mContext;
  protected int mChildCount;
  protected int mCurrentChild;
  protected List<View> mParallaxViewList = new ArrayList<View>();
  protected ViewPager mViewPager;
  protected SpaceFragment mSpaceFragment1;
  protected SpaceFragment mSpaceFragment2;
  protected int mScreenWidth;

  public ParallaxContainer(Context context) {
    super(context);
    mContext = context;
  }

  public ParallaxContainer(Context context, AttributeSet attrs) {
    super(context, attrs);
    mContext = context;
  }

  public ParallaxContainer(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mContext = context;
  }

  @Override
  protected void onFinishInflate() {

    // how many steps before the viewpager loops
    mChildCount = getChildCount();

    // how wide is the screen
    mScreenWidth = mContext.getResources().getDisplayMetrics().widthPixels;

    addChildrenToParallaxViewList();

    // make view pager with same attributes as container
    mViewPager = new ViewPager(mContext);
    mViewPager.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    mViewPager.setOnPageChangeListener(this);
    mViewPager.setId(R.id.PAGER_ID);

    addView(mViewPager);

    // two empty fragments
    mSpaceFragment1 = new SpaceFragment();
    mSpaceFragment2 = new SpaceFragment();

    // create an adapter that provides 7 blank fragments
    if (ParallaxUtil.mManager != null) {
      mViewPager.setAdapter(new FragmentPagerAdapter(ParallaxUtil.mManager) {
            @Override public Fragment getItem(int i) {
              // switch off which fragment is active, so the other one can be recycled
              return i % 2 == 1 ? mSpaceFragment1 : mSpaceFragment2;
            }

            @Override public int getCount() {
              return Integer.MAX_VALUE;
            }
          });
    }
  }

<commit_msg>bring to font<commit_after>package com.prolific.parallaxview;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import java.util.ArrayList;
import java.util.List;

public class ParallaxContainer extends FrameLayout implements ViewPager.OnPageChangeListener {

  protected Context mContext;
  protected int mChildCount;
  protected int mCurrentChild;
  protected List<View> mParallaxViewList = new ArrayList<View>();
  protected ViewPager mViewPager;
  protected SpaceFragment mSpaceFragment1;
  protected SpaceFragment mSpaceFragment2;
  protected int mScreenWidth;

  public ParallaxContainer(Context context) {
    super(context);
    mContext = context;
  }

  public ParallaxContainer(Context context, AttributeSet attrs) {
    super(context, attrs);
    mContext = context;
  }

  public ParallaxContainer(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mContext = context;
  }

  @Override
  protected void onFinishInflate() {

    // how many steps before the viewpager loops
    mChildCount = getChildCount();

    // how wide is the screen
    mScreenWidth = mContext.getResources().getDisplayMetrics().widthPixels;

    addChildrenToParallaxViewList();

    // make view pager with same attributes as container
    mViewPager = new ViewPager(mContext);
    mViewPager.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    mViewPager.setOnPageChangeListener(this);
    mViewPager.setId(R.id.PAGER_ID);


    // two empty fragments
    mSpaceFragment1 = new SpaceFragment();
    mSpaceFragment2 = new SpaceFragment();

    // create an adapter that provides 7 blank fragments
    if (ParallaxUtil.mManager != null) {
      mViewPager.setAdapter(new FragmentPagerAdapter(ParallaxUtil.mManager) {
            @Override public Fragment getItem(int i) {
              // switch off which fragment is active, so the other one can be recycled
              return i % 2 == 1 ? mSpaceFragment1 : mSpaceFragment2;
            }

            @Override public int getCount() {
              return Integer.MAX_VALUE;
            }
          });
    }


    addView(mViewPager);
    bringChildToFront(mViewPager);
  }
{'fraction_non_alphanumeric': 0.0807936183268562, 'fraction_numerical': 0.004908979341378605, 'mean_word_length': 3.72007722007722, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3438826', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1374, 'n_words': 347}