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
private final Menu mMenu;
private final int mItemRowHeight;
private final int mItemDividerHeight;
private final int mVerticalFadeDistance;
private final int mNegativeSoftwareVerticalOffset;
private final int mNegativeVerticalOffsetNotTopAnchored;
......@@ -79,13 +78,12 @@ class AppMenu implements OnItemClickListener, OnKeyListener, AppMenuAdapter.OnCl
* Creates and sets up the App Menu.
* @param menu Original menu created by the framework.
* @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 res Resources object used to get dimensions and style attributes.
* @param iconBeforeItem Whether icon is shown before the text.
*/
AppMenu(Menu menu, int itemRowHeight, int itemDividerHeight, AppMenuHandlerImpl handler,
Resources res, boolean iconBeforeItem) {
AppMenu(Menu menu, int itemRowHeight, AppMenuHandlerImpl handler, Resources res,
boolean iconBeforeItem) {
mMenu = menu;
mItemRowHeight = itemRowHeight;
......@@ -93,9 +91,6 @@ class AppMenu implements OnItemClickListener, OnKeyListener, AppMenuAdapter.OnCl
mHandler = handler;
mItemDividerHeight = itemDividerHeight;
assert mItemDividerHeight >= 0;
mNegativeSoftwareVerticalOffset =
res.getDimensionPixelSize(R.dimen.menu_negative_software_vertical_offset);
mVerticalFadeDistance = res.getDimensionPixelSize(R.dimen.menu_vertical_fade_distance);
......
......@@ -188,14 +188,14 @@ class AppMenuHandlerImpl
new ContextThemeWrapper(context, R.style.OverflowMenuThemeOverlay);
if (mAppMenu == null) {
TypedArray a = wrapper.obtainStyledAttributes(new int[] {
android.R.attr.listPreferredItemHeightSmall, android.R.attr.listDivider});
TypedArray a = wrapper.obtainStyledAttributes(
new int[] {android.R.attr.listPreferredItemHeightSmall});
int itemRowHeight = a.getDimensionPixelSize(0, 0);
Drawable itemDivider = a.getDrawable(1);
int itemDividerHeight = itemDivider != null ? itemDivider.getIntrinsicHeight() : 0;
a.recycle();
mAppMenu = new AppMenu(mMenu, itemRowHeight, itemDividerHeight, this,
context.getResources(), mDelegate.shouldShowIconBeforeItem());
mAppMenu = new AppMenu(mMenu, itemRowHeight, this, context.getResources(),
mDelegate.shouldShowIconBeforeItem());
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