From a7779868e8dd0cf17565926faa17dbb038f398e8 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Wed, 5 Mar 2014 12:21:20 -0800 Subject: [PATCH] backout 9ee8634f70dc because it didn't work --- mobile/android/base/home/HomePager.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mobile/android/base/home/HomePager.java b/mobile/android/base/home/HomePager.java index c6adf248cea..6068da8db78 100644 --- a/mobile/android/base/home/HomePager.java +++ b/mobile/android/base/home/HomePager.java @@ -40,6 +40,7 @@ public class HomePager extends ViewPager { private HomeBanner mHomeBanner; private int mDefaultPageIndex = -1; + private final ViewPager.OnPageChangeListener mPageChangeListener; private final OnAddPanelListener mAddPanelListener; private final HomeConfig mConfig; @@ -123,7 +124,8 @@ public class HomePager extends ViewPager { setFocusableInTouchMode(true); mOriginalBackground = getBackground(); - setOnPageChangeListener(new PageChangeListener()); + mPageChangeListener = new PageChangeListener(); + setOnPageChangeListener(mPageChangeListener); } @Override @@ -216,10 +218,9 @@ public class HomePager extends ViewPager { public void setCurrentItem(int item, boolean smoothScroll) { super.setCurrentItem(item, smoothScroll); - // Android doesn't call onPageSelected when there is only one page. Make sure we activate - // the banner in this case. - if (mHomeBanner != null && getAdapter().getCount() == 1) { - mHomeBanner.setActive(true); + // Android doesn't call this when there is only one item + if (getAdapter().getCount() == 1 && mPageChangeListener != null) { + mPageChangeListener.onPageSelected(0); } }