Bug 794088: Replace icons in custom menu. [r=mfinkle]

--HG--
extra : rebase_source : cd915e11fb496918670b706a3ae2357d68ced7da
This commit is contained in:
Sriram Ramasubramanian 2012-09-27 11:04:02 -07:00
parent b9ed7e8ba3
commit 3475237b17
70 changed files with 141 additions and 40 deletions

View File

@ -770,17 +770,12 @@ abstract public class BrowserApp extends GeckoApp
bookmark.setEnabled(!tab.getURL().startsWith("about:reader"));
bookmark.setCheckable(true);
if (tab.isBookmark()) {
bookmark.setChecked(true);
bookmark.setIcon(R.drawable.ic_menu_bookmark_remove);
} else {
bookmark.setChecked(false);
bookmark.setIcon(R.drawable.ic_menu_bookmark_add);
}
bookmark.setChecked(tab.isBookmark());
bookmark.setIcon(tab.isBookmark() ? R.drawable.ic_menu_bookmark_remove : R.drawable.ic_menu_bookmark_add);
forward.setEnabled(tab.canDoForward());
desktopMode.setChecked(tab.getDesktopMode());
desktopMode.setIcon(tab.getDesktopMode() ? R.drawable.ic_menu_desktop_mode_on : R.drawable.ic_menu_desktop_mode_off);
String url = tab.getURL();
if (ReaderModeUtils.isAboutReader(url))

View File

@ -25,6 +25,7 @@ public class GeckoMenuItem implements MenuItem, View.OnClickListener {
public void setCheckable(boolean checkable);
public void setChecked(boolean checked);
public void setOnClickListener(View.OnClickListener listener);
public void setSubMenuIndicator(boolean hasSubMenu);
public void setVisibility(int visible);
public View getLayout();
}
@ -316,6 +317,7 @@ public class GeckoMenuItem implements MenuItem, View.OnClickListener {
public MenuItem setSubMenu(GeckoSubMenu subMenu) {
mSubMenu = subMenu;
mLayout.setSubMenuIndicator(subMenu != null);
return this;
}

View File

@ -465,10 +465,13 @@ RES_DRAWABLE_BASE = \
res/drawable/ic_menu_back.xml \
res/drawable/ic_menu_bookmark_add.png \
res/drawable/ic_menu_bookmark_remove.png \
res/drawable/ic_menu_desktop_mode_off.xml \
res/drawable/ic_menu_desktop_mode_on.xml \
res/drawable/ic_menu_forward.png \
res/drawable/ic_menu_reload.png \
res/drawable/ic_menu_save_as_pdf.png \
res/drawable/ic_menu_share.png \
res/drawable/ic_menu_forward.png \
res/drawable/ic_menu_quit.xml \
res/drawable/remote_tabs_off.png \
res/drawable/remote_tabs_on.png \
res/drawable/tab_new.png \
@ -641,20 +644,28 @@ RES_DRAWABLE_MDPI_V11 = \
res/drawable-mdpi-v11/alert_addon.png \
res/drawable-mdpi-v11/alert_app.png \
res/drawable-mdpi-v11/alert_download.png \
res/drawable-mdpi-v11/ic_menu_addons.png \
res/drawable-mdpi-v11/ic_menu_apps.png \
res/drawable-mdpi-v11/ic_menu_back.png \
res/drawable-mdpi-v11/ic_menu_bookmark_add.png \
res/drawable-mdpi-v11/ic_menu_bookmark_remove.png \
res/drawable-mdpi-v11/ic_menu_desktop_mode.png \
res/drawable-mdpi-v11/ic_menu_desktop_mode_off.png \
res/drawable-mdpi-v11/ic_menu_desktop_mode_on.png \
res/drawable-mdpi-v11/ic_menu_downloads.png \
res/drawable-mdpi-v11/ic_menu_find_in_page.png \
res/drawable-mdpi-v11/ic_menu_forward.png \
res/drawable-mdpi-v11/ic_menu_reload.png \
res/drawable-mdpi-v11/ic_menu_save_as_pdf.png \
res/drawable-mdpi-v11/ic_menu_settings.png \
res/drawable-mdpi-v11/ic_menu_share.png \
res/drawable-mdpi-v11/ic_menu_tools.png \
res/drawable-mdpi-v11/ic_menu_quit.png \
res/drawable-mdpi-v11/menu.png \
res/drawable-mdpi-v11/menu_panel_bg.9.png \
res/drawable-mdpi-v11/menu_popup_bg.9.png \
res/drawable-mdpi-v11/menu_popup_arrow.png \
res/drawable-mdpi-v11/menu_item_check.png \
res/drawable-mdpi-v11/menu_item_more.png \
res/drawable-mdpi-v11/menu_item_uncheck.png \
$(NULL)
@ -662,20 +673,28 @@ RES_DRAWABLE_HDPI_V11 = \
res/drawable-hdpi-v11/alert_addon.png \
res/drawable-hdpi-v11/alert_app.png \
res/drawable-hdpi-v11/alert_download.png \
res/drawable-hdpi-v11/ic_menu_addons.png \
res/drawable-hdpi-v11/ic_menu_apps.png \
res/drawable-hdpi-v11/ic_menu_back.png \
res/drawable-hdpi-v11/ic_menu_bookmark_add.png \
res/drawable-hdpi-v11/ic_menu_bookmark_remove.png \
res/drawable-hdpi-v11/ic_menu_desktop_mode.png \
res/drawable-hdpi-v11/ic_menu_desktop_mode_off.png \
res/drawable-hdpi-v11/ic_menu_desktop_mode_on.png \
res/drawable-hdpi-v11/ic_menu_downloads.png \
res/drawable-hdpi-v11/ic_menu_find_in_page.png \
res/drawable-hdpi-v11/ic_menu_forward.png \
res/drawable-hdpi-v11/ic_menu_reload.png \
res/drawable-hdpi-v11/ic_menu_save_as_pdf.png \
res/drawable-hdpi-v11/ic_menu_settings.png \
res/drawable-hdpi-v11/ic_menu_share.png \
res/drawable-hdpi-v11/ic_menu_tools.png \
res/drawable-hdpi-v11/ic_menu_quit.png \
res/drawable-hdpi-v11/menu.png \
res/drawable-hdpi-v11/menu_panel_bg.9.png \
res/drawable-hdpi-v11/menu_popup_bg.9.png \
res/drawable-hdpi-v11/menu_popup_arrow.png \
res/drawable-hdpi-v11/menu_item_check.png \
res/drawable-hdpi-v11/menu_item_more.png \
res/drawable-hdpi-v11/menu_item_uncheck.png \
$(NULL)
@ -683,20 +702,28 @@ RES_DRAWABLE_XHDPI_V11 = \
res/drawable-xhdpi-v11/alert_addon.png \
res/drawable-xhdpi-v11/alert_app.png \
res/drawable-xhdpi-v11/alert_download.png \
res/drawable-xhdpi-v11/ic_menu_addons.png \
res/drawable-xhdpi-v11/ic_menu_apps.png \
res/drawable-xhdpi-v11/ic_menu_back.png \
res/drawable-xhdpi-v11/ic_menu_bookmark_add.png \
res/drawable-xhdpi-v11/ic_menu_bookmark_remove.png \
res/drawable-xhdpi-v11/ic_menu_desktop_mode.png \
res/drawable-xhdpi-v11/ic_menu_desktop_mode_off.png \
res/drawable-xhdpi-v11/ic_menu_desktop_mode_on.png \
res/drawable-xhdpi-v11/ic_menu_downloads.png \
res/drawable-xhdpi-v11/ic_menu_find_in_page.png \
res/drawable-xhdpi-v11/ic_menu_forward.png \
res/drawable-xhdpi-v11/ic_menu_reload.png \
res/drawable-xhdpi-v11/ic_menu_save_as_pdf.png \
res/drawable-xhdpi-v11/ic_menu_settings.png \
res/drawable-xhdpi-v11/ic_menu_share.png \
res/drawable-xhdpi-v11/ic_menu_tools.png \
res/drawable-xhdpi-v11/ic_menu_quit.png \
res/drawable-xhdpi-v11/menu.png \
res/drawable-xhdpi-v11/menu_panel_bg.9.png \
res/drawable-xhdpi-v11/menu_popup_bg.9.png \
res/drawable-xhdpi-v11/menu_popup_arrow.png \
res/drawable-xhdpi-v11/menu_item_check.png \
res/drawable-xhdpi-v11/menu_item_more.png \
res/drawable-xhdpi-v11/menu_item_uncheck.png \
$(NULL)

View File

@ -72,4 +72,8 @@ public class MenuItemActionBar extends ImageButton
@Override
public void setChecked(boolean checked) {
}
@Override
public void setSubMenuIndicator(boolean hasSubMenu) {
}
}

View File

@ -22,9 +22,11 @@ public class MenuItemDefault extends LinearLayout
private ImageView mIcon;
private TextView mTitle;
private CheckBox mCheck;
private ImageView mMore;
private boolean mCheckable;
private boolean mChecked;
private boolean mHasSubMenu;
public MenuItemDefault(Context context, AttributeSet attrs) {
super(context, attrs);
@ -37,9 +39,11 @@ public class MenuItemDefault extends LinearLayout
mIcon = (ImageView) findViewById(R.id.icon);
mTitle = (TextView) findViewById(R.id.title);
mCheck = (CheckBox) findViewById(R.id.check);
mMore = (ImageView) findViewById(R.id.more);
mCheckable = false;
mChecked = false;
mHasSubMenu = false;
}
@Override
@ -78,12 +82,13 @@ public class MenuItemDefault extends LinearLayout
mTitle.setEnabled(enabled);
mCheck.setEnabled(enabled);
mIcon.setColorFilter(enabled ? 0 : 0xFF999999);
mMore.setColorFilter(enabled ? 0 : 0xFF999999);
}
@Override
public void setCheckable(boolean checkable) {
mCheckable = checkable;
mCheck.setVisibility(mCheckable ? VISIBLE : GONE);
mCheck.setVisibility(mCheckable && !mHasSubMenu ? VISIBLE : GONE);
}
@Override
@ -91,4 +96,11 @@ public class MenuItemDefault extends LinearLayout
mChecked = checked;
mCheck.setChecked(mChecked);
}
@Override
public void setSubMenuIndicator(boolean hasSubMenu) {
mHasSubMenu = hasSubMenu;
mMore.setVisibility(mHasSubMenu ? VISIBLE : GONE);
mCheck.setVisibility(mCheckable && !mHasSubMenu ? VISIBLE : GONE);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent"/>
</shape>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent"/>
</shape>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent"/>
</shape>

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<View android:layout_width="14dp"
<View android:layout_width="10dp"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"/>
<ImageView android:id="@+id/icon"
android:layout_width="24dp"
android:layout_height="18dp"
android:layout_width="27dp"
android:layout_height="21dp"
android:paddingRight="6dp"
android:layout_gravity="center_vertical"
android:visibility="gone"/>
@ -22,16 +22,28 @@
android:ellipsize="middle"
android:layout_gravity="center_vertical"/>
<CheckBox android:id="@+id/check"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_gravity="center_vertical"
android:button="@drawable/menu_item_checkmark"
android:focusable="false"
android:clickable="false"
android:visibility="gone"/>
<FrameLayout android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginBottom="2dp"
android:layout_gravity="center_vertical">
<View android:layout_width="14dp"
<CheckBox android:id="@+id/check"
android:layout_width="18dp"
android:layout_height="18dp"
android:button="@drawable/menu_item_checkmark"
android:focusable="false"
android:clickable="false"
android:visibility="gone"/>
<ImageView android:id="@+id/more"
android:layout_width="18dp"
android:layout_height="18dp"
android:src="@drawable/menu_item_more"
android:visibility="gone"/>
</FrameLayout>
<View android:layout_width="10dp"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"/>

View File

@ -28,11 +28,12 @@
android:title="@string/find_in_page" />
<item android:id="@+id/desktop_mode"
android:icon="@drawable/ic_menu_desktop_mode"
android:icon="@drawable/ic_menu_desktop_mode_off"
android:title="@string/desktop_mode"
android:checkable="true" />
<item android:title="@string/tools">
<item android:title="@string/tools"
android:icon="@drawable/ic_menu_tools">
<menu>
@ -40,15 +41,18 @@
android:icon="@drawable/ic_menu_save_as_pdf"
android:title="@string/save_as_pdf" />
<item android:id="@+id/addons"
android:title="@string/addons"/>
<item android:id="@+id/downloads"
android:icon="@drawable/ic_menu_downloads"
android:title="@string/downloads"/>
<item android:id="@+id/addons"
android:icon="@drawable/ic_menu_addons"
android:title="@string/addons"/>
#if MOZ_UPDATE_CHANNEL != beta
#if MOZ_UPDATE_CHANNEL != release
<item android:id="@+id/apps"
android:icon="@drawable/ic_menu_apps"
android:title="@string/apps"/>
#endif
#endif
@ -62,6 +66,7 @@
android:title="@string/char_encoding"/>
<item android:id="@+id/settings"
android:icon="@drawable/ic_menu_settings"
android:title="@string/settings" />
#ifdef MOZ_PROFILING

View File

@ -29,11 +29,12 @@
android:title="@string/find_in_page" />
<item android:id="@+id/desktop_mode"
android:icon="@drawable/ic_menu_desktop_mode"
android:icon="@drawable/ic_menu_desktop_mode_off"
android:title="@string/desktop_mode"
android:checkable="true" />
<item android:title="@string/tools">
<item android:title="@string/tools"
android:icon="@drawable/ic_menu_tools">
<menu>
@ -41,15 +42,18 @@
android:icon="@drawable/ic_menu_save_as_pdf"
android:title="@string/save_as_pdf" />
<item android:id="@+id/addons"
android:title="@string/addons"/>
<item android:id="@+id/downloads"
android:icon="@drawable/ic_menu_downloads"
android:title="@string/downloads"/>
<item android:id="@+id/addons"
android:icon="@drawable/ic_menu_addons"
android:title="@string/addons"/>
#if MOZ_UPDATE_CHANNEL != beta
#if MOZ_UPDATE_CHANNEL != release
<item android:id="@+id/apps"
android:icon="@drawable/ic_menu_apps"
android:title="@string/apps"/>
#endif
#endif
@ -63,6 +67,7 @@
android:title="@string/char_encoding"/>
<item android:id="@+id/settings"
android:icon="@drawable/ic_menu_settings"
android:title="@string/settings" />
#ifdef MOZ_PROFILING

View File

@ -29,11 +29,12 @@
android:title="@string/find_in_page" />
<item android:id="@+id/desktop_mode"
android:icon="@drawable/ic_menu_desktop_mode"
android:icon="@drawable/ic_menu_desktop_mode_off"
android:title="@string/desktop_mode"
android:checkable="true" />
<item android:title="@string/tools">
<item android:title="@string/tools"
android:icon="@drawable/ic_menu_tools">
<menu>
@ -41,15 +42,18 @@
android:icon="@drawable/ic_menu_save_as_pdf"
android:title="@string/save_as_pdf" />
<item android:id="@+id/addons"
android:title="@string/addons"/>
<item android:id="@+id/downloads"
android:icon="@drawable/ic_menu_downloads"
android:title="@string/downloads"/>
<item android:id="@+id/addons"
android:icon="@drawable/ic_menu_addons"
android:title="@string/addons"/>
#if MOZ_UPDATE_CHANNEL != beta
#if MOZ_UPDATE_CHANNEL != release
<item android:id="@+id/apps"
android:icon="@drawable/ic_menu_apps"
android:title="@string/apps"/>
#endif
#endif
@ -63,6 +67,7 @@
android:title="@string/char_encoding"/>
<item android:id="@+id/settings"
android:icon="@drawable/ic_menu_settings"
android:title="@string/settings" />
#ifdef MOZ_PROFILING

View File

@ -5,6 +5,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/quit"
android:icon="@drawable/ic_menu_quit"
android:title="@string/quit"
android:orderInCategory="10" />
</menu>