Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(751)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java

Issue 2821223004: [Home] Show the app menu icons as a footer (Closed)
Patch Set: Changes from tedchoc@ review Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
index 05a4d78b023438861f5dbcfb4246013fb7c8b037..2abb265719d8413c1686c0a73587abd9cf7f1545 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
@@ -9,8 +9,10 @@ import android.content.pm.ResolveInfo;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.SystemClock;
+import android.support.annotation.Nullable;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.CommandLine;
@@ -44,8 +46,8 @@ public class AppMenuPropertiesDelegate {
// Indices for different levels in drawable.btn_reload_stop.
// Used only when preparing menu and refresh reload button in menu when tab
// page load status changes.
- private static final int RELOAD_BUTTON_LEVEL_RELOAD = 0;
- private static final int RELOAD_BUTTON_LEVEL_STOP_LOADING = 1;
+ static final int RELOAD_BUTTON_LEVEL_RELOAD = 0;
+ static final int RELOAD_BUTTON_LEVEL_STOP_LOADING = 1;
protected MenuItem mReloadMenuItem;
@@ -53,6 +55,9 @@ public class AppMenuPropertiesDelegate {
protected BookmarkBridge mBookmarkBridge;
+ @Nullable
+ private AppMenuIconRowFooter mAppMenuIconRowFooter;
+
public AppMenuPropertiesDelegate(ChromeActivity activity) {
mActivity = activity;
}
@@ -102,9 +107,13 @@ public class AppMenuPropertiesDelegate {
|| url.startsWith(UrlConstants.CHROME_NATIVE_URL_PREFIX);
boolean isFileScheme = url.startsWith(UrlConstants.FILE_URL_PREFIX);
boolean isContentScheme = url.startsWith(UrlConstants.CONTENT_URL_PREFIX);
- boolean shouldShowIconRow = !mActivity.isTablet()
- || mActivity.getWindow().getDecorView().getWidth()
- < DeviceFormFactor.getMinimumTabletWidthPx(mActivity);
+
+ // If the BottomSheet is not null, the icon row will be displayed using
+ // AppMenuIconRowFooter as a prompt view.
+ boolean shouldShowIconRow = mActivity.getBottomSheet() == null
+ && (!mActivity.isTablet()
+ || mActivity.getWindow().getDecorView().getWidth()
+ < DeviceFormFactor.getMinimumTabletWidthPx(mActivity));
// Update the icon row items (shown in narrow form factors).
menu.findItem(R.id.icon_row_menu_id).setVisible(shouldShowIconRow);
@@ -222,6 +231,21 @@ public class AppMenuPropertiesDelegate {
}
/**
+ * Called after the menu has been shown to finish initializing views.
+ * @param menu The {@link AppMenu} that was shown.
+ */
+ public void onShow(final AppMenu menu) {
+ View promptView = menu.getPromptView();
+ if (!(promptView instanceof AppMenuIconRowFooter)) {
+ mAppMenuIconRowFooter = null;
+ return;
+ }
+
+ mAppMenuIconRowFooter = (AppMenuIconRowFooter) promptView;
+ mAppMenuIconRowFooter.initialize(mActivity, menu, mBookmarkBridge);
+ }
+
+ /**
* Sets the visibility and labels of the "Add to Home screen" and "Open WebAPK" menu items.
*/
protected void prepareAddToHomescreenMenuItem(
@@ -271,6 +295,8 @@ public class AppMenuPropertiesDelegate {
? RELOAD_BUTTON_LEVEL_STOP_LOADING : RELOAD_BUTTON_LEVEL_RELOAD);
mReloadMenuItem.setTitle(isLoading
? R.string.accessibility_btn_stop_loading : R.string.accessibility_btn_refresh);
+ } else if (mAppMenuIconRowFooter != null) {
+ mAppMenuIconRowFooter.loadingStateChanged(isLoading);
}
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuIconRowFooter.java ('k') | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698