@Override public void restore(SharedPreferences preferences) { mUserName = preferences.getString("username", null); mPasswd = preferences.getString("passwd", null); mRememberPasswd = preferences.getBoolean("remember_pwd", false); mIsMsgNoTip = preferences.getBoolean("msg_no_tip", false); mIsMsgTipAudio = preferences.getBoolean("msg_tip_audio", true); mIsMsgTipVibrator = preferences.getBoolean("msg_tip_vibrator", false); mAutoLogin = preferences.getBoolean("auto_login", false); mIsFirstLogin = preferences.getBoolean("is_first_login", true); if (!YiUtils.isStringInvalid(mPasswd)) { mPasswd = YiBase64.decode(mPasswd); } }
@Override public void save(Editor editor) { editor.putString("username", mUserName); editor.putBoolean("remember_pwd", mRememberPasswd); editor.putBoolean("auto_login", mAutoLogin); editor.putBoolean("msg_no_tip", mIsMsgNoTip); editor.putBoolean("msg_tip_audio", mIsMsgTipAudio); editor.putBoolean("msg_tip_vibrator", mIsMsgTipVibrator); editor.putBoolean("is_first_login", mIsFirstLogin); if (mRememberPasswd) { editor.putString("passwd", YiBase64.encode(mPasswd)); } else { editor.putString("passwd", ""); } }