Commit 3abe288b authored by Gang Wu's avatar Gang Wu Committed by Commit Bot

remove mItemDividerHeight from app menu

This is different from current app menu redesign divider lines.
AppMenu#mItemDividerHeight added long time ago, from the screenshot in
crbug.com/331960,it seems app menu had divider lines between each items.
And mItemDividerHeight is for calculate the height for that divider
lines.

And from https://codereview.chromium.org/377083002, we start to use
OverflowMenuTheme in styles.xml(now it named OverflowMenuThemeOverlay),
and it set <item name="android:listDivider">@null</item>, so we are no
longer need AppMenu#mItemDividerHeight.

Change-Id: I8c6bf1a5c9aeb5b5ac82eda7c6a5e924c7432156
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2393523Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Commit-Queue: Gang Wu <gangwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805095}
parent 1e9ed1e1
...@@ -57,7 +57,6 @@ class AppMenu implements OnItemClickListener, OnKeyListener, AppMenuAdapter.OnCl ...@@ -57,7 +57,6 @@ class AppMenu implements OnItemClickListener, OnKeyListener, AppMenuAdapter.OnCl
private final Menu mMenu; private final Menu mMenu;
private final int mItemRowHeight; private final int mItemRowHeight;
private final int mItemDividerHeight;
private final int mVerticalFadeDistance; private final int mVerticalFadeDistance;
private final int mNegativeSoftwareVerticalOffset; private final int mNegativeSoftwareVerticalOffset;
private final int mNegativeVerticalOffsetNotTopAnchored; private final int mNegativeVerticalOffsetNotTopAnchored;
...@@ -79,13 +78,12 @@ class AppMenu implements OnItemClickListener, OnKeyListener, AppMenuAdapter.OnCl ...@@ -79,13 +78,12 @@ class AppMenu implements OnItemClickListener, OnKeyListener, AppMenuAdapter.OnCl
* Creates and sets up the App Menu. * Creates and sets up the App Menu.
* @param menu Original menu created by the framework. * @param menu Original menu created by the framework.
* @param itemRowHeight Desired height for each app menu row. * @param itemRowHeight Desired height for each app menu row.
* @param itemDividerHeight Desired height for the divider between app menu items.
* @param handler AppMenuHandlerImpl receives callbacks from AppMenu. * @param handler AppMenuHandlerImpl receives callbacks from AppMenu.
* @param res Resources object used to get dimensions and style attributes. * @param res Resources object used to get dimensions and style attributes.
* @param iconBeforeItem Whether icon is shown before the text. * @param iconBeforeItem Whether icon is shown before the text.
*/ */
AppMenu(Menu menu, int itemRowHeight, int itemDividerHeight, AppMenuHandlerImpl handler, AppMenu(Menu menu, int itemRowHeight, AppMenuHandlerImpl handler, Resources res,
Resources res, boolean iconBeforeItem) { boolean iconBeforeItem) {
mMenu = menu; mMenu = menu;
mItemRowHeight = itemRowHeight; mItemRowHeight = itemRowHeight;
...@@ -93,9 +91,6 @@ class AppMenu implements OnItemClickListener, OnKeyListener, AppMenuAdapter.OnCl ...@@ -93,9 +91,6 @@ class AppMenu implements OnItemClickListener, OnKeyListener, AppMenuAdapter.OnCl
mHandler = handler; mHandler = handler;
mItemDividerHeight = itemDividerHeight;
assert mItemDividerHeight >= 0;
mNegativeSoftwareVerticalOffset = mNegativeSoftwareVerticalOffset =
res.getDimensionPixelSize(R.dimen.menu_negative_software_vertical_offset); res.getDimensionPixelSize(R.dimen.menu_negative_software_vertical_offset);
mVerticalFadeDistance = res.getDimensionPixelSize(R.dimen.menu_vertical_fade_distance); mVerticalFadeDistance = res.getDimensionPixelSize(R.dimen.menu_vertical_fade_distance);
......
...@@ -188,14 +188,14 @@ class AppMenuHandlerImpl ...@@ -188,14 +188,14 @@ class AppMenuHandlerImpl
new ContextThemeWrapper(context, R.style.OverflowMenuThemeOverlay); new ContextThemeWrapper(context, R.style.OverflowMenuThemeOverlay);
if (mAppMenu == null) { if (mAppMenu == null) {
TypedArray a = wrapper.obtainStyledAttributes(new int[] { TypedArray a = wrapper.obtainStyledAttributes(
android.R.attr.listPreferredItemHeightSmall, android.R.attr.listDivider}); new int[] {android.R.attr.listPreferredItemHeightSmall});
int itemRowHeight = a.getDimensionPixelSize(0, 0); int itemRowHeight = a.getDimensionPixelSize(0, 0);
Drawable itemDivider = a.getDrawable(1); Drawable itemDivider = a.getDrawable(1);
int itemDividerHeight = itemDivider != null ? itemDivider.getIntrinsicHeight() : 0; int itemDividerHeight = itemDivider != null ? itemDivider.getIntrinsicHeight() : 0;
a.recycle(); a.recycle();
mAppMenu = new AppMenu(mMenu, itemRowHeight, itemDividerHeight, this, mAppMenu = new AppMenu(mMenu, itemRowHeight, this, context.getResources(),
context.getResources(), mDelegate.shouldShowIconBeforeItem()); mDelegate.shouldShowIconBeforeItem());
mAppMenuDragHelper = new AppMenuDragHelper(context, mAppMenu, itemRowHeight); mAppMenuDragHelper = new AppMenuDragHelper(context, mAppMenu, itemRowHeight);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment