| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.blimp.core.settings; | 5 package org.chromium.blimp.core.settings; |
| 6 | 6 |
| 7 import org.chromium.base.ContextUtils; | 7 import org.chromium.base.ContextUtils; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Blimp preferences utilities. | 10 * Blimp preferences utilities. |
| 11 */ | 11 */ |
| 12 public class PreferencesUtil { | 12 public class PreferencesUtil { |
| 13 private static final String DEFAULT_ASSIGNER_URL = | 13 /** |
| 14 * Blimp switch preference key, also the key for this PreferenceFragment. |
| 15 */ |
| 16 public static final String PREF_BLIMP_SWITCH = "blimp_switch"; |
| 17 /** |
| 18 * Blimp assigner URL preference key. |
| 19 */ |
| 20 public static final String PREF_ASSIGNER_URL = "blimp_assigner_url"; |
| 21 |
| 22 /** |
| 23 * Default assigner URL. |
| 24 */ |
| 25 public static final String DEFAULT_ASSIGNER_URL = |
| 14 "https://dev-blimp-pa.sandbox.googleapis.com/v1/assignment"; | 26 "https://dev-blimp-pa.sandbox.googleapis.com/v1/assignment"; |
| 15 | 27 |
| 16 /** | 28 /** |
| 17 * Reads the last used assigner from shared preference. | 29 * Reads the last used assigner from shared preference. |
| 18 * @return The saved value of assigner preference, or the default developmen
t assigner URL | 30 * @return The saved value of assigner preference, or the default developmen
t assigner URL |
| 19 * if we didn't find the shared preference. | 31 * if we didn't find the shared preference. |
| 20 */ | 32 */ |
| 21 public static String getLastUsedAssigner() { | 33 public static String getLastUsedAssigner() { |
| 22 return ContextUtils.getAppSharedPreferences().getString( | 34 return ContextUtils.getAppSharedPreferences().getString( |
| 23 AboutBlimpPreferences.PREF_ASSIGNER_URL, DEFAULT_ASSIGNER_URL); | 35 PREF_ASSIGNER_URL, DEFAULT_ASSIGNER_URL); |
| 36 } |
| 37 |
| 38 /** |
| 39 * @return If Blimp switch preference in the setting page is turned on. |
| 40 */ |
| 41 public static boolean isBlimpEnabled() { |
| 42 return ContextUtils.getAppSharedPreferences().getBoolean(PREF_BLIMP_SWIT
CH, false); |
| 24 } | 43 } |
| 25 } | 44 } |
| OLD | NEW |