Bug 1231792 - Add Bookmarks and History 3-dot menu items. r=liuche

This change also depends on changes to the switchboard server config.
This commit is contained in:
Margaret Leibovic 2015-12-10 15:23:12 -05:00
parent d25d08eb8b
commit e51314d4c2
9 changed files with 66 additions and 7 deletions

View File

@ -1,5 +1,4 @@
#Mon Nov 02 13:44:39 GMT 2015
distributionBase=GRADLE_USER_HOME
#Mon Nov 02 13:44:39 GMT 2015distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -23,15 +23,12 @@ import org.mozilla.gecko.db.SuggestedSites;
import org.mozilla.gecko.distribution.Distribution;
import org.mozilla.gecko.dlc.DownloadContentService;
import org.mozilla.gecko.favicons.Favicons;
import org.mozilla.gecko.favicons.LoadFaviconTask;
import org.mozilla.gecko.favicons.OnFaviconLoadedListener;
import org.mozilla.gecko.favicons.decoders.IconDirectoryEntry;
import org.mozilla.gecko.firstrun.FirstrunAnimationContainer;
import org.mozilla.gecko.gfx.DynamicToolbarAnimator;
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import org.mozilla.gecko.gfx.LayerView;
import org.mozilla.gecko.health.HealthRecorder;
import org.mozilla.gecko.health.SessionInformation;
import org.mozilla.gecko.home.BrowserSearch;
import org.mozilla.gecko.home.HomeBanner;
import org.mozilla.gecko.home.HomeConfig.PanelType;
@ -68,6 +65,7 @@ import org.mozilla.gecko.trackingprotection.TrackingProtectionPrompt;
import org.mozilla.gecko.util.ActivityUtils;
import org.mozilla.gecko.util.Clipboard;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.Experiments;
import org.mozilla.gecko.util.FloatUtils;
import org.mozilla.gecko.util.GamepadUtils;
import org.mozilla.gecko.util.GeckoEventListener;
@ -89,7 +87,6 @@ import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@ -109,7 +106,6 @@ import android.nfc.NfcEvent;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.provider.MediaStore;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
@ -3049,6 +3045,8 @@ public class BrowserApp extends GeckoApp
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);
final MenuItem print = aMenu.findItem(R.id.print);
final MenuItem charEncoding = aMenu.findItem(R.id.char_encoding);
@ -3258,6 +3256,11 @@ public class BrowserApp extends GeckoApp
MenuUtils.safeSetVisible(aMenu, R.id.addons, false);
}
if (!SwitchBoard.isInExperiment(this, Experiments.BOOKMARKS_HISTORY_MENU)) {
bookmarksList.setVisible(false);
historyList.setVisible(false);
}
return true;
}
@ -3386,6 +3389,20 @@ public class BrowserApp extends GeckoApp
return true;
}
if (itemId == R.id.bookmarks_list) {
final String url = AboutPages.getURLForBuiltinPanelType(PanelType.BOOKMARKS);
Tabs.getInstance().loadUrl(url);
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, Experiments.BOOKMARKS_HISTORY_MENU);
return true;
}
if (itemId == R.id.history_list) {
final String url = AboutPages.getURLForBuiltinPanelType(PanelType.HISTORY);
Tabs.getInstance().loadUrl(url);
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, Experiments.BOOKMARKS_HISTORY_MENU);
return true;
}
if (itemId == R.id.save_as_pdf) {
Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.MENU, "pdf");
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SaveAs:PDF", null));

View File

@ -17,6 +17,7 @@ import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.ViewHelper;
import org.mozilla.gecko.home.HomeAdapter.OnAddPanelListener;
import org.mozilla.gecko.home.HomeConfig.PanelConfig;
import org.mozilla.gecko.util.Experiments;
import org.mozilla.gecko.util.ThreadUtils;
import android.content.Context;
@ -287,6 +288,9 @@ public class HomePager extends ViewPager {
* * HomePager has not loaded yet
* * Panel with the given panelId cannot be found
*
* If you're trying to open a built-in panel, consider loading the panel url directly with
* {@link org.mozilla.gecko.AboutPages#getURLForBuiltinPanelType(HomeConfig.PanelType)}.
*
* @param panelId of the home panel to be shown.
*/
public void showPanel(String panelId) {
@ -525,6 +529,7 @@ public class HomePager extends ViewPager {
Telemetry.stopUISession(mCurrentPanelSession, mCurrentPanelSessionSuffix);
mCurrentPanelSession = null;
mCurrentPanelSessionSuffix = null;
Telemetry.stopUISession(TelemetryContract.Session.EXPERIMENT, Experiments.BOOKMARKS_HISTORY_MENU);
}
}
}

View File

@ -0,0 +1,13 @@
/* 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.util;
/**
* This class should reflect the experiment names found in the Switchboard experiments config here:
* https://github.com/mozilla-services/switchboard-experiments
*/
public class Experiments {
public static final String BOOKMARKS_HISTORY_MENU = "bookmark-history-menu";
}

View File

@ -97,6 +97,7 @@ gujar.sources += ['java/org/mozilla/gecko/' + x for x in [
'util/ColorUtils.java',
'util/DrawableUtil.java',
'util/EventCallback.java',
'util/Experiments.java',
'util/FileUtils.java',
'util/FloatUtils.java',
'util/GamepadUtils.java',

View File

@ -54,6 +54,12 @@
<item android:id="@+id/new_private_tab"
android:title="@string/new_private_tab"/>
<item android:id="@+id/bookmarks_list"
android:title="@string/bookmarks_title"/>
<item android:id="@+id/history_list"
android:title="@string/history_title"/>
<item android:id="@+id/find_in_page"
android:title="@string/find_in_page" />

View File

@ -54,6 +54,12 @@
<item android:id="@+id/new_private_tab"
android:title="@string/new_private_tab"/>
<item android:id="@+id/bookmarks_list"
android:title="@string/bookmarks_title"/>
<item android:id="@+id/history_list"
android:title="@string/history_title"/>
<item android:id="@+id/find_in_page"
android:title="@string/find_in_page" />

View File

@ -54,6 +54,12 @@
<item android:id="@+id/new_private_tab"
android:title="@string/new_private_tab"/>
<item android:id="@+id/bookmarks_list"
android:title="@string/bookmarks_title"/>
<item android:id="@+id/history_list"
android:title="@string/history_title"/>
<item android:id="@+id/find_in_page"
android:title="@string/find_in_page" />

View File

@ -39,6 +39,12 @@
android:title="@string/desktop_mode"
android:checkable="true" />
<item android:id="@+id/bookmarks_list"
android:title="@string/bookmarks_title"/>
<item android:id="@+id/history_list"
android:title="@string/history_title"/>
<item android:id="@+id/page"
android:title="@string/page">