List of usage examples for android.content SharedPreferences equals
public boolean equals(Object obj)
From source file:edu.mit.media.funf.configured.ConfiguredPipeline.java
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Log.i(TAG, "Shared Prefs changed"); if (sharedPreferences.equals(getConfig().getPrefs())) { Log.i(TAG, "Configuration changed"); onConfigChange(getConfig().toString(true)); if (FunfConfig.isDataRequestKey(key)) { if (isEnabled()) { String probeName = FunfConfig.keyToProbename(key); sendProbeRequest(probeName); }//w w w .ja va 2 s . c o m } else if (FunfConfig.CONFIG_UPDATE_PERIOD_KEY.equals(key)) { cancelAlarm(ACTION_UPDATE_CONFIG); } else if (FunfConfig.DATA_ARCHIVE_PERIOD_KEY.equals(key)) { cancelAlarm(ACTION_ARCHIVE_DATA); } else if (FunfConfig.DATA_UPLOAD_PERIOD_KEY.equals(key)) { cancelAlarm(ACTION_UPLOAD_DATA); } if (isEnabled()) { scheduleAlarms(); } } else if (sharedPreferences.equals(getSystemPrefs()) && ENABLED_KEY.equals(key)) { Log.i(TAG, "System prefs changed"); reload(); } }
From source file:com.betterAlarm.deskclock.timer.TimerFragment.java
@Override public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { if (prefs.equals(mPrefs)) { if ((key.equals(Timers.FROM_ALERT) && prefs.getBoolean(Timers.FROM_ALERT, false)) || (key.equals(Timers.FROM_NOTIFICATION) && prefs.getBoolean(Timers.FROM_NOTIFICATION, false))) { // The data-changed flag was set in the alert or notification so the adapter needs // to re-sync with the database SharedPreferences.Editor editor = mPrefs.edit(); editor.putBoolean(key, false); editor.apply();/*w w w .j a v a 2 s . co m*/ mAdapter.populateTimersFromPref(); mViewPager.setAdapter(mAdapter); if (mViewState != null) { final int currPage = mViewState.getInt(CURR_PAGE); mViewPager.setCurrentItem(currPage); highlightPageIndicator(currPage); } else { highlightPageIndicator(0); } setFabAppearance(); return; } } }
From source file:com.android.deskclock.timer.TimerFullScreenFragment.java
@Override public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { if (prefs.equals(mPrefs)) { if (key.equals(Timers.REFRESH_UI_WITH_LATEST_DATA) && prefs.getBoolean(key, false)) { // Clear the flag forcing a fresh of the adapter to reflect changes in the database. mPrefs.edit().putBoolean(key, false).apply(); }//w ww. j ava2s .c o m /// M: Only SharedPreferenceChanged to update adapter data. mAdapter = createAdapter(getActivity()); mAdapter.onRestoreInstanceState(null); mTimersList.setAdapter(mAdapter); } }