Bug 1265433 - Move bookmarks star into top bar of menu r=sebastian
We do this by showing history items in the "share" menu item, and removing the existing "quickshare" item that showed history items. We also need to shuffle our icon sizes around: our xhdpi icon size matches the hdpi icon sizes of the other icons in the top bar (modulo padding, which we need to add as part of this commit), similarly our xxhdpi icon is shifted to xhdpi. We don't supply an xxhdpi icon at all for any of the icons in the top bar of the menu, hence that size is removed (and reused for the xhdpi icon, see above). MozReview-Commit-ID: 7fabPQ5Tyst --HG-- extra : rebase_source : 5ef599a8a8a2d2a34555169ab0f56d98f0bc1ab6 extra : amend_source : 620947076e7bf4b02a5c3566240a28dc5d9de2c5 extra : source : e6d92ec5cc178d771a0ef2350a653795cdd198e1
|
@ -3170,12 +3170,10 @@ public class BrowserApp extends GeckoApp
|
|||
// Action providers are available only ICS+.
|
||||
if (Versions.feature14Plus) {
|
||||
GeckoMenuItem share = (GeckoMenuItem) mMenu.findItem(R.id.share);
|
||||
final GeckoMenuItem quickShare = (GeckoMenuItem) mMenu.findItem(R.id.quickshare);
|
||||
|
||||
GeckoActionProvider provider = GeckoActionProvider.getForType(GeckoActionProvider.DEFAULT_MIME_TYPE, this);
|
||||
|
||||
share.setActionProvider(provider);
|
||||
quickShare.setActionProvider(provider);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -3272,7 +3270,6 @@ public class BrowserApp extends GeckoApp
|
|||
final MenuItem back = aMenu.findItem(R.id.back);
|
||||
final MenuItem forward = aMenu.findItem(R.id.forward);
|
||||
final MenuItem share = aMenu.findItem(R.id.share);
|
||||
final MenuItem quickShare = aMenu.findItem(R.id.quickshare);
|
||||
final MenuItem bookmarksList = aMenu.findItem(R.id.bookmarks_list);
|
||||
final MenuItem historyList = aMenu.findItem(R.id.history_list);
|
||||
final MenuItem saveAsPDF = aMenu.findItem(R.id.save_as_pdf);
|
||||
|
@ -3300,7 +3297,6 @@ public class BrowserApp extends GeckoApp
|
|||
back.setEnabled(false);
|
||||
forward.setEnabled(false);
|
||||
share.setEnabled(false);
|
||||
quickShare.setEnabled(false);
|
||||
saveAsPDF.setEnabled(false);
|
||||
print.setEnabled(false);
|
||||
findInPage.setEnabled(false);
|
||||
|
@ -3400,9 +3396,6 @@ 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) {
|
||||
|
|
|
@ -17,8 +17,7 @@ import android.view.SubMenu;
|
|||
import android.view.View;
|
||||
|
||||
public class GeckoMenuItem implements MenuItem {
|
||||
private static final int SECONDARY_ACTION_BAR_HISTORY_SIZE = 0;
|
||||
private static final int QUICK_SHARE_ACTION_BAR_HISTORY_SIZE = 3;
|
||||
private static final int SHARE_BAR_HISTORY_SIZE = 2;
|
||||
|
||||
// These values mirror MenuItem values that are only available on API >= 11.
|
||||
public static final int SHOW_AS_ACTION_NEVER = 0;
|
||||
|
@ -135,13 +134,8 @@ public class GeckoMenuItem implements MenuItem {
|
|||
@Override
|
||||
public View getActionView() {
|
||||
if (mActionProvider != null) {
|
||||
if (getActionEnum() == MenuItem.SHOW_AS_ACTION_IF_ROOM) {
|
||||
return mActionProvider.onCreateActionView(SECONDARY_ACTION_BAR_HISTORY_SIZE,
|
||||
GeckoActionProvider.ActionViewType.DEFAULT);
|
||||
} else {
|
||||
return mActionProvider.onCreateActionView(QUICK_SHARE_ACTION_BAR_HISTORY_SIZE,
|
||||
GeckoActionProvider.ActionViewType.QUICK_SHARE_ICON);
|
||||
}
|
||||
return mActionProvider.onCreateActionView(SHARE_BAR_HISTORY_SIZE,
|
||||
GeckoActionProvider.ActionViewType.DEFAULT);
|
||||
}
|
||||
|
||||
return mActionView;
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.mozilla.gecko.menu;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.mozilla.gecko.AppConstants.Versions;
|
||||
import org.mozilla.gecko.R;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
|
@ -156,9 +155,9 @@ public class MenuItemSwitcherLayout extends LinearLayout
|
|||
params.weight = 1.0f;
|
||||
button.setLayoutParams(params);
|
||||
|
||||
// Fill in the action-buttons to the left of the actual menu button.
|
||||
// Place action buttons to the right of the actual menu item
|
||||
mActionButtons.add(button);
|
||||
addView(button, count);
|
||||
addView(button, count + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||
* 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/. */
|
||||
|
||||
package org.mozilla.gecko.menu;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import org.mozilla.gecko.R;
|
||||
|
||||
/**
|
||||
* A MenuItemActionView without the default child views.
|
||||
*
|
||||
* A better implementation would have the non-child view implementation as the parent of
|
||||
* MenuItemActionView, but this is simpler and faster to implement for something intended to be
|
||||
* uplifted, and this implementation will soon be replaced with the old implementation for adding
|
||||
* the share plane to the menu (see https://bug1122302.bugzilla.mozilla.org/attachment.cgi?id=8572126).
|
||||
*/
|
||||
public class QuickShareBarActionView extends MenuItemSwitcherLayout {
|
||||
|
||||
public QuickShareBarActionView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, R.attr.menuItemSwitcherLayoutStyle);
|
||||
}
|
||||
|
||||
@TargetApi(14)
|
||||
public QuickShareBarActionView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
// We remove the views so they are visible, but note that
|
||||
// the child still does some computation on them.
|
||||
removeAllViews();
|
||||
}
|
||||
}
|
|
@ -16,7 +16,6 @@ import org.mozilla.gecko.R;
|
|||
import org.mozilla.gecko.SnackbarHelper;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
import org.mozilla.gecko.menu.QuickShareBarActionView;
|
||||
import org.mozilla.gecko.mozglue.ContextUtils;
|
||||
import org.mozilla.gecko.overlays.ui.ShareDialog;
|
||||
import org.mozilla.gecko.menu.MenuItemSwitcherLayout;
|
||||
|
@ -119,10 +118,6 @@ public class GeckoActionProvider {
|
|||
view = new MenuItemSwitcherLayout(mContext, null);
|
||||
break;
|
||||
|
||||
case QUICK_SHARE_ICON:
|
||||
view = new QuickShareBarActionView(mContext, null);
|
||||
break;
|
||||
|
||||
case CONTEXT_MENU:
|
||||
view = new MenuItemSwitcherLayout(mContext, null);
|
||||
view.initContextMenuStyles();
|
||||
|
@ -283,7 +278,6 @@ public class GeckoActionProvider {
|
|||
|
||||
public enum ActionViewType {
|
||||
DEFAULT,
|
||||
QUICK_SHARE_ICON,
|
||||
CONTEXT_MENU,
|
||||
}
|
||||
|
||||
|
|
|
@ -456,7 +456,6 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
|
|||
'menu/MenuItemSwitcherLayout.java',
|
||||
'menu/MenuPanel.java',
|
||||
'menu/MenuPopup.java',
|
||||
'menu/QuickShareBarActionView.java',
|
||||
'MotionEventInterceptor.java',
|
||||
'NotificationClient.java',
|
||||
'NotificationHandler.java',
|
||||
|
|
До Ширина: | Высота: | Размер: 888 B После Ширина: | Высота: | Размер: 1.4 KiB |
Двоичные данные
mobile/android/base/resources/drawable-hdpi-v11/star_blue.png
До Ширина: | Высота: | Размер: 754 B После Ширина: | Высота: | Размер: 779 B |
До Ширина: | Высота: | Размер: 1.2 KiB После Ширина: | Высота: | Размер: 1.9 KiB |
Двоичные данные
mobile/android/base/resources/drawable-xhdpi-v11/star_blue.png
До Ширина: | Высота: | Размер: 1000 B После Ширина: | Высота: | Размер: 1.0 KiB |
До Ширина: | Высота: | Размер: 1.7 KiB |
Двоичные данные
mobile/android/base/resources/drawable-xxhdpi-v11/star_blue.png
До Ширина: | Высота: | Размер: 1.4 KiB |
|
@ -34,15 +34,6 @@
|
|||
android:title="@string/share"
|
||||
android:showAsAction="ifRoom"/>
|
||||
|
||||
<!-- We only show the quick share items so no need for an icon or title.
|
||||
|
||||
The visibility is changed dynamically for v14+ - hide for previous versions. -->
|
||||
<item android:id="@+id/quickshare"
|
||||
android:visible="false"
|
||||
android:enabled="false"
|
||||
android:visibility="gone"
|
||||
android:showAsAction="collapseActionView"/>
|
||||
|
||||
<item android:id="@+id/new_tab"
|
||||
android:title="@string/new_tab"/>
|
||||
|
||||
|
|
|
@ -34,15 +34,6 @@
|
|||
android:title="@string/share"
|
||||
android:showAsAction="ifRoom"/>
|
||||
|
||||
<!-- We only show the quick share items so no need for an icon or title.
|
||||
|
||||
The visibility is changed dynamically for v14+ - hide for previous versions. -->
|
||||
<item android:id="@+id/quickshare"
|
||||
android:visible="false"
|
||||
android:enabled="false"
|
||||
android:visibility="gone"
|
||||
android:showAsAction="collapseActionView"/>
|
||||
|
||||
<item android:id="@+id/new_tab"
|
||||
android:title="@string/new_tab"/>
|
||||
|
||||
|
|
|
@ -19,30 +19,21 @@
|
|||
android:title="@string/forward"
|
||||
android:showAsAction="always"/>
|
||||
|
||||
<item android:id="@+id/bookmark"
|
||||
android:icon="@drawable/ic_menu_bookmark_add"
|
||||
android:title="@string/bookmark"
|
||||
android:showAsAction="always"/>
|
||||
|
||||
<item android:id="@+id/reload"
|
||||
android:icon="@drawable/ic_menu_reload"
|
||||
android:title="@string/reload"
|
||||
android:showAsAction="always"/>
|
||||
|
||||
<item android:id="@+id/bookmark"
|
||||
android:icon="@drawable/ic_menu_bookmark_add"
|
||||
android:title="@string/bookmark"
|
||||
android:showAsAction="ifRoom"/>
|
||||
|
||||
<item android:id="@+id/share"
|
||||
android:icon="@drawable/ic_menu_share"
|
||||
android:title="@string/share"
|
||||
android:showAsAction="ifRoom"/>
|
||||
|
||||
<!-- We only show the quick share items so no need for an icon or title.
|
||||
|
||||
The visibility is changed dynamically for v14+ - hide for previous versions. -->
|
||||
<item android:id="@+id/quickshare"
|
||||
android:visible="false"
|
||||
android:enabled="false"
|
||||
android:visibility="gone"
|
||||
android:showAsAction="collapseActionView"/>
|
||||
|
||||
<item android:id="@+id/new_tab"
|
||||
android:title="@string/new_tab"/>
|
||||
|
||||
|
|