mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 966047 - Hide banner when there are no panels enabled. r=mleibovic
This commit is contained in:
parent
d1cdd98f85
commit
7393d9ce58
@ -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,8 +218,9 @@ public class HomePager extends ViewPager {
|
||||
public void setCurrentItem(int item, boolean smoothScroll) {
|
||||
super.setCurrentItem(item, smoothScroll);
|
||||
|
||||
if (mDecor != null) {
|
||||
mDecor.onPageSelected(item);
|
||||
// Android doesn't call this when there is only one item
|
||||
if (getAdapter().getCount() == 1 && mPageChangeListener != null) {
|
||||
mPageChangeListener.onPageSelected(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,6 +264,10 @@ public class HomePager extends ViewPager {
|
||||
mDecor.removeAllPagerViews();
|
||||
}
|
||||
|
||||
if (mHomeBanner != null) {
|
||||
mHomeBanner.setEnabled(false);
|
||||
}
|
||||
|
||||
final HomeAdapter adapter = (HomeAdapter) getAdapter();
|
||||
|
||||
// Destroy any existing panels currently loaded
|
||||
|
Loading…
Reference in New Issue
Block a user