Bug 1127445 - Fix Android 2.3 issues in toolbar menu. r=margaret

--HG--
extra : rebase_source : bfc30b022e63fd874d4541c1550448bc091ac6b9
This commit is contained in:
Michael Comella 2015-03-10 18:00:28 -07:00
Родитель e30edcd70c
Коммит 44017d010b
4 изменённых файлов: 36 добавлений и 5 удалений

Просмотреть файл

@ -3009,11 +3009,10 @@ public class BrowserApp extends GeckoApp
}
// Disable share menuitem for about:, chrome:, file:, and resource: URIs
final boolean shareEnabled = RestrictedProfiles.isAllowed(this, RestrictedProfiles.Restriction.DISALLOW_SHARE);
share.setVisible(shareEnabled);
quickShare.setVisible(shareEnabled);
share.setEnabled(StringUtils.isShareableUrl(url) && shareEnabled);
quickShare.setEnabled(StringUtils.isShareableUrl(url) && shareEnabled);
final boolean shareVisible = RestrictedProfiles.isAllowed(this, RestrictedProfiles.Restriction.DISALLOW_SHARE);
share.setVisible(shareVisible);
final boolean shareEnabled = StringUtils.isShareableUrl(url) && shareVisible;
share.setEnabled(shareEnabled);
MenuUtils.safeSetEnabled(aMenu, R.id.apps, RestrictedProfiles.isAllowed(this, RestrictedProfiles.Restriction.DISALLOW_INSTALL_APPS));
MenuUtils.safeSetEnabled(aMenu, R.id.addons, RestrictedProfiles.isAllowed(this, RestrictedProfiles.Restriction.DISALLOW_INSTALL_EXTENSION));
MenuUtils.safeSetEnabled(aMenu, R.id.downloads, RestrictedProfiles.isAllowed(this, RestrictedProfiles.Restriction.DISALLOW_DOWNLOADS));
@ -3030,6 +3029,9 @@ public class BrowserApp extends GeckoApp
// Action providers are available only ICS+.
if (Versions.feature14Plus) {
quickShare.setVisible(shareVisible);
quickShare.setEnabled(shareEnabled);
// This provider also applies to the quick share menu item.
final GeckoActionProvider provider = ((GeckoMenuItem) share).getGeckoActionProvider();
if (provider != null) {

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -33,6 +33,9 @@
<item android:id="@+id/share"
android:title="@string/share" />
<item android:id="@+id/reading_list"
android:title="@string/overlay_share_reading_list_btn_label" />
<item android:id="@+id/save_as_pdf"
android:title="@string/save_as_pdf" />
@ -81,6 +84,10 @@
To avoid nasty code workarounds, we define stub IDs here, but
hide the menu entries. -->
<item android:id="@+id/quickshare"
android:visible="false"
android:enabled="false" />
<item android:id="@+id/page"
android:visible="false"
android:enabled="false"