List of usage examples for android.content SharedPreferences getBoolean
boolean getBoolean(String key, boolean defValue);
From source file:be.benvd.mvforandroid.SettingsActivity.java
private int getNumEnabledAutoUpdates(SharedPreferences prefs) { int result = 0; if (prefs.getBoolean("auto_credit", false)) result++;// w w w .j a v a 2s .c o m if (prefs.getBoolean("auto_usage", false)) result++; if (prefs.getBoolean("auto_topups", false)) result++; return result; }
From source file:be.benvd.mvforandroid.SettingsActivity.java
private void updateCreditPreference(SharedPreferences sharedPreferences) { boolean autoCredit = sharedPreferences.getBoolean("auto_credit", false); autoCreditPreference.setSummary(autoCredit ? getString(R.string.settings_auto_credit_enabled) : getString(R.string.settings_auto_credit_disabled)); }
From source file:be.benvd.mvforandroid.SettingsActivity.java
private void updateTopupsPreference(SharedPreferences sharedPreferences) { boolean autoTopups = sharedPreferences.getBoolean("auto_topups", false); autoTopupsPreference.setSummary(autoTopups ? getString(R.string.settings_auto_topups_enabled) : getString(R.string.settings_auto_topups_disabled)); }
From source file:com.android.mms.MmsConfig.java
public static boolean isSmsPromoDismissed(Context context) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); return preferences.getBoolean(SMS_PROMO_DISMISSED_KEY, false); }
From source file:de.ub0r.android.websms.connector.custom.ConnectorCustom.java
@Override public ConnectorSpec updateSpec(final Context context, final ConnectorSpec connectorSpec) { final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(context); if (p.getBoolean(Preferences.PREFS_ENABLED, false)) { if (p.getString(Preferences.PREFS_URL, "").length() > 0) { connectorSpec.setReady();// ww w .j a va2 s . c om } else { connectorSpec.setStatus(ConnectorSpec.STATUS_ENABLED); } } else { connectorSpec.setStatus(ConnectorSpec.STATUS_INACTIVE); } return connectorSpec; }
From source file:com.openerp.services.ContactSyncService.java
public void performSync(Context context, Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { try {/*from w w w . j ava2 s. c om*/ Intent intent = new Intent(); intent.setAction(SyncFinishReceiver.SYNC_FINISH); String saasURL1 = "https://openerp.my.openerp.com"; String saasURL2 = "https://accounts.openerp.com"; Res_PartnerDBHelper db = new Res_PartnerDBHelper(context); OEHelper oe = db.getOEInstance(); Res_PartnerSyncHelper helper = new Res_PartnerSyncHelper(context); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); boolean syncServerContacts = settings.getBoolean("server_contact_sync", false); if (OpenERPAccountManager.currentUser(context).getHost().toString().contains(saasURL1) || OpenERPAccountManager.currentUser(context).getHost().toString().contains(saasURL2)) { helper.syncContacts(context, account); } else { if (syncServerContacts) { int company_id = Integer.parseInt(OpenERPAccountManager.currentUser(context).getCompany_id()); JSONObject domain = new JSONObject(); domain.accumulate("domain", new JSONArray("[[\"company_id\", \"=\", " + company_id + "]]")); if (oe.syncWithServer(db, domain, false)) { helper.syncContacts(context, account); } } else { helper.syncContacts(context, account); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.juick.android.MessageMenu.java
public static void confirmAction(int resId, Context context, boolean alwaysConfirm, final Runnable r) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); if (sp.getBoolean("confirmActions", true) || alwaysConfirm) { new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_alert) .setMessage(context.getResources().getString(resId)) .setPositiveButton(R.string.OK, new OnClickListener() { @Override/*from w w w . ja v a 2 s . co m*/ public void onClick(DialogInterface dialog, int which) { r.run(); } }).setNegativeButton(R.string.Cancel, null).show(); } else { r.run(); } }
From source file:com.motelabs.chromemote.bridge.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SharedPreferences prefs = this.getSharedPreferences("com.motelabs.chromemote.bridge", Context.MODE_PRIVATE); boolean isActive = prefs.getBoolean("com.motelabs.chromemote.bridge.active", true); TextView ipAddressTextView = (TextView) findViewById(R.id.ipAddressTextView); ipAddressTextView.setText(getLocalIpAddress()); backgroundServiceIntent = new Intent(this, BackgroundService.class); if (isActive) initBackgroundService();/*w w w . j a v a 2 s.c o m*/ else { serviceEnabled = false; //unloadBackgroundService(); TextView serviceStatusTextView = (TextView) findViewById(R.id.serviceStatusTextView); serviceStatusTextView.setText("INACTIVE"); ImageButton toggleServiceButton = (ImageButton) findViewById(R.id.toggleServiceButton); toggleServiceButton.setBackgroundResource(R.drawable.toggled_off_btn); } }
From source file:com.alphabetbloc.accessmrs.tasks.CheckConnectivityTask.java
protected void getServerCredentials() { if (mServer == null) mServer = NetworkUtils.getPatientDownloadUrl(); if (mUsername == null) mUsername = NetworkUtils.getServerUsername(); if (mPassword == null) mPassword = NetworkUtils.getServerPassword(); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(App.getApp()); mSavedSearch = settings.getBoolean(App.getApp().getString(R.string.key_use_saved_searches), false); mCohort = Integer.valueOf(settings.getString(App.getApp().getString(R.string.key_saved_search), "0")); mProgram = Integer.valueOf(settings.getString(App.getApp().getString(R.string.key_program), "0")); }
From source file:com.android.mms.MmsConfig.java
public static boolean getMmsDirMode() { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(MmsApp.getApplication()); boolean dirMode = sp.getBoolean("CmccMmsUiMode", false); return dirMode; }