Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/NetworkPredictionPreference.java

Issue 1712943002: [Android] Simplify "network predictions" preference to a boolean value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added bug link; rebased Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.preferences.privacy;
6
7 import android.content.Context;
8 import android.preference.Preference;
9 import android.preference.Preference.OnPreferenceChangeListener;
10 import android.util.AttributeSet;
11
12 import org.chromium.chrome.R;
13 import org.chromium.chrome.browser.preferences.ChromeBaseListPreference;
14 import org.chromium.chrome.browser.preferences.NetworkPredictionOptions;
15 import org.chromium.chrome.browser.preferences.PrefServiceBridge;
16
17 /**
18 * Fragment to set and retrieve the prerender preference.
19 */
20 public class NetworkPredictionPreference extends ChromeBaseListPreference
21 implements OnPreferenceChangeListener {
22
23 private final Context mContext;
24
25 public NetworkPredictionPreference(Context context, AttributeSet attrs) {
26 super(context, attrs);
27 mContext = context;
28 String[] networkPredictionPrefs = context.getResources().getStringArray(
29 R.array.bandwidth_entries);
30 assert networkPredictionPrefs.length == NetworkPredictionOptions.choiceC ount();
31 setOnPreferenceChangeListener(this);
32 setSummary(context.getString(
33 PrefServiceBridge.getInstance().getNetworkPredictionOptions().ge tDisplayTitle()));
34 }
35
36 @Override
37 public boolean onPreferenceChange(Preference preference, Object newValue) {
38 setSummary(mContext.getString(
39 NetworkPredictionOptions.stringToEnum((String) newValue).getDisp layTitle()));
40 return true;
41 }
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698