зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1290012 - Introduce setting to enable experimental activity stream feature. r=ahunt
If the app is build with MOZ_ANDROID_ACTIVITY_STREAM enabled then a preference for activity stream will appear in the 'advanced' section. All upcoming activity stream features should check ActivityStream.isEnabled() at runtime. MozReview-Commit-ID: Hibh1j0lqFo --HG-- extra : rebase_source : c70ca471361050e0ca613e12ee250bf0cb0cf1a8
This commit is contained in:
Родитель
72456298c6
Коммит
cc62ca1699
|
@ -12,6 +12,7 @@ import android.support.annotation.CheckResult;
|
|||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.mozilla.gecko.activitystream.ActivityStream;
|
||||
import org.mozilla.gecko.adjust.AdjustHelperInterface;
|
||||
import org.mozilla.gecko.annotation.RobocopTarget;
|
||||
import org.mozilla.gecko.AppConstants.Versions;
|
||||
|
@ -2691,7 +2692,7 @@ public class BrowserApp extends GeckoApp
|
|||
}
|
||||
|
||||
if (mHomeScreen == null) {
|
||||
if (AppConstants.MOZ_ANDROID_ACTIVITY_STREAM) {
|
||||
if (ActivityStream.isEnabled(this)) {
|
||||
final ViewStub asStub = (ViewStub) findViewById(R.id.activity_stream_stub);
|
||||
mHomeScreen = (HomeScreen) asStub.inflate();
|
||||
} else {
|
||||
|
|
|
@ -892,7 +892,7 @@ public class GeckoAppShell
|
|||
}
|
||||
|
||||
@WrapForJNI
|
||||
static void scheduleRestart() {
|
||||
public static void scheduleRestart() {
|
||||
getGeckoInterface().doRestart();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; 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.activitystream;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.mozilla.gecko.AppConstants;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
||||
|
||||
public class ActivityStream {
|
||||
public static boolean isEnabled(Context context) {
|
||||
if (!AppConstants.MOZ_ANDROID_ACTIVITY_STREAM) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return GeckoSharedPrefs.forApp(context)
|
||||
.getBoolean(GeckoPreferences.PREFS_ACTIVITY_STREAM, false);
|
||||
}
|
||||
}
|
|
@ -166,6 +166,8 @@ OnSharedPreferenceChangeListener
|
|||
public static final String PREFS_READ_PARTNER_CUSTOMIZATIONS_PROVIDER = NON_PREF_PREFIX + "distribution.read_partner_customizations_provider";
|
||||
public static final String PREFS_READ_PARTNER_BOOKMARKS_PROVIDER = NON_PREF_PREFIX + "distribution.read_partner_bookmarks_provider";
|
||||
public static final String PREFS_CUSTOM_TABS = NON_PREF_PREFIX + "customtabs";
|
||||
public static final String PREFS_ACTIVITY_STREAM = NON_PREF_PREFIX + "activitystream";
|
||||
public static final String PREFS_CATEGORY_EXPERIMENTAL_FEATURES = NON_PREF_PREFIX + "category_experimental";
|
||||
|
||||
private static final String ACTION_STUMBLER_UPLOAD_PREF = "STUMBLER_PREF";
|
||||
|
||||
|
@ -695,6 +697,12 @@ OnSharedPreferenceChangeListener
|
|||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
} else if (PREFS_CATEGORY_EXPERIMENTAL_FEATURES.equals(key)
|
||||
&& !AppConstants.MOZ_ANDROID_ACTIVITY_STREAM
|
||||
&& !AppConstants.MOZ_ANDROID_CUSTOM_TABS) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
setupPreferences((PreferenceGroup) pref, prefs);
|
||||
} else {
|
||||
|
@ -891,6 +899,10 @@ OnSharedPreferenceChangeListener
|
|||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
} else if (PREFS_ACTIVITY_STREAM.equals(key) && !AppConstants.MOZ_ANDROID_ACTIVITY_STREAM) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Some Preference UI elements are not actually preferences,
|
||||
|
@ -1201,6 +1213,13 @@ OnSharedPreferenceChangeListener
|
|||
}
|
||||
} else if (PREFS_NOTIFICATIONS_CONTENT.equals(prefName)) {
|
||||
FeedService.setup(this);
|
||||
} else if (PREFS_ACTIVITY_STREAM.equals(prefName)) {
|
||||
ThreadUtils.postDelayedToUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GeckoAppShell.scheduleRestart();
|
||||
}
|
||||
}, 1000);
|
||||
} else if (HANDLERS.containsKey(prefName)) {
|
||||
PrefHandler handler = HANDLERS.get(prefName);
|
||||
handler.onChange(this, preference, newValue);
|
||||
|
|
|
@ -272,12 +272,20 @@
|
|||
<!ENTITY pref_whats_new_notification "What\'s new in &brandShortName;">
|
||||
<!ENTITY pref_whats_new_notification_summary "Learn about new features after an update">
|
||||
|
||||
<!-- Localization note (pref_category_experimental): Title of a sub category in the 'advanced' category
|
||||
for experimental features. -->
|
||||
<!ENTITY pref_category_experimental "Experimental features">
|
||||
|
||||
<!-- Custom Tabs is an Android API for allowing third-party apps to open URLs in a customized UI.
|
||||
Instead of switching to the browser it appears as if the user stays in the third-party app.
|
||||
For more see: https://developer.chrome.com/multidevice/android/customtabs -->
|
||||
<!ENTITY pref_custom_tabs "Custom Tabs">
|
||||
<!ENTITY pref_custom_tabs_summary "Allow third-party apps to open URLs with a customized look and feel.">
|
||||
|
||||
<!-- Localization note (pref_activity_stream): Experimental feature, see https://testpilot.firefox.com/experiments/activity-stream -->
|
||||
<!ENTITY pref_activity_stream "Activity Stream">
|
||||
<!ENTITY pref_activity_stream_summary "A rich visual history feed and a reimagined home page make it easier than ever to find exactly what you\'re looking for in &brandShortName;.">
|
||||
|
||||
<!ENTITY tracking_protection_prompt_title "Now with Tracking Protection">
|
||||
<!ENTITY tracking_protection_prompt_text "Actively block tracking elements so you don\'t have to worry.">
|
||||
<!ENTITY tracking_protection_prompt_tip_text "Visit Privacy settings to learn more">
|
||||
|
|
|
@ -205,6 +205,7 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
|
|||
'ActionModeCompat.java',
|
||||
'ActionModeCompatView.java',
|
||||
'ActivityHandlerHelper.java',
|
||||
'activitystream/ActivityStream.java',
|
||||
'AlarmReceiver.java',
|
||||
'AndroidGamepadManager.java',
|
||||
'animation/AnimationUtils.java',
|
||||
|
|
|
@ -38,11 +38,6 @@
|
|||
android:entryValues="@array/pref_char_encoding_values"
|
||||
android:persistent="false" />
|
||||
|
||||
<SwitchPreference android:key="android.not_a_preference.customtabs"
|
||||
android:title="@string/pref_custom_tabs"
|
||||
android:summary="@string/pref_custom_tabs_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<PreferenceCategory android:title="@string/pref_category_data_saver">
|
||||
|
||||
<ListPreference android:key="browser.image_blocking"
|
||||
|
@ -85,4 +80,21 @@
|
|||
url="https://developer.mozilla.org/docs/Tools/Remote_Debugging/Debugging_Firefox_for_Android_with_WebIDE" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="android.not_a_preference.category_experimental"
|
||||
android:title="@string/pref_category_experimental">
|
||||
|
||||
<SwitchPreference android:key="android.not_a_preference.activitystream"
|
||||
android:title="@string/pref_activity_stream"
|
||||
android:summary="@string/pref_activity_stream_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
|
||||
<SwitchPreference android:key="android.not_a_preference.customtabs"
|
||||
android:title="@string/pref_custom_tabs"
|
||||
android:summary="@string/pref_custom_tabs_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -234,9 +234,14 @@
|
|||
<string name="pref_whats_new_notification">&pref_whats_new_notification;</string>
|
||||
<string name="pref_whats_new_notification_summary">&pref_whats_new_notification_summary;</string>
|
||||
|
||||
<string name="pref_category_experimental">&pref_category_experimental;</string>
|
||||
|
||||
<string name="pref_custom_tabs">&pref_custom_tabs;</string>
|
||||
<string name="pref_custom_tabs_summary">&pref_custom_tabs_summary;</string>
|
||||
|
||||
<string name="pref_activity_stream">&pref_activity_stream;</string>
|
||||
<string name="pref_activity_stream_summary">&pref_activity_stream_summary;</string>
|
||||
|
||||
<string name="pref_char_encoding">&pref_char_encoding;</string>
|
||||
<string name="pref_char_encoding_on">&pref_char_encoding_on;</string>
|
||||
<string name="pref_char_encoding_off">&pref_char_encoding_off;</string>
|
||||
|
|
Загрузка…
Ссылка в новой задаче