List of usage examples for android.content SharedPreferences getBoolean
boolean getBoolean(String key, boolean defValue);
From source file:com.thejoshwa.ultrasonic.androidapp.util.Util.java
public static boolean getShouldTransitionOnPlaybackPreference(Context context) { SharedPreferences prefs = getPreferences(context); return prefs.getBoolean(Constants.PREFERENCES_KEY_DOWNLOAD_TRANSITION, true); }
From source file:com.thejoshwa.ultrasonic.androidapp.util.Util.java
public static boolean getShouldUseId3Tags(Context context) { SharedPreferences prefs = getPreferences(context); return prefs.getBoolean(Constants.PREFERENCES_KEY_ID3_TAGS, false); }
From source file:com.thejoshwa.ultrasonic.androidapp.util.Util.java
public static boolean getShouldClearPlaylist(Context context) { SharedPreferences prefs = getPreferences(context); return prefs.getBoolean(Constants.PREFERENCES_KEY_CLEAR_PLAYLIST, false); }
From source file:com.thejoshwa.ultrasonic.androidapp.util.Util.java
public static boolean getShouldSortByDisc(Context context) { SharedPreferences prefs = getPreferences(context); return prefs.getBoolean(Constants.PREFERENCES_KEY_DISC_SORT, false); }
From source file:com.thejoshwa.ultrasonic.androidapp.util.Util.java
public static boolean getShouldClearBookmark(Context context) { SharedPreferences prefs = getPreferences(context); return prefs.getBoolean(Constants.PREFERENCES_KEY_CLEAR_BOOKMARK, false); }
From source file:fr.digitbooks.android.examples.chapitre08.RateDigitbooksActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Changer le texte pour voter pour le livre digitbooks ((TextView) findViewById(R.id.notice)).setText(R.string.leave_your_digitbooks_comment); // On vrifie que l'on peut voter plusieurs fois mRateOnce = getIntent().getBooleanExtra(RATE_ONCE, false); if (mRateOnce) { boolean restoreBackup = false; // Mode prfrence local l'activit SharedPreferences localPreferences = getPreferences(Context.MODE_PRIVATE); boolean rateSent = localPreferences.getBoolean(PREFERENCE_RATE_SENT, false); if (rateSent) { String comment = localPreferences.getString(PREFERENCE_COMMENT, ""); float rating = localPreferences.getFloat(PREFERENCE_RATING, 0.0f); mRatingBar.setRating(rating); mEditText.setText(comment);//from w ww . j a va 2 s . c o m restoreBackup = true; } // Ce mode crase le prcdent // Mode data backup; les prfrences sont accessible toute l'application // pour ?tre vue par le backup agent if (Config.USE_APPLICATIONS_PREFERENCES) { SharedPreferences preferences = getSharedPreferences(Config.PREFERENCES, Context.MODE_PRIVATE); rateSent = preferences.getBoolean(Config.PREFERENCE_RATE_SENT, false); if (rateSent) { String comment = preferences.getString(Config.PREFERENCE_COMMENT, ""); float rating = preferences.getFloat(Config.PREFERENCE_RATING, 0.0f); mRatingBar.setRating(rating); mEditText.setText(comment); restoreBackup = true; } } if (restoreBackup) { mRatingBar.setEnabled(false); mRatingBar.setFocusable(false); mEditText.setEnabled(false); mEditText.setFocusable(false); mButton.setEnabled(false); mButton.setFocusable(false); ((TextView) findViewById(R.id.notice)).setText(R.string.rate_sent); } } mButton.setOnClickListener(this); }
From source file:com.ichi2.anki2.StudyOptionsActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { int icon;/*from www . j ava2s .c om*/ SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(this); if (preferences.getBoolean("invertedColors", false)) { icon = R.drawable.ic_menu_night_checked; } else { icon = R.drawable.ic_menu_night; } mInvalidateMenu = false; UIUtils.addMenuItemInActionBar(menu, Menu.NONE, MENU_NIGHT, Menu.NONE, R.string.night_mode, icon); UIUtils.addMenuItem(menu, Menu.NONE, MENU_PREFERENCES, Menu.NONE, R.string.menu_preferences, R.drawable.ic_menu_preferences); UIUtils.addMenuItem(menu, Menu.NONE, MENU_ROTATE, Menu.NONE, R.string.menu_rotate, android.R.drawable.ic_menu_always_landscape_portrait); if (AnkiDroidApp.colIsOpen() && !AnkiDroidApp.getCol().getDecks().isDyn(AnkiDroidApp.getCol().getDecks().selected())) { UIUtils.addMenuItem(menu, Menu.NONE, DeckPicker.MENU_CREATE_DYNAMIC_DECK, Menu.NONE, R.string.studyoptions_new_filtercram, R.drawable.ic_menu_add); } return true; }
From source file:com.thejoshwa.ultrasonic.androidapp.util.Util.java
public static boolean isScrobblingEnabled(Context context) { if (isOffline(context)) { return false; }// w ww. j a va 2 s . co m SharedPreferences prefs = getPreferences(context); return prefs.getBoolean(Constants.PREFERENCES_KEY_SCROBBLE, false); }
From source file:com.thejoshwa.ultrasonic.androidapp.util.Util.java
public static boolean isServerScalingEnabled(Context context) { if (isOffline(context)) { return false; }/*from w w w . jav a 2 s.co m*/ SharedPreferences prefs = getPreferences(context); return prefs.getBoolean(Constants.PREFERENCES_KEY_SERVER_SCALING, false); }
From source file:com.thejoshwa.ultrasonic.androidapp.util.Util.java
public static boolean getServerEnabled(Context context, int instance) { if (instance == 0) { return true; }/*ww w. j ava 2s . c o m*/ SharedPreferences prefs = getPreferences(context); return prefs.getBoolean(Constants.PREFERENCES_KEY_SERVER_ENABLED + instance, true); }