зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1231792 - Add Bookmarks and History 3-dot menu items. r=liuche
This change also depends on changes to the switchboard server config. --HG-- extra : commitid : AyJipuXpbcS extra : rebase_source : 89540f342d777cefaab454d1141ce48837b61839
This commit is contained in:
Родитель
5625eaf729
Коммит
a3901148db
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
|
@ -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',
|
||||
|
|
|
@ -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" />
|
||||
|
||||
|
|
|
@ -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" />
|
||||
|
||||
|
|
|
@ -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" />
|
||||
|
||||
|
|
|
@ -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">
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче