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

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

Issue 203173008: Cleanup Icon Row custom code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 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/AppMenuHandler.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java
index ba6df4fba228f979732a952a4227a2c9bd16032f..5f67f40c311186c8d17556d9b18d09ea82e5750a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java
@@ -5,6 +5,8 @@
package org.chromium.chrome.browser.appmenu;
import android.app.Activity;
+import android.content.res.TypedArray;
+import android.graphics.Rect;
import android.view.ContextThemeWrapper;
import android.view.Menu;
import android.view.MenuItem;
@@ -70,14 +72,21 @@ public class AppMenuHandler {
mDelegate.prepareMenu(mMenu);
if (mAppMenu == null) {
- mAppMenu = new AppMenu(mActivity, mMenu, mDelegate.getItemRowHeight(), this);
+ TypedArray a = mActivity.obtainStyledAttributes(
+ new int[] {android.R.attr.listPreferredItemHeightSmall});
+ int itemRowHeight = a.getDimensionPixelSize(0, 0);
+ a.recycle();
+ mAppMenu = new AppMenu(mMenu, itemRowHeight, this, mActivity.getResources());
mAppMenuDragHelper = new AppMenuDragHelper(mActivity, mAppMenu);
}
ContextThemeWrapper wrapper = new ContextThemeWrapper(mActivity,
mDelegate.getMenuThemeResourceId());
- boolean showIcons = mDelegate.shouldShowIconRow();
- mAppMenu.show(wrapper, anchorView, showIcons, isByHardwareButton);
+ // Get the height and width of the display.
+ Rect appRect = new Rect();
+ mActivity.getWindow().getDecorView().getWindowVisibleDisplayFrame(appRect);
+ int rotation = mActivity.getWindowManager().getDefaultDisplay().getRotation();
+ mAppMenu.show(wrapper, anchorView, isByHardwareButton, rotation, appRect);
mAppMenuDragHelper.onShow(isByHardwareButton, startDragging);
UmaBridge.menuShow();
return true;

Powered by Google App Engine
This is Rietveld 408576698