Bug 1381359 - Hide AS Pin Site item from classic Top Sites context menu r=sebastian
Our home panel context menu is shared by classic top sites, history and bookmark panels.
For acitivty stream, we've added a new context menu, and a new type of pins. However,
old context menu is still used for history and bookmarks. New style of pins allows for
items to be pinned from those panels to activity stream. This requires having both "classic"
pin buttons for old Top Sites panel, as well as the new AS Pin button.
However, initial implementation forgot to disable the new AS Pin button for the classic
Top Sites panel context menu. This caused two "pin site" menu items to appear, and the
AS one would crash the browser if it's interacted with.
We'll be unifying context menus at some point, and removing the old Top Sites code,
and so this simple patch should be sufficient.
MozReview-Commit-ID: 3cxVTv6QP8L
--- a/mobile/android/base/java/org/mozilla/gecko/home/TopSitesPanel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/TopSitesPanel.java
@@ -357,16 +357,19 @@ public class TopSitesPanel extends HomeF
menu.findItem(R.id.home_share).setVisible(false);
}
if (!Restrictions.isAllowed(context, Restrictable.PRIVATE_BROWSING)) {
menu.findItem(R.id.home_open_private_tab).setVisible(false);
}
final boolean distSetAsHomepage = GeckoSharedPrefs.forProfile(view.getContext()).getBoolean(GeckoPreferences.PREFS_SET_AS_HOMEPAGE, false);
menu.findItem(R.id.home_set_as_homepage).setVisible(distSetAsHomepage);
+
+ // Hide the AS-specific "pin" item. It doesn't work on classic Top Sites. Bug 1381359.
+ menu.findItem(R.id.home_as_pin).setVisible(false);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
if (super.onContextItemSelected(item)) {
// HomeFragment was able to handle to selected item.
return true;
}