Bug 1288256 - Part 1: update naming of "home pager container" to "home screen container" r?sebastian
This is to help keep the terminology more clear: this container will allow displaying any of our
home screen implementations, and not just the HomePager.
MozReview-Commit-ID: 4kqNipgvQ5I
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -234,17 +234,22 @@ public class BrowserApp extends GeckoApp
private BrowserToolbar mBrowserToolbar;
private View mDoorhangerOverlay;
// We can't name the TabStrip class because it's not included on API 9.
private TabStripInterface mTabStrip;
private ToolbarProgressView mProgressView;
private FirstrunAnimationContainer mFirstrunAnimationContainer;
private HomePager mHomePager;
private TabsPanel mTabsPanel;
- private ViewGroup mHomePagerContainer;
+ /**
+ * Container for the home screen implementation. This will be populated with any valid
+ * home screen implementation (currently that is just the HomePager, but that will be extended
+ * to permit further experimental replacement panels such as the activity-stream panel).
+ */
+ private ViewGroup mHomeScreenContainer;
private ActionModeCompat mActionMode;
private TabHistoryController tabHistoryController;
private ZoomedView mZoomedView;
private static final int GECKO_TOOLS_MENU = -1;
private static final int ADDON_MENU_OFFSET = 1000;
public static final String TAB_HISTORY_FRAGMENT_TAG = "tabHistoryFragment";
@@ -643,17 +648,17 @@ public class BrowserApp extends GeckoApp
} else {
mHomePager.requestFocus();
}
}
return false;
}
});
- mHomePagerContainer = (ViewGroup) findViewById(R.id.home_pager_container);
+ mHomeScreenContainer = (ViewGroup) findViewById(R.id.home_screen_container);
mBrowserSearchContainer = findViewById(R.id.search_container);
mBrowserSearch = (BrowserSearch) getSupportFragmentManager().findFragmentByTag(BROWSER_SEARCH_TAG);
if (mBrowserSearch == null) {
mBrowserSearch = BrowserSearch.newInstance();
mBrowserSearch.setUserVisibleHint(false);
}
@@ -721,17 +726,17 @@ public class BrowserApp extends GeckoApp
return new NdefMessage(new NdefRecord[] { NdefRecord.createUri(tab.getURL()) });
}
}, this);
}
}
if (savedInstanceState != null) {
mDynamicToolbar.onRestoreInstanceState(savedInstanceState);
- mHomePagerContainer.setPadding(0, savedInstanceState.getInt(STATE_ABOUT_HOME_TOP_PADDING), 0, 0);
+ mHomeScreenContainer.setPadding(0, savedInstanceState.getInt(STATE_ABOUT_HOME_TOP_PADDING), 0, 0);
}
mDynamicToolbar.setEnabledChangedListener(new DynamicToolbar.OnEnabledChangedListener() {
@Override
public void onEnabledChanged(boolean enabled) {
setDynamicToolbarEnabled(enabled);
}
});
@@ -1204,24 +1209,24 @@ public class BrowserApp extends GeckoApp
private void setDynamicToolbarEnabled(boolean enabled) {
ThreadUtils.assertOnUiThread();
if (enabled) {
if (mLayerView != null) {
mLayerView.getDynamicToolbarAnimator().addTranslationListener(this);
}
setToolbarMargin(0);
- mHomePagerContainer.setPadding(0, mBrowserChrome.getHeight(), 0, 0);
+ mHomeScreenContainer.setPadding(0, mBrowserChrome.getHeight(), 0, 0);
} else {
// Immediately show the toolbar when disabling the dynamic
// toolbar.
if (mLayerView != null) {
mLayerView.getDynamicToolbarAnimator().removeTranslationListener(this);
}
- mHomePagerContainer.setPadding(0, 0, 0, 0);
+ mHomeScreenContainer.setPadding(0, 0, 0, 0);
if (mBrowserChrome != null) {
ViewHelper.setTranslationY(mBrowserChrome, 0);
}
if (mLayerView != null) {
mLayerView.setSurfaceTranslation(0);
}
}
@@ -1556,17 +1561,17 @@ public class BrowserApp extends GeckoApp
if (!mDynamicToolbar.isEnabled() || isHomePagerVisible()) {
// Use aVisibleHeight here so that when the dynamic toolbar is
// enabled, the padding will animate with the toolbar becoming
// visible.
if (mDynamicToolbar.isEnabled()) {
// When the dynamic toolbar is enabled, set the padding on the
// about:home widget directly - this is to avoid resizing the
// LayerView, which can cause visible artifacts.
- mHomePagerContainer.setPadding(0, height, 0, 0);
+ mHomeScreenContainer.setPadding(0, height, 0, 0);
} else {
setToolbarMargin(height);
height = 0;
}
} else {
setToolbarMargin(0);
}
@@ -2192,17 +2197,17 @@ public class BrowserApp extends GeckoApp
mMainLayoutAnimator = null;
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mDynamicToolbar.onSaveInstanceState(outState);
- outState.putInt(STATE_ABOUT_HOME_TOP_PADDING, mHomePagerContainer.getPaddingTop());
+ outState.putInt(STATE_ABOUT_HOME_TOP_PADDING, mHomeScreenContainer.getPaddingTop());
}
/**
* Attempts to switch to an open tab with the given URL.
* <p>
* If the tab exists, this method cancels any in-progress editing as well as
* calling {@link Tabs#selectTab(int)}.
*
@@ -2287,22 +2292,22 @@ public class BrowserApp extends GeckoApp
Tabs.getInstance().loadUrl(url, searchEngine, -1, flags);
mBrowserToolbar.cancelEdit();
}
private boolean isHomePagerVisible() {
return (mHomePager != null && mHomePager.isVisible()
- && mHomePagerContainer != null && mHomePagerContainer.getVisibility() == View.VISIBLE);
+ && mHomeScreenContainer != null && mHomeScreenContainer.getVisibility() == View.VISIBLE);
}
private boolean isFirstrunVisible() {
return (mFirstrunAnimationContainer != null && mFirstrunAnimationContainer.isVisible()
- && mHomePagerContainer != null && mHomePagerContainer.getVisibility() == View.VISIBLE);
+ && mHomeScreenContainer != null && mHomeScreenContainer.getVisibility() == View.VISIBLE);
}
/**
* Enters editing mode with the current tab's URL. There might be no
* tabs loaded by the time the user enters editing mode e.g. just after
* the app starts. In this case, we simply fallback to an empty URL.
*/
private void enterEditingMode() {
@@ -2646,17 +2651,17 @@ public class BrowserApp extends GeckoApp
public void onFinish() {
if (mFirstrunAnimationContainer.showBrowserHint()) {
enterEditingMode();
}
}
});
}
- mHomePagerContainer.setVisibility(View.VISIBLE);
+ mHomeScreenContainer.setVisibility(View.VISIBLE);
}
private void showHomePager(String panelId, Bundle panelRestoreData) {
showHomePagerWithAnimator(panelId, panelRestoreData, null);
}
private void showHomePagerWithAnimator(String panelId, Bundle panelRestoreData, PropertyAnimator animator) {
if (isHomePagerVisible()) {
@@ -2711,23 +2716,23 @@ public class BrowserApp extends GeckoApp
final HomeBanner homeBanner = (HomeBanner) homeBannerStub.inflate();
mHomePager.setBanner(homeBanner);
// Remove the banner from the view hierarchy if it is dismissed.
homeBanner.setOnDismissListener(new HomeBanner.OnDismissListener() {
@Override
public void onDismiss() {
mHomePager.setBanner(null);
- mHomePagerContainer.removeView(homeBanner);
+ mHomeScreenContainer.removeView(homeBanner);
}
});
}
}
- mHomePagerContainer.setVisibility(View.VISIBLE);
+ mHomeScreenContainer.setVisibility(View.VISIBLE);
mHomePager.load(getSupportLoaderManager(),
getSupportFragmentManager(),
panelId,
panelRestoreData,
animator);
// Hide the web content so it cannot be focused by screen readers.
hideWebContentOnPropertyAnimationEnd(animator);
@@ -2798,17 +2803,17 @@ public class BrowserApp extends GeckoApp
return;
}
// Prevent race in hiding web content - see declaration for more info.
mHideWebContentOnAnimationEnd = false;
// Display the previously hidden web content (which prevented screen reader access).
mLayerView.setVisibility(View.VISIBLE);
- mHomePagerContainer.setVisibility(View.GONE);
+ mHomeScreenContainer.setVisibility(View.GONE);
if (mHomePager != null) {
mHomePager.unload();
}
mBrowserToolbar.setNextFocusDownId(R.id.layer_view);
// Refresh toolbar height to possibly restore the toolbar padding
@@ -2837,17 +2842,17 @@ public class BrowserApp extends GeckoApp
if (mBrowserSearch.getUserVisibleHint()) {
return;
}
mBrowserSearchContainer.setVisibility(View.VISIBLE);
// Prevent overdraw by hiding the underlying web content and HomePager View
hideWebContent();
- mHomePagerContainer.setVisibility(View.INVISIBLE);
+ mHomeScreenContainer.setVisibility(View.INVISIBLE);
final FragmentManager fm = getSupportFragmentManager();
// In certain situations, showBrowserSearch() can be called immediately after hideBrowserSearch()
// (see bug 925012). Because of an Android bug (http://code.google.com/p/android/issues/detail?id=61179),
// calling FragmentTransaction#add immediately after FragmentTransaction#remove won't add the fragment's
// view to the layout. Calling FragmentManager#executePendingTransactions before re-adding the fragment
// prevents this issue.
--- a/mobile/android/base/resources/layout/gecko_app.xml
+++ b/mobile/android/base/resources/layout/gecko_app.xml
@@ -51,17 +51,17 @@
</FrameLayout>
<ViewStub android:id="@+id/zoomed_view_stub"
android:inflatedId="@+id/zoomed_view"
android:layout="@layout/zoomed_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
- <FrameLayout android:id="@+id/home_pager_container"
+ <FrameLayout android:id="@+id/home_screen_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ViewStub android:id="@+id/home_pager_stub"
android:layout="@layout/home_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseTest.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseTest.java
@@ -424,17 +424,17 @@ abstract class BaseTest extends BaseRobo
final View menuView = mSolo.getView(R.id.menu);
mAsserter.isnot(menuView, null, "Menu view is not null");
mSolo.clickOnView(menuView, true);
mAsserter.ok(waitForEnabledText(itemName), "Waiting for menu item " + itemName, itemName + " is present and enabled");
mSolo.clickOnText(itemName);
}
public final void verifyHomePagerHidden() {
- final View homePagerContainer = mSolo.getView(R.id.home_pager_container);
+ final View homePagerContainer = mSolo.getView(R.id.home_screen_container);
boolean rc = waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return homePagerContainer.getVisibility() != View.VISIBLE;
}
}, MAX_WAIT_HOME_PAGER_HIDDEN_MS);
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/AboutHomeComponent.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/AboutHomeComponent.java
@@ -41,17 +41,17 @@ public class AboutHomeComponent extends
// testing: 0.55f was tested on try and fails on armv6 devices.
private static final float SWIPE_PERCENTAGE = 0.70f;
public AboutHomeComponent(final UITestContext testContext) {
super(testContext);
}
private View getHomePagerContainer() {
- return mSolo.getView(R.id.home_pager_container);
+ return mSolo.getView(R.id.home_screen_container);
}
private ViewPager getHomePagerView() {
return (ViewPager) mSolo.getView(R.id.home_pager);
}
private View getHomeBannerView() {
if (mSolo.waitForView(R.id.home_banner)) {