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

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

Issue 381133003: Add menu button to menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 6 years, 5 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/AppMenu.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java
index a227ef07873ad69287375c247956d6ec7c9d0600..ed11493337fe0f4008eec88bed92d6fe67ca255d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java
@@ -34,6 +34,9 @@ import java.util.List;
* - Disabled items are grayed out.
*/
public class AppMenu implements OnItemClickListener, OnKeyListener {
+ /** Whether or not to show the software menu button in the menu. */
+ private static final boolean SHOW_SW_MENU_BUTTON = false;
+
private static final float LAST_ITEM_SHOW_FRACTION = 0.5f;
private final Menu mMenu;
@@ -97,12 +100,19 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
mHandler.onMenuVisibilityChanged(false);
}
});
- mPopup.setWidth(context.getResources().getDimensionPixelSize(R.dimen.menu_width));
// Need to explicitly set the background here. Relying on it being set in the style caused
// an incorrectly drawn background.
mPopup.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.menu_bg));
+ Rect bgPadding = new Rect();
+ mPopup.getBackground().getPadding(bgPadding);
+
+ int popupWidth = context.getResources().getDimensionPixelSize(R.dimen.menu_width) +
+ bgPadding.left + bgPadding.right;
+
+ mPopup.setWidth(popupWidth);
+
mCurrentScreenRotation = screenRotation;
mIsByHardwareButton = isByHardwareButton;
@@ -116,9 +126,12 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
}
}
+ boolean showMenuButton = !mIsByHardwareButton;
+ if (!SHOW_SW_MENU_BUTTON) showMenuButton = false;
// A List adapter for visible items in the Menu. The first row is added as a header to the
// list view.
- mAdapter = new AppMenuAdapter(this, menuItems, LayoutInflater.from(context));
+ mAdapter = new AppMenuAdapter(
+ this, menuItems, LayoutInflater.from(context), showMenuButton);
mPopup.setAdapter(mAdapter);
setMenuHeight(menuItems.size(), visibleDisplayFrame);
@@ -264,4 +277,4 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
mPopup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
}
}
-}
+}

Powered by Google App Engine
This is Rietveld 408576698