金坛河长通 v1.1.6版本的 MD5 值为:20e883288031684b3415ea19cd21af4d
以下内容为反编译后的 SettingModel.java 源代码,内容仅作参考
package com.zkzy.hzz.user.model;
import android.app.Activity;
import android.content.Context;
import com.yanzhenjie.nohttp.NoHttp;
import com.yanzhenjie.nohttp.RequestMethod;
import com.yanzhenjie.nohttp.rest.Request;
import com.zkzy.hzz.Global;
import com.zkzy.hzz.base.MyApplication;
import com.zkzy.hzz.nohttp.CallServer;
import com.zkzy.hzz.nohttp.HttpListener;
import com.zkzy.hzz.update.UpdateUtils;
import com.zkzy.hzz.utils.AppUtils;
import com.zkzy.hzz.utils.SharePreUtils;
import com.zkzy.jthzz.R;
public class SettingModel implements ISettingModel {
private Context context;
private SharePreUtils sharePreUtils;
public SettingModel(Context context) {
this.context = context;
this.sharePreUtils = new SharePreUtils(context, Global.USER_FILE);
}
@Override
public boolean getAutoLogin() {
return this.sharePreUtils.getBoolean(Global.IS_AUTO_LOGIN, false);
}
@Override
public boolean getSavePw() {
return this.sharePreUtils.getBoolean(Global.IS_SAVE_PASS_WORD, true);
}
@Override
public boolean getIsNight() {
return this.sharePreUtils.getBoolean(Global.IS_NIGHT, false);
}
@Override
public String getTheVersion() {
return AppUtils.getVersionName(this.context);
}
@Override
public void setAutoLogin(boolean autoLogin) {
this.sharePreUtils.putBoolean(Global.IS_AUTO_LOGIN, autoLogin);
}
@Override
public void setSavePw(boolean savePw) {
this.sharePreUtils.putBoolean(Global.IS_SAVE_PASS_WORD, savePw);
}
@Override
public void setIsNight(boolean isNight) {
this.sharePreUtils.putBoolean(Global.IS_NIGHT, isNight);
}
@Override
public void checkUpdate(boolean notNewVersionShow, Activity activity) {
UpdateUtils.getInstance().checkNewVersion(activity, true);
}
@Override
public String getLanguage() {
String s = this.sharePreUtils.getString(Global.VOICE_LANGUAGE, "mandarin");
if (s.equals("mandarin")) {
return this.context.getString(R.string.setting_mandarin);
}
if (s.equals("cantonese")) {
return this.context.getString(R.string.setting_cantonese);
}
if (s.equals("lmz")) {
return this.context.getString(R.string.setting_lmz);
}
return s;
}
@Override
public void saveLanguage(String language) {
this.sharePreUtils.putString(Global.VOICE_LANGUAGE, language);
}
@Override
public String getIp() {
String ip = this.sharePreUtils.getString(Global.BASE_IP, "");
if (ip.equals("")) {
return "112.21.188.224";
}
return ip;
}
@Override
public String getPort() {
String port = this.sharePreUtils.getString(Global.BASE_PORT, "");
if (port.equals("")) {
return Global.BASE_URL_PORT;
}
return port;
}
@Override
public String getHtmlIp() {
String ip = this.sharePreUtils.getString(Global.BASE_HTML_IP, "");
if (ip.equals("")) {
return "112.21.188.224";
}
return ip;
}
@Override
public String getHtmlPort() {
String port = this.sharePreUtils.getString(Global.BASE_HTML_PORT, "");
if (port.equals("")) {
return "80";
}
return port;
}
@Override
public String getFileSystemIp() {
String ip = this.sharePreUtils.getString(Global.BASE_FILE_SYSTEM_IP, "");
if (ip.equals("")) {
return "112.21.188.224";
}
return ip;
}
@Override
public String getFileSystemPort() {
String port = this.sharePreUtils.getString(Global.BASE_FILE_SYSTEM_PORT, "");
if (port.equals("")) {
return "80";
}
return port;
}
@Override
public void setIp(String ip) {
this.sharePreUtils.putString(Global.BASE_IP, ip);
}
@Override
public void setPort(String port) {
this.sharePreUtils.putString(Global.BASE_PORT, port);
}
@Override
public void setHtmlIp(String htmlIp) {
this.sharePreUtils.putString(Global.BASE_HTML_IP, htmlIp);
}
@Override
public void setHtmlPort(String htmlPort) {
this.sharePreUtils.putString(Global.BASE_HTML_PORT, htmlPort);
}
@Override
public void setFileSystemIp(String fileSystemIp) {
this.sharePreUtils.putString(Global.BASE_FILE_SYSTEM_IP, fileSystemIp);
}
@Override
public void setFileSystemPort(String fileSystemPort) {
this.sharePreUtils.putString(Global.BASE_FILE_SYSTEM_PORT, fileSystemPort);
}
@Override
public void clearLastPassWord() {
this.sharePreUtils.putString(Global.LAST_PASS_WORD, "");
}
@Override
public void changePassword(String newPassword, String id, HttpListener<String> listener) {
String baseUrl = AppUtils.getBaseIp() + Global.SETTING_CHANGE_PASSWORD;
Request<String> request = NoHttp.createStringRequest(baseUrl, RequestMethod.POST);
request.addHeader(Global.HEADER_TOKEN_KEY, new SharePreUtils(MyApplication.getContext(), Global.USER_FILE).getString("token", ""));
request.add("password", newPassword);
request.add("Id", id);
CallServer.getInstance().request((Activity) this.context, 39, request, listener);
}
}