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

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..6b7eac9e707be272254df3092964cb996db3edce 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);
- mAppMenuDragHelper = new AppMenuDragHelper(mActivity, mAppMenu);
+ 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, itemRowHeight);
}
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;
@@ -113,14 +122,6 @@ public class AppMenuHandler {
}
/**
- * @return The number of items in the AppMenu.
- */
- public int getItemCount() {
- if (mAppMenu == null) return -1;
- return mAppMenu.getCount();
- }
-
- /**
* Adds the observer to App Menu.
* @param observer Observer that should be notified about App Menu changes.
*/

Powered by Google App Engine
This is Rietveld 408576698