List of usage examples for android.content SharedPreferences getBoolean
boolean getBoolean(String key, boolean defValue);
From source file:ee.ioc.phon.android.speak.Utils.java
public static boolean getPrefBoolean(SharedPreferences prefs, Resources res, int key, int defaultValue) { return prefs.getBoolean(res.getString(key), res.getBoolean(defaultValue)); }
From source file:com.jaguarlandrover.auto.remote.vehicleentry.RviService.java
static void sendNotification(Context ctx, String action, String... extras) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx); NotificationManager nm = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE); boolean fire = prefs.getBoolean("pref_fire_notifications", true); if (!fire)/*from w w w . j a va 2 s. c om*/ return; NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx).setSmallIcon(R.drawable.rvi_not) .setAutoCancel(true).setContentTitle(ctx.getResources().getString(R.string.app_name)) .setContentText(action); Intent targetIntent = new Intent(ctx, LockActivity.class); int j = 0; for (String ex : extras) { targetIntent.putExtra("_extra" + (++j), ex); targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP); } PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(contentIntent); nm.notify(0, builder.build()); }
From source file:de.schaeuffelhut.android.openvpn.Preferences.java
public final static boolean getUseInternalStorage(SharedPreferences sharedPreferences) { return sharedPreferences.getBoolean(KEY_OPENVPN_USE_INTERNAL_STORAGE, false); }
From source file:com.ichi2.anki.AnkiDroidApp.java
public static boolean initiateGestures(SharedPreferences preferences) { Boolean enabled = preferences.getBoolean("gestures", false); if (enabled) { int sensitivity = preferences.getInt("swipeSensitivity", 100); if (sensitivity != 100) { float sens = 100.0f / sensitivity; sSwipeMinDistance = (int) (DEFAULT_SWIPE_MIN_DISTANCE * sens + 0.5f); sSwipeThresholdVelocity = (int) (DEFAULT_SWIPE_THRESHOLD_VELOCITY * sens + 0.5f); } else {//from www . j a v a2s .c o m sSwipeMinDistance = DEFAULT_SWIPE_MIN_DISTANCE; sSwipeThresholdVelocity = DEFAULT_SWIPE_THRESHOLD_VELOCITY; } } return enabled; }
From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java
public static boolean getTipsShown(Activity context) { SharedPreferences settingsToGet = context.getSharedPreferences(BRConstants.PREFS_NAME, 0); return settingsToGet.getBoolean(BRConstants.TIPS_SHOWN, false); }
From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java
public static boolean getPhraseWroteDown(Activity context) { SharedPreferences prefs = context.getSharedPreferences(BRConstants.PREFS_NAME, Context.MODE_PRIVATE); return prefs.getBoolean(BRConstants.PHRASE_WRITTEN, false); }
From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java
public static boolean getAllowSpend(Activity activity) { SharedPreferences prefs = activity.getSharedPreferences(BRConstants.PREFS_NAME, Context.MODE_PRIVATE); return prefs.getBoolean(BRConstants.ALLOW_SPEND, true); }
From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java
public static boolean getFeatureEnabled(Activity activity, String feature) { SharedPreferences prefs = activity.getSharedPreferences(BRConstants.PREFS_NAME, Context.MODE_PRIVATE); return prefs.getBoolean(feature, false); }
From source file:com.breadwallet.tools.manager.SharedPreferencesManager.java
public static boolean getGeoPermissionsRequested(Activity activity) { SharedPreferences prefs = activity.getSharedPreferences(BRConstants.PREFS_NAME, Context.MODE_PRIVATE); return prefs.getBoolean(GEO_PERMISSIONS_REQUESTED, false); }
From source file:com.google.android.gcm.GCMRegistrar.java
/** * Checks whether the device was successfully registered in the server side. *//*from w w w. j a v a 2 s . co m*/ public static boolean isRegisteredOnServer(Context context) { final SharedPreferences prefs = getGCMPreferences(context); boolean isRegistered = prefs.getBoolean(PROPERTY_ON_SERVER, false); Log.v(TAG, "Is registered on server: " + isRegistered); return isRegistered; }