List of usage examples for android.content SharedPreferences getBoolean
boolean getBoolean(String key, boolean defValue);
From source file:eu.faircode.adblocker.IAB.java
public static boolean isPurchased(String sku, Context context) { if (Util.isDebuggable(context) || Util.getSelfVersionName(context).contains("beta")) return true; SharedPreferences prefs = context.getSharedPreferences("IAB", Context.MODE_PRIVATE); return (prefs.getBoolean(sku, false) || prefs.getBoolean(ActivityPro.SKU_PRO1, false) || prefs.getBoolean(ActivityPro.SKU_DONATION, false)); }
From source file:com.sublimis.urgentcallfilter.MyPreference.java
private static boolean getBooleanPref(int prefKeyResId, boolean defaultValue) { String prefKey = getStringResource(prefKeyResId); SharedPreferences sharedPrefs = getPrefs(); if (sharedPrefs != null) return sharedPrefs.getBoolean(prefKey, defaultValue); else/* w w w . j a v a 2 s .c o m*/ return defaultValue; }
From source file:com.keylesspalace.tusky.util.NotificationMaker.java
private static void setupPreferences(SharedPreferences preferences, NotificationCompat.Builder builder) { if (preferences.getBoolean("notificationAlertSound", true)) { builder.setSound(Settings.System.DEFAULT_NOTIFICATION_URI); }//from www . j a va 2 s.com if (preferences.getBoolean("notificationAlertVibrate", false)) { builder.setVibrate(new long[] { 500, 500 }); } if (preferences.getBoolean("notificationAlertLight", false)) { builder.setLights(0xFF00FF8F, 300, 1000); } }
From source file:de.itomig.itoplib.ItopConfig.java
public static boolean isEnabledlITILTicket() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(itopAppContext); boolean itil = prefs.getBoolean(KEY_ITIL_TICKETS, true); return itil;/* www .j a v a 2 s . c o m*/ }
From source file:de.itomig.itoplib.ItopConfig.java
public static boolean isEnabledlTasks() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(itopAppContext); boolean itil = prefs.getBoolean(KEY_TASKS, true); return itil;//from w ww . j ava2 s.c o m }
From source file:Main.java
public static void showPercentToast(boolean show, Activity a, SharedPreferences prefs, double brightness) { if (percentToast == null) { percentToast = Toast.makeText(a, "", Toast.LENGTH_SHORT); }/*from w ww . j ava2s . c om*/ percentToast.setText(new Integer((int) (brightness / 2.55)).toString() + "%"); if (show) { if (prefs.getBoolean("showToast", true)) percentToast.show(); } else { percentToast.cancel(); } }
From source file:com.apptentive.android.sdk.module.engagement.interaction.InteractionManager.java
public static boolean isPollForInteractions(Context context) { if (pollForInteractions == null) { SharedPreferences prefs = context.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE); pollForInteractions = prefs.getBoolean(Constants.PREF_KEY_POLL_FOR_INTERACTIONS, true); }// w w w .j av a 2 s . com return pollForInteractions; }
From source file:org.fdroid.enigtext.mms.MmsCommunication.java
protected static MmsConnectionParameters getLocalMmsConnectionParameters(Context context) throws ApnUnavailableException { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); if (preferences.getBoolean(ApplicationPreferencesActivity.ENABLE_MANUAL_MMS_PREF, false)) { return getLocallyConfiguredMmsConnectionParameters(context); } else {//from ww w.j a v a2 s . co m MmsConnectionParameters params = ApnDefaults.getMmsConnectionParameters(context); if (params == null) { throw new ApnUnavailableException("No parameters available from ApnDefaults."); } return params; } }
From source file:com.fusionx.lightirc.util.SharedPreferencesUtils.java
public static void onInitialSetup(final Context context) { final SharedPreferences globalSettings = context.getSharedPreferences("main", MODE_PRIVATE); final boolean firstRun = globalSettings.getBoolean("firstrun", true); final boolean firstDbRun = globalSettings.getBoolean("firstDbRun", true); if (firstRun) { firstTimeServerSetup(context);//from ww w. ja v a 2 s. c o m globalSettings.edit().putBoolean("firstrun", false).commit(); globalSettings.edit().putBoolean("firstDbRun", false).commit(); } else if (firstDbRun) { final List<File> fileList = SharedPreferencesUtils.getOldServers(context); migrateToDatabase(fileList, context); firstDbSetup(context); globalSettings.edit().putBoolean("firstDbRun", false).commit(); } }
From source file:eu.faircode.netguard.IAB.java
public static boolean isPurchased(String sku, Context context) { if (Util.isDebuggable(context)) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); return !prefs.getBoolean("debug_iab", false); }//from www . j a v a 2 s. c om SharedPreferences prefs = context.getSharedPreferences("IAB", Context.MODE_PRIVATE); if (ActivityPro.SKU_SUPPORT1.equals(sku) || ActivityPro.SKU_SUPPORT2.equals(sku)) return prefs.getBoolean(sku, false); return (prefs.getBoolean(sku, false) || prefs.getBoolean(ActivityPro.SKU_PRO1, false) || prefs.getBoolean(ActivityPro.SKU_DONATION, false)); }