@Override public void onErrorResponse(VolleyError error) { doingLogin = false; SharedPreferences sp = PrefUtil.getPref(context, MYPREFS); PrefUtil.remove(sp, KEY_USERKEY); if (onCompleteLoginListener != null) onCompleteLoginListener.onCompleteLogin(false); }
private void saveUserToSharedPreference() { SharedPreferences sp = PrefUtil.getPref(context, MYPREFS); PrefUtil.put(sp, KEY_ID, user.id); PrefUtil.put(sp, KEY_USERNAME, user.name); PrefUtil.put(sp, KEY_EMAIL, user.email); PrefUtil.put(sp, KEY_POINT, user.point); }
private void readUserFromSharedPreference() { SharedPreferences sp = PrefUtil.getPref(context, MYPREFS); user.id = PrefUtil.getString(sp, KEY_ID); user.name = PrefUtil.getString(sp, KEY_USERNAME); user.email = PrefUtil.getString(sp, KEY_EMAIL); user.point = PrefUtil.getInt(sp, KEY_POINT); }
@Override public void onResponse(ResponseLogin response) { doingLogin = false; if (response.getIs_success() == 1) { login(); userKey = response.getUkey(); saveUserKeyToSharedPreference(); } else { logout(); SharedPreferences sp = PrefUtil.getPref(context, MYPREFS); PrefUtil.remove(sp, KEY_USERKEY); } if (onCompleteLoginListener != null) onCompleteLoginListener.onCompleteLogin(response.getIs_success() == 1); }
public void saveReadNotice(String readNoticeId) { SharedPreferences sp = PrefUtil.getPref(context, MYPREFS); PrefUtil.put(sp, KEY_READ_NOTICE, readNoticeId); }
public String getReadNotice() { SharedPreferences sp = PrefUtil.getPref(context, MYPREFS); return PrefUtil.getString(sp, KEY_READ_NOTICE); }
public void logout() { this.login = false; PrefUtil.clear(PrefUtil.getPref(context, MYPREFS)); }
private void savePointToSharedPreference() { SharedPreferences sp = PrefUtil.getPref(context, MYPREFS); PrefUtil.put(sp, KEY_POINT, this.user.point); }
private void saveLoginToSharedPreference() { SharedPreferences sp = PrefUtil.getPref(context, MYPREFS); PrefUtil.put(sp, KEY_LOGIN, this.login); }
private void readLoginFromSharedPreference() { SharedPreferences sp = PrefUtil.getPref(context, MYPREFS); this.login = PrefUtil.getBoolean(sp, KEY_LOGIN); }
private void saveUserKeyToSharedPreference() { SharedPreferences sp = PrefUtil.getPref(context, MYPREFS); PrefUtil.put(sp, KEY_USERKEY, this.userKey); }
private void readUserKeyFromSharedPreference() { SharedPreferences sp = PrefUtil.getPref(context, MYPREFS); this.userKey = PrefUtil.getString(sp, KEY_USERKEY); }