Bug 1209967 - Remove android:icons from GB menu. r=sebastian

ic_menu_back was not in the v11 folder so I moved the all-API asset to the v11
folder.
This commit is contained in:
Michael Comella 2015-11-17 17:03:07 -08:00
parent 6396749d5f
commit 560dd56c68
18 changed files with 50 additions and 12 deletions

View File

@ -3031,7 +3031,6 @@ public class BrowserApp extends GeckoApp
bookmark.setVisible(!inGuestMode);
bookmark.setCheckable(true);
bookmark.setChecked(tab.isBookmark());
bookmark.setIcon(resolveBookmarkIconID(tab.isBookmark()));
bookmark.setTitle(resolveBookmarkTitleID(tab.isBookmark()));
reader.setEnabled(isAboutReader || !AboutPages.isAboutPage(tab.getURL()));
@ -3039,9 +3038,14 @@ public class BrowserApp extends GeckoApp
reader.setCheckable(true);
final boolean isPageInReadingList = tab.isInReadingList();
reader.setChecked(isPageInReadingList);
reader.setIcon(resolveReadingListIconID(isPageInReadingList));
reader.setTitle(resolveReadingListTitleID(isPageInReadingList));
if (Versions.feature11Plus) {
// We don't use icons on GB builds so not resolving icons might conserve resources.
bookmark.setIcon(resolveBookmarkIconID(tab.isBookmark()));
reader.setIcon(resolveReadingListIconID(isPageInReadingList));
}
back.setEnabled(tab.canDoBack());
forward.setEnabled(tab.canDoForward());
desktopMode.setChecked(tab.getDesktopMode());
@ -3190,6 +3194,7 @@ public class BrowserApp extends GeckoApp
}
private int resolveBookmarkIconID(final boolean isBookmark) {
Assert.isTrue(Versions.feature11Plus, "We don't use menu icons on v11+ so don't set them to conserve resources.");
if (isBookmark) {
return R.drawable.ic_menu_bookmark_remove;
} else {
@ -3202,6 +3207,7 @@ public class BrowserApp extends GeckoApp
}
private int resolveReadingListIconID(final boolean isInReadingList) {
Assert.isTrue(Versions.feature11Plus, "We don't use menu icons on v11+ so don't set them to conserve resources.");
return (isInReadingList ? R.drawable.ic_menu_reader_remove : R.drawable.ic_menu_reader_add);
}
@ -3233,13 +3239,19 @@ public class BrowserApp extends GeckoApp
if (item.isChecked()) {
Telemetry.sendUIEvent(TelemetryContract.Event.UNSAVE, TelemetryContract.Method.MENU, "bookmark");
tab.removeBookmark();
item.setIcon(resolveBookmarkIconID(false));
item.setTitle(resolveBookmarkTitleID(false));
if (Versions.feature11Plus) {
// We don't use icons on GB builds so not resolving icons might conserve resources.
item.setIcon(resolveBookmarkIconID(false));
}
} else {
Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.MENU, "bookmark");
tab.addBookmark();
item.setIcon(resolveBookmarkIconID(true));
item.setTitle(resolveBookmarkTitleID(true));
if (Versions.feature11Plus) {
// We don't use icons on GB builds so not resolving icons might conserve resources.
item.setIcon(resolveBookmarkIconID(true));
}
}
}
return true;
@ -3251,13 +3263,19 @@ public class BrowserApp extends GeckoApp
if (item.isChecked()) {
Telemetry.sendUIEvent(TelemetryContract.Event.UNSAVE, TelemetryContract.Method.MENU, "reading_list");
tab.removeFromReadingList();
item.setIcon(resolveReadingListIconID(false));
item.setTitle(resolveReadingListTitleID(false));
if (Versions.feature11Plus) {
// We don't use icons on GB builds so not resolving icons might conserve resources.
item.setIcon(resolveReadingListIconID(false));
}
} else {
Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.MENU, "reading_list");
tab.addToReadingList();
item.setIcon(resolveReadingListIconID(true));
item.setTitle(resolveReadingListTitleID(true));
if (Versions.feature11Plus) {
// We don't use icons on GB builds so not resolving icons might conserve resources.
item.setIcon(resolveReadingListIconID(true));
}
}
}
return true;

View File

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,13 @@
<?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/. -->
<!-- This asset is properly available in large-* dirs so this null
reference exists for build time on API 9 builds. -->
<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,13 @@
<?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/. -->
<!-- This asset is properly available in large-* dirs so this null
reference exists for build time on API 9 builds. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent"/>
</shape>

View File

@ -6,30 +6,24 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/reload"
android:icon="@drawable/ic_menu_reload"
android:title="@string/reload"/>
<!-- We keep the reference so calls to findView don't fail. Hide
to avoid taking up real estate on the users' screen. -->
<item android:id="@+id/back"
android:icon="@drawable/ic_menu_back"
android:title="@string/back"
android:visible="false"/>
<item android:id="@+id/forward"
android:icon="@drawable/ic_menu_forward"
android:title="@string/forward"/>
<item android:id="@+id/bookmark"
android:icon="@drawable/ic_menu_bookmark_add"
android:title="@string/bookmark"/>
<item android:id="@+id/new_tab"
android:icon="@drawable/ic_menu_new_tab"
android:title="@string/new_tab"/>
<item android:id="@+id/new_private_tab"
android:icon="@drawable/ic_menu_new_private_tab"
android:title="@string/new_private_tab"/>
<item android:id="@+id/share"