| | |
| | | public void saveLoginInfo(User loginUser){ |
| | | SharedPreferences preferences = mContext.getSharedPreferences(SP_LOGIN_USER_KEY, Context.MODE_PRIVATE); |
| | | Editor editor = preferences.edit(); |
| | | editor.putString("id",loginUser.get_id()); |
| | | editor.putString("phone",loginUser.getPhone()); |
| | | editor.putString("encypt",loginUser.getEncypt()); |
| | | editor.putString("password",loginUser.getPassword()); |
| | | editor.putString("nickname",loginUser.getNickname()); |
| | | editor.putInt("refresh_frequency",loginUser.getRefresh_frequency()); |
| | | editor.putInt("is_open_upload",loginUser.getIs_open_upload()); |
| | | editor.putInt("is_lock",loginUser.getIs_lock()); |
| | | editor.putInt("video",loginUser.getVideo()); |
| | | editor.commit(); |
| | | } |
| | | |
| | | public User getLoginInfo(){ |
| | | SharedPreferences sp = mContext.getSharedPreferences(SP_LOGIN_USER_KEY, Context.MODE_PRIVATE); |
| | | User loginUserInfo = new User(); |
| | | loginUserInfo.set_id(sp.getString("id","")); |
| | | loginUserInfo.setEncypt(sp.getString("encypt","")); |
| | | loginUserInfo.setPhone(sp.getString("phone","")); |
| | | loginUserInfo.setPassword(sp.getString("password","")); |
| | | loginUserInfo.setNickname(sp.getString("nickname","")); |
| | | loginUserInfo.setRefresh_frequency(sp.getInt("refresh_frequency",10)); |
| | | loginUserInfo.setIs_open_upload(sp.getInt("is_open_upload",1)); |
| | | loginUserInfo.setIs_lock(sp.getInt("is_lock",0)); |
| | | loginUserInfo.setVideo(sp.getInt("video",0)); |
| | | return loginUserInfo; |
| | | } |
| | | |
| | |
| | | return userid; |
| | | } |
| | | |
| | | |
| | | public void setUpload(int is_open_upload){ |
| | | SharedPreferences preferences = mContext.getSharedPreferences(SP_LOGIN_USER_KEY, Context.MODE_PRIVATE); |
| | | Editor editor = preferences.edit(); |
| | | editor.putInt("is_open_upload",is_open_upload); |
| | | editor.commit(); |
| | | } |
| | | |
| | | public void setVideo(int video){ |
| | | SharedPreferences preferences = mContext.getSharedPreferences(SP_LOGIN_USER_KEY, Context.MODE_PRIVATE); |
| | | Editor editor = preferences.edit(); |
| | | editor.putInt("video",video); |
| | | editor.commit(); |
| | | } |
| | | public void setRefreh(int refresh){ |
| | | SharedPreferences preferences = mContext.getSharedPreferences(SP_LOGIN_USER_KEY, Context.MODE_PRIVATE); |
| | | Editor editor = preferences.edit(); |
| | | editor.putInt("refresh_frequency",refresh); |
| | | editor.commit(); |
| | | } |
| | | |
| | | public void exitLogin(){ |
| | | SharedPreferences preferences = mContext.getSharedPreferences(SP_LOGIN_USER_KEY, Context.MODE_PRIVATE); |
| | | Editor editor = preferences.edit(); |
| | | editor.putString("id",""); |
| | | editor.putString("nickname",""); |
| | | editor.putString("phone",""); |
| | | editor.putString("encypt",""); |
| | | editor.putString("password",""); |
| | | editor.putString("username",""); |
| | | editor.putString("hotelid",""); |
| | | editor.putString("hotelname",""); |
| | | editor.putInt("opt",0); |
| | | editor.putString("nickname",""); |
| | | editor.putInt("refresh_frequency",0); |
| | | editor.putInt("is_open_upload",0); |
| | | editor.putInt("is_lock",0); |
| | | editor.putInt("video",0); |
| | | editor.commit(); |
| | | MainApp.theApp.userId=""; |
| | | } |