Skip to content

Commit

Permalink
删除冗余变量
Browse files Browse the repository at this point in the history
  • Loading branch information
hackware1993 committed Sep 4, 2016
1 parent 4a69b23 commit e5a458d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public float getTitleWeight(Context context, int index) {
titleContainer.setDividerDrawable(getResources().getDrawable(R.drawable.simple_splitter));

// SimpleViewPagerDelegate.with(magicIndicator3, mViewPager).delegate();
mFragmentContainerHelper = new FragmentContainerHelper(magicIndicator3, 3);
mFragmentContainerHelper = new FragmentContainerHelper(magicIndicator3);

mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
Expand All @@ -325,7 +325,7 @@ public void onPageScrolled(int position, float positionOffset, int positionOffse

@Override
public void onPageSelected(int position) {
mFragmentContainerHelper.onPageSelected(position); // 模拟在FragmentContainer中使用
mFragmentContainerHelper.handlePageSelected(position); // 模拟在FragmentContainer中使用
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@

public class FragmentContainerHelper implements ValueAnimator.AnimatorUpdateListener, Animator.AnimatorListener {
private MagicIndicator mMagicIndicator;
private int mPageCount;
private ValueAnimator mScrollAnimator;

public FragmentContainerHelper(MagicIndicator magicIndicator, int pageCount) {
public FragmentContainerHelper(MagicIndicator magicIndicator) {
mMagicIndicator = magicIndicator;
mPageCount = pageCount;
}

public void onPageSelected(int selectedIndex) {
public void handlePageSelected(int selectedIndex) {
if (mScrollAnimator == null || !mScrollAnimator.isRunning()) {
mMagicIndicator.onPageScrollStateChanged(ScrollState.SCROLL_STATE_SETTLING);
}
Expand All @@ -46,14 +44,6 @@ public void setMagicIndicator(MagicIndicator magicIndicator) {
mMagicIndicator = magicIndicator;
}

public int getPageCount() {
return mPageCount;
}

public void setPageCount(int pageCount) {
mPageCount = pageCount;
}

@Override
public void onAnimationUpdate(ValueAnimator animation) {
float positionOffsetSum = (Float) animation.getAnimatedValue();
Expand Down

0 comments on commit e5a458d

Please sign in to comment.