Bug 977155 - (Part 2) Rename HomeBanner setEnabled to setActive. r=bnicholson

This commit is contained in:
Margaret Leibovic 2014-02-28 17:26:54 -08:00
parent c74a3d67a0
commit 9abb8ce20b
2 changed files with 14 additions and 14 deletions

View File

@ -43,8 +43,8 @@ public class HomeBanner extends LinearLayout
// Used to detect for upwards scroll to push banner all the way up
private boolean mSnapBannerToTop;
// Tracks if the banner has been enabled by HomePager to avoid race conditions.
private boolean mEnabled = false;
// Tracks whether or not the banner should be shown.
private boolean mActive = false;
// The user is currently swiping between HomePager pages
private boolean mScrollingPages = false;
@ -139,8 +139,8 @@ public class HomeBanner extends LinearLayout
mTextView.setText(text);
setVisibility(VISIBLE);
// Animate the banner if it is currently enabled.
if (mEnabled) {
// Animate the banner if it is currently active.
if (mActive) {
animateUp();
}
}
@ -165,20 +165,20 @@ public class HomeBanner extends LinearLayout
});
}
public void setEnabled(boolean enabled) {
public void setActive(boolean active) {
// No need to animate if not changing
if (mEnabled == enabled) {
if (mActive == active) {
return;
}
mEnabled = enabled;
mActive = active;
// Don't animate if the banner isn't visible.
if (getVisibility() != View.VISIBLE) {
return;
}
if (enabled) {
if (active) {
animateUp();
} else {
animateDown();
@ -209,7 +209,7 @@ public class HomeBanner extends LinearLayout
}
public void handleHomeTouch(MotionEvent event) {
if (!mEnabled || getVisibility() == GONE || mScrollingPages) {
if (!mActive || getVisibility() == GONE || mScrollingPages) {
return;
}

View File

@ -248,9 +248,9 @@ public class HomePager extends ViewPager {
}
public void onToolbarFocusChange(boolean hasFocus) {
// We should only enable the banner if the toolbar is not focused and we are on the default page
final boolean enabled = !hasFocus && getCurrentItem() == mDefaultPageIndex;
mHomeBanner.setEnabled(enabled);
// We should only make the banner active if the toolbar is not focused and we are on the default page
final boolean active = !hasFocus && getCurrentItem() == mDefaultPageIndex;
mHomeBanner.setActive(active);
}
private void updateUiFromPanelConfigs(List<PanelConfig> panelConfigs) {
@ -265,7 +265,7 @@ public class HomePager extends ViewPager {
}
if (mHomeBanner != null) {
mHomeBanner.setEnabled(false);
mHomeBanner.setActive(false);
}
final HomeAdapter adapter = (HomeAdapter) getAdapter();
@ -345,7 +345,7 @@ public class HomePager extends ViewPager {
}
if (mHomeBanner != null) {
mHomeBanner.setEnabled(position == mDefaultPageIndex);
mHomeBanner.setActive(position == mDefaultPageIndex);
}
}