private SharedPreferences getPrefs() { return PreferenceManager.getDefaultSharedPreferences(this /* context */); }
public static void initSettings(Context context) { PreferenceManager.setDefaultValues(context, R.xml.appearance_settings, true); PreferenceManager.setDefaultValues(context, R.xml.content_settings, true); PreferenceManager.setDefaultValues(context, R.xml.download_settings, true); PreferenceManager.setDefaultValues(context, R.xml.history_settings, true); PreferenceManager.setDefaultValues(context, R.xml.main_settings, true); PreferenceManager.setDefaultValues(context, R.xml.video_audio_settings, true); PreferenceManager.setDefaultValues(context, R.xml.debug_settings, true); getVideoDownloadFolder(context); getAudioDownloadFolder(context); }
private SharedPreferences getPrefs() { if (prefs==null) { prefs=PreferenceManager.getDefaultSharedPreferences(this); } return(prefs); } }
public PreferencesUtility(final Context context) { this.context = context; mPreferences = PreferenceManager.getDefaultSharedPreferences(context); }
public PreferencesUtility(final Context context) { mPreferences = PreferenceManager.getDefaultSharedPreferences(context); }
private TabsManager(Context context) { this.context = context; this.sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); this.savedTabsKey = context.getString(R.string.saved_tabs_key); }
public static String getATEKey(Context context) { return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("dark_theme", false) ? "dark_theme" : "light_theme"; }
public static String getAudioDownloadPath(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); final String key = context.getString(R.string.download_path_audio_key); return prefs.getString(key, Environment.DIRECTORY_MUSIC); }
public ImageDownloader(Context context) { super(context); this.resources = context.getResources(); this.preferences = PreferenceManager.getDefaultSharedPreferences(context); this.downloadThumbnailKey = context.getString(R.string.download_thumbnail_key); }
public static String getVideoDownloadPath(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); final String key = context.getString(R.string.download_path_key); return prefs.getString(key, Environment.DIRECTORY_MOVIES); }
@NonNull private static SharedPreferences getPreferences(@NonNull final Context context) { return PreferenceManager.getDefaultSharedPreferences(context); }
public static boolean getBoolean(Context context, String key, boolean defaultValue) { try { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getBoolean(key, defaultValue); } catch (Exception e) { e.printStackTrace(); return defaultValue; } }
private static String getSelectedThemeString(Context context) { String themeKey = context.getString(R.string.theme_key); String defaultTheme = context.getResources().getString(R.string.default_theme_value); return PreferenceManager.getDefaultSharedPreferences(context).getString(themeKey, defaultTheme); }
public static int getInt(Context context, String key, int defaultValue) { try { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getInt(key, defaultValue); } catch (Exception e) { e.printStackTrace(); return defaultValue; } }
public static long getLong(Context context, String key, long defaultValue) { try { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getLong(key, defaultValue); } catch (Exception e) { e.printStackTrace(); return defaultValue; } }
public static String getString(Context context, String key, String defaultValue) { try { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getString(key, defaultValue); } catch (Exception e) { e.printStackTrace(); return defaultValue; } }
boolean toggleShowExtraKeys(Context context) { mShowExtraKeys = !mShowExtraKeys; PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(SHOW_EXTRA_KEYS_KEY, mShowExtraKeys).apply(); return mShowExtraKeys; }
public static void reset(final Context context) { SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(context).edit(); edit.clear(); edit.apply(); }
private static void setSelectedServicePreferences(Context context, String serviceName) { PreferenceManager.getDefaultSharedPreferences(context).edit(). putString(context.getString(R.string.current_service_key), serviceName).apply(); }
public static int getFrame(Context context) { switch (PreferenceManager.getDefaultSharedPreferences(context).getInt(context .getResources().getString(R.string.frame_title), 0)) { case 0: return Style.FRAME_STANDARD; case 1: return Style.FRAME_KITKAT; case 2: return Style.FRAME_LOLLIPOP; default: return Style.FRAME_STANDARD; } }