Commit 8418bc19 authored by aurimas's avatar aurimas Committed by Commit bot

Remove unused menu item types.

two_button_menu_item was added in https://codereview.chromium.org/608283004
but it is not used anymore due to menu button removal from the menu popup.

four_button_menu_item was also added to support menu button inside the menu
popup.

BUG=None

Review URL: https://codereview.chromium.org/934353003

Cr-Commit-Position: refs/heads/master@{#317103}
parent 659e4cc9
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeightSmall"
android:layout_gravity="top|start"
android:orientation="horizontal">
<org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/button_one"
android:layout_width="59dp"
android:layout_height="match_parent"
android:paddingEnd="11dp"
android:background="?attr/listChoiceBackgroundIndicator"
android:scaleType="center" />
<org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/button_two"
android:layout_width="70dp"
android:layout_height="match_parent"
android:paddingStart="11dp"
android:paddingEnd="11dp"
android:background="?attr/listChoiceBackgroundIndicator"
android:scaleType="center" />
<org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/button_three"
android:layout_width="70dp"
android:layout_height="match_parent"
android:paddingStart="11dp"
android:paddingEnd="11dp"
android:background="?attr/listChoiceBackgroundIndicator"
android:scaleType="center" />
<org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/button_four"
android:layout_width="59dp"
android:layout_height="match_parent"
android:paddingStart="11dp"
android:background="?attr/listChoiceBackgroundIndicator"
android:scaleType="center" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeightSmall"
android:layout_gravity="top|start"
android:orientation="horizontal">
<org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/button_one"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?attr/listChoiceBackgroundIndicator"
android:scaleType="center" />
<org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/button_two"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?attr/listChoiceBackgroundIndicator"
android:scaleType="center" />
</LinearLayout>
\ No newline at end of file
......@@ -39,23 +39,15 @@ class AppMenuAdapter extends BaseAdapter {
* It is different from the regular menu item because it contains two separate buttons.
*/
private static final int TITLE_BUTTON_MENU_ITEM = 1;
/**
* Menu item that has two buttons. Every one of these buttons is displayed as an icon.
*/
private static final int TWO_BUTTON_MENU_ITEM = 2;
/**
* Menu item that has three buttons. Every one of these buttons is displayed as an icon.
*/
private static final int THREE_BUTTON_MENU_ITEM = 3;
/**
* Menu item that has four buttons. Every one of these buttons is displayed as an icon.
*/
private static final int FOUR_BUTTON_MENU_ITEM = 4;
private static final int THREE_BUTTON_MENU_ITEM = 2;
/**
* The number of view types specified above. If you add a view type you MUST increment this.
*/
private static final int VIEW_TYPE_COUNT = 5;
private static final int VIEW_TYPE_COUNT = 3;
/** MenuItem Animation Constants */
private static final int ENTER_ITEM_DURATION_MS = 350;
......@@ -93,14 +85,9 @@ class AppMenuAdapter extends BaseAdapter {
MenuItem item = getItem(position);
int viewCount = item.hasSubMenu() ? item.getSubMenu().size() : 1;
if (viewCount == 4) {
return FOUR_BUTTON_MENU_ITEM;
} else if (viewCount == 3) {
if (viewCount == 3) {
return THREE_BUTTON_MENU_ITEM;
} else if (viewCount == 2) {
if (position == 0 && item.getSubMenu().getItem(0).getIcon() != null) {
return TWO_BUTTON_MENU_ITEM;
}
return TITLE_BUTTON_MENU_ITEM;
}
return STANDARD_MENU_ITEM;
......@@ -158,28 +145,6 @@ class AppMenuAdapter extends BaseAdapter {
convertView.setEnabled(isEnabled);
break;
}
case TWO_BUTTON_MENU_ITEM: {
TwoButtonMenuItemViewHolder holder = null;
if (convertView == null) {
holder = new TwoButtonMenuItemViewHolder();
convertView = mInflater.inflate(R.layout.two_button_menu_item, parent, false);
holder.buttons[0] =
(TintedImageButton) convertView.findViewById(R.id.button_one);
holder.buttons[1] =
(TintedImageButton) convertView.findViewById(R.id.button_two);
convertView.setTag(holder);
convertView.setTag(R.id.menu_item_enter_anim_id,
buildIconItemEnterAnimator(holder.buttons));
} else {
holder = (TwoButtonMenuItemViewHolder) convertView.getTag();
}
setupImageButton(holder.buttons[0], item.getSubMenu().getItem(0));
setupImageButton(holder.buttons[1], item.getSubMenu().getItem(1));
convertView.setFocusable(false);
convertView.setEnabled(false);
break;
}
case THREE_BUTTON_MENU_ITEM: {
ThreeButtonMenuItemViewHolder holder = null;
if (convertView == null) {
......@@ -205,34 +170,6 @@ class AppMenuAdapter extends BaseAdapter {
convertView.setEnabled(false);
break;
}
case FOUR_BUTTON_MENU_ITEM: {
FourButtonMenuItemViewHolder holder = null;
if (convertView == null) {
holder = new FourButtonMenuItemViewHolder();
convertView = mInflater.inflate(R.layout.four_button_menu_item, parent, false);
holder.buttons[0] =
(TintedImageButton) convertView.findViewById(R.id.button_one);
holder.buttons[1] =
(TintedImageButton) convertView.findViewById(R.id.button_two);
holder.buttons[2] =
(TintedImageButton) convertView.findViewById(R.id.button_three);
holder.buttons[3] =
(TintedImageButton) convertView.findViewById(R.id.button_four);
convertView.setTag(holder);
convertView.setTag(R.id.menu_item_enter_anim_id,
buildIconItemEnterAnimator(holder.buttons));
} else {
holder = (FourButtonMenuItemViewHolder) convertView.getTag();
}
setupImageButton(holder.buttons[0], item.getSubMenu().getItem(0));
setupImageButton(holder.buttons[1], item.getSubMenu().getItem(1));
setupImageButton(holder.buttons[2], item.getSubMenu().getItem(2));
setupImageButton(holder.buttons[3], item.getSubMenu().getItem(3));
convertView.setFocusable(false);
convertView.setEnabled(false);
break;
}
case TITLE_BUTTON_MENU_ITEM: {
TitleButtonMenuItemViewHolder holder = null;
if (convertView == null) {
......@@ -376,18 +313,10 @@ class AppMenuAdapter extends BaseAdapter {
public AppMenuItemIcon image;
}
static class TwoButtonMenuItemViewHolder {
public TintedImageButton[] buttons = new TintedImageButton[2];
}
static class ThreeButtonMenuItemViewHolder {
public TintedImageButton[] buttons = new TintedImageButton[3];
}
static class FourButtonMenuItemViewHolder {
public TintedImageButton[] buttons = new TintedImageButton[4];
}
static class TitleButtonMenuItemViewHolder {
public TextView title;
public TintedImageButton button;
......
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