use of android.content.SharedPreferences in project android-instagram by markchang.
the class Utils method getUsername.
public static String getUsername(Context ctx) {
SharedPreferences sharedPreferences = ctx.getSharedPreferences(PREFS_NAME, Activity.MODE_PRIVATE);
Boolean loginValid = sharedPreferences.getBoolean("loginValid", false);
if (loginValid) {
return sharedPreferences.getString("username", null);
} else {
return null;
}
}
use of android.content.SharedPreferences in project android-instagram by markchang.
the class LoginActivity method clearCookies.
public void clearCookies() {
// clear username/password in shared preferences
SharedPreferences sharedPreferences = getSharedPreferences(Utils.PREFS_NAME, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.clear();
editor.putBoolean("loginValid", false);
editor.commit();
}
use of android.content.SharedPreferences in project JieCaoVideoPlayer by lipangit.
the class JCUtils method getSavedProgress.
public static int getSavedProgress(Context context, String url) {
if (!JCVideoPlayer.SAVE_PROGRESS)
return 0;
SharedPreferences spn;
spn = context.getSharedPreferences("JCVD_PROGRESS", Context.MODE_PRIVATE);
return spn.getInt(url, 0);
}
use of android.content.SharedPreferences in project LiveSDK-for-Android by liveservices.
the class LiveAuthClient method getCookieKeysFromPreferences.
private List<String> getCookieKeysFromPreferences() {
SharedPreferences settings = getSharedPreferences();
String cookieKeys = settings.getString(PreferencesConstants.COOKIES_KEY, "");
return Arrays.asList(TextUtils.split(cookieKeys, PreferencesConstants.COOKIE_DELIMITER));
}
use of android.content.SharedPreferences in project NotificationPeekPort by lzanita09.
the class AppList method updateQuietHour.
/**
* Update quiet hour period.
*/
public void updateQuietHour() {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
String quietHourStr = preferences.getString(PreferenceKeys.PREF_QUIET_HOUR, PreferenceKeys.PREF_QUIET_HOUR_DEF);
mQuietHour = QuietHour.createQuietHour(quietHourStr);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, mQuietHour.getFromHour());
calendar.set(Calendar.MINUTE, mQuietHour.getFromMin());
mFromTime = calendar.getTimeInMillis();
calendar.set(Calendar.HOUR_OF_DAY, mQuietHour.getToHour());
calendar.set(Calendar.MINUTE, mQuietHour.getToMin());
if (calendar.getTimeInMillis() < mFromTime) {
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + 1);
}
mToTime = calendar.getTimeInMillis();
}
Aggregations