예제 #1
0
 @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);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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);
 }
예제 #4
0
        @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);
        }
예제 #5
0
 public void saveReadNotice(String readNoticeId) {
   SharedPreferences sp = PrefUtil.getPref(context, MYPREFS);
   PrefUtil.put(sp, KEY_READ_NOTICE, readNoticeId);
 }
예제 #6
0
 public String getReadNotice() {
   SharedPreferences sp = PrefUtil.getPref(context, MYPREFS);
   return PrefUtil.getString(sp, KEY_READ_NOTICE);
 }
예제 #7
0
 public void logout() {
   this.login = false;
   PrefUtil.clear(PrefUtil.getPref(context, MYPREFS));
 }
예제 #8
0
 private void savePointToSharedPreference() {
   SharedPreferences sp = PrefUtil.getPref(context, MYPREFS);
   PrefUtil.put(sp, KEY_POINT, this.user.point);
 }
예제 #9
0
 private void saveLoginToSharedPreference() {
   SharedPreferences sp = PrefUtil.getPref(context, MYPREFS);
   PrefUtil.put(sp, KEY_LOGIN, this.login);
 }
예제 #10
0
 private void readLoginFromSharedPreference() {
   SharedPreferences sp = PrefUtil.getPref(context, MYPREFS);
   this.login = PrefUtil.getBoolean(sp, KEY_LOGIN);
 }
예제 #11
0
 private void saveUserKeyToSharedPreference() {
   SharedPreferences sp = PrefUtil.getPref(context, MYPREFS);
   PrefUtil.put(sp, KEY_USERKEY, this.userKey);
 }
예제 #12
0
 private void readUserKeyFromSharedPreference() {
   SharedPreferences sp = PrefUtil.getPref(context, MYPREFS);
   this.userKey = PrefUtil.getString(sp, KEY_USERKEY);
 }