2023年10月25日18:16:37
备份一下代码
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="ExternalStorageConfigurationManager" enabled="true" /> |
| | | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="corretto-1.8" project-jdk-type="JavaSDK" /> |
| | |
| | | if (response.getCode() == HDLCloudCode.SUCCEED) { |
| | | onResponse(response.getData()); |
| | | } else { |
| | | if(HDLLinkPMSdk.isDebugVersion()){ |
| | | HDLLinkPMSdk.showToast(response.getMessage()); |
| | | } |
| | | // if(HDLLinkPMSdk.isDebugVersion()){ |
| | | // HDLLinkPMSdk.showToast(response.getMessage()); |
| | | // } |
| | | onFailure(new HDLException(response.getCode(), response.getMessage())); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public final void onError(HxException e) { |
| | | if(HDLLinkPMSdk.isDebugVersion()){ |
| | | HDLLinkPMSdk.showToast(e.getRawThrowable().getMessage()); |
| | | } |
| | | // if(HDLLinkPMSdk.isDebugVersion()){ |
| | | // HDLLinkPMSdk.showToast(e.getRawThrowable().getMessage()); |
| | | // } |
| | | onFailure(new HDLException(e.getCode(),e.getRawThrowable().getMessage())); |
| | | } |
| | | |
| | |
| | | import com.hdl.linkpm.sdk.user.callback.IOnReloginListener; |
| | | import com.hdl.linkpm.sdk.utils.HDLSDKSPUtils; |
| | | import com.hdl.photovoltaic.config.AppConfigManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.ui.HomeLoginActivity; |
| | | import com.hdl.photovoltaic.uni.HDLUniMPSDKManager; |
| | |
| | | //收到登录处理通知,关闭所有页面并打开登录页面 |
| | | AppManagerUtils.getAppManager().finishAllActivity(); |
| | | HDLSDKSPUtils.clear(); |
| | | |
| | | // //重新登陆,默认同意隐私政策 |
| | | // UserConfigManage.getInstance().AcceiptPolicy = true; |
| | | //设定一个时间 |
| | | UserConfigManage.getInstance().setLoginDateTime(0); |
| | | UserConfigManage.getInstance().Save(); |
| | | // if(null!=HDLUniMPSDKManager.getInstance().getUniMP()){ |
| | | // LogUtils.d("asdfasdfasdfsdf我被删除啦"); |
| | | // HDLUniMPSDKManager.getInstance().getUniMP().closeUniMP(); |
| | |
| | | //判断当前时间点是否能够自动登录 |
| | | public boolean isAutoLogin() { |
| | | //7天内自动登录 |
| | | return ((System.currentTimeMillis() - loginDateTime) < 7 * 24 * 60 * 60); |
| | | return ((System.currentTimeMillis() - loginDateTime) < (7 * 24 * 60 * 60 * 1000)); |
| | | } |
| | | |
| | | //是否同意隐私政策 |
| | |
| | | public String connEmqClientId; |
| | | //当前登录的账号是不是之前的账号 |
| | | public boolean theSameLoginAccount; |
| | | |
| | | /** |
| | | * 用户名称 |
| | | * |
| | | * @return - |
| | | */ |
| | | public String getUserName() { |
| | | |
| | | return TextUtils.isEmpty(userName) ? account : userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | private String userName;//用户名称 |
| | | |
| | | public String getRefreshToken() { |
| | | return refreshToken == null ? "" : refreshToken; |
| | |
| | | this.theSameLoginAccount = theSameLoginAccount; |
| | | } |
| | | |
| | | /** |
| | | * 是否是B端账号登录(true=B端) |
| | | * |
| | | * @return - |
| | | */ |
| | | public boolean isBAccount() { |
| | | return isB_account; |
| | | } |
| | |
| | | //读取保存的数据 |
| | | Gson gson = new Gson(); |
| | | sUserConfigManage = gson.fromJson(str, UserConfigManage.class); |
| | | if (sUserConfigManage == null) { |
| | | sUserConfigManage = new UserConfigManage(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// Config文件名 |
| | | /// </summary> |
| | | private static final String FILENAME = "UserConfigManage.json"; |
| | | |
| | | |
| | | |
| | | private static final String FILENAME = HdlFileLogic.getInstance().getAPPInternalStoreFilesPath() + "/UserConfigManage.json"; |
| | | |
| | | |
| | | } |
| | |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.utils.HDLMD5Utils; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 请求服务器 |
| | | * 底层方法,引用库的方法 |
| | | * |
| | | * @param api 请求接口 |
| | | * @param body 请求参数(appKey,timestamp,sign这三个参数内部会自动添加)) |
| | | * @param callBack 回调 |
| | | * @return - |
| | | */ |
| | | private Disposable requestFile(String api, File body, CloudCallBeak<String> callBack) { |
| | | |
| | | |
| | | String requestUrl = HDLCloudUserApi.getRequestUrl(api); |
| | | Gson gson = new Gson(); |
| | | System.out.println("http->发送->" + requestUrl + "\r\n" + body); |
| | | return HxHttp.builder() |
| | | .url(requestUrl) |
| | | .file(body) |
| | | .build() |
| | | .post() |
| | | .subscribeWith(new HDLResponse<String>() { |
| | | @Override |
| | | public void onResponse(String str) { |
| | | if (callBack != null) { |
| | | callBack.onSuccess(str); |
| | | // System.out.println("http->回复->" + requestUrl + "\r\n" + gson.fromJson(str, JsonObject.class).toString()); |
| | | System.out.println("http->回复->" + requestUrl + "\r\n" + str); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | HDLExceptionSubmitUtils.submit(requestUrl, body, e); |
| | | if (callBack != null) { |
| | | callBack.onFailure(e); |
| | | System.out.println("http->回复->" + requestUrl + "\r\n" + "\"{code=\"" + e.getCode() + "," + "\"message=\"" + e.getMsg() + "}"); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 请求服务器 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 请求服务器(上传文件) |
| | | * |
| | | * @param api 请求接口 |
| | | * @param body 请求参数(json) |
| | | * @param callBack 回调 |
| | | */ |
| | | public Disposable requestHttpFile(String api, File body, CloudCallBeak<String> callBack) { |
| | | return requestFile(api, body, callBack); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 请求服务器的方法(已弃用) |
| | | * |
| | | * @param requestUrl 请求接口 |
| | |
| | | //更改个人密码 |
| | | public static final String B_POST_UPDATE_PROGRAM_PASSWORD = "/smart-footstone/user/userInfo/updateProgramPassword"; |
| | | //获取员工列表 |
| | | public static final String POST_GET_USER_LIST = "/smart-footstone/user/userInfo/getUserList"; |
| | | public static final String B_POST_GET_USER_LIST = "/smart-footstone/user/userInfo/getUserList"; |
| | | |
| | | //上传图片 |
| | | public static final String POST_UPLOAD_IMAGE = "/home-wisdom/app/images/upload_image"; |
| | | //上传图片(新) |
| | | public static final String POST_UPLOAD_IMAGE_NEW = "/basis-cosmos/file/upload"; |
| | | //查询图片路径 |
| | | public static final String POST_GET_Image_Url = "/home-wisdom/app/images/get_image_url"; |
| | | |
| | | //获取用户详情信息 |
| | | public static final String B_POST_GET_USERINFO = "/basis-footstone/mgmt/user/oauth/getUserInfo"; |
| | | |
| | | |
| | | //退出登录 |
| | | public static final String POST_GET_IMAGE_LOGOUT = "/basis-footstone/mgmt/user/oauth/logout"; |
| | | //endregion |
| | |
| | | public static final String C_POST_FORGET_PROGRAM_PWD = "/smart-footstone/member/oauth/forgetPwd"; |
| | | //更改个人密码 |
| | | public static final String C_POST_UPDATE_PROGRAM_PASSWORD = "/smart-footstone/member/memberInfo/updatePwd"; |
| | | //获取用户个人信息 C端 |
| | | //获取用户个人信息 |
| | | public static final String C_POST_GET_MEMBER_INFO = "/smart-footstone/member/memberInfo/getMemberInfo"; |
| | | //更新个人信息 C端 |
| | | //更新个人信息 |
| | | public static final String C_POST_UPDATE_MEMBER_INFO = "/smart-footstone/member/memberInfo/updateMemberInfo"; |
| | | //查询图片路径 |
| | | public static final String C_POST_GET_IMAGE_URL = "/home-wisdom/app/images/get_image_url"; |
| | | //上传图片 |
| | | public static final String C_POST_UPLOAD_IMAGE = "/home-wisdom/app/images/upload_image"; |
| | | //上传图片(新) |
| | | public static final String C_POST_UPLOAD_IMAGE_NEW = "/basis-cosmos/file/upload"; |
| | | |
| | | //endregion |
| | | //endregion |
| | | |
| | |
| | | package com.hdl.photovoltaic.other; |
| | | |
| | | |
| | | import android.text.TextUtils; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.JsonObject; |
| | | import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.linkpm.sdk.user.HDLLinkPMUser; |
| | | import com.hdl.linkpm.sdk.user.bean.HDLLoginBean; |
| | | import com.hdl.linkpm.sdk.user.bean.HDLUserRegionBean; |
| | | import com.hdl.linkpm.sdk.user.bean.ImageSubmitInfo; |
| | | import com.hdl.linkpm.sdk.user.callback.ILoginCallBack; |
| | | import com.hdl.linkpm.sdk.user.callback.IRegionByAccountCallBack; |
| | | import com.hdl.linkpm.sdk.user.controller.HDLPMUserController; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.internet.HttpClient; |
| | | import com.hdl.photovoltaic.internet.api.HttpApi; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.ui.bean.BUserInfo; |
| | | import com.hdl.photovoltaic.ui.bean.CUserInfo; |
| | | |
| | | import java.io.File; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户详情信息(B端账号) |
| | | * |
| | | * @param cloudCallBeak - |
| | | */ |
| | | public void getUserInfo(CloudCallBeak<BUserInfo> cloudCallBeak) { |
| | | String requestUrl = HttpApi.B_POST_GET_USERINFO; |
| | | JsonObject json = new JsonObject(); |
| | | HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String jsonStr) { |
| | | Gson gson = new Gson(); |
| | | BUserInfo bUserInfo = gson.fromJson(jsonStr, BUserInfo.class); |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(bUserInfo); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | // endregion |
| | | |
| | | // region --------【C端账号】--------- |
| | | |
| | | |
| | | /** |
| | | * 上传用户头像 |
| | | * |
| | | * @param file 图片文件 |
| | | * @param cloudCallBeak - |
| | | */ |
| | | public void uploadUserHeadImage(File file, CloudCallBeak<String> cloudCallBeak) { |
| | | String requestUrl = HttpApi.C_POST_GET_IMAGE_URL; |
| | | HttpClient.getInstance().requestHttpFile(requestUrl, file, new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String jsonStr) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(jsonStr); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户头像路径(C端账号) |
| | | * |
| | | * @param imageKey 用户头像imageKey |
| | | * @param cloudCallBeak - |
| | | */ |
| | | public void getImageKey(String imageKey, CloudCallBeak<String> cloudCallBeak) { |
| | | String requestUrl = HttpApi.C_POST_GET_IMAGE_URL; |
| | | JsonObject json = new JsonObject(); |
| | | json.addProperty("imageKey", imageKey); |
| | | HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String jsonStr) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(jsonStr); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取个人信息(C端账号) |
| | | * |
| | | * @param cloudCallBeak - |
| | | */ |
| | | public void getMemberInfo(CloudCallBeak<CUserInfo> cloudCallBeak) { |
| | | String requestUrl = HttpApi.C_POST_GET_MEMBER_INFO; |
| | | JsonObject json = new JsonObject(); |
| | | HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String jsonStr) { |
| | | Gson gson = new Gson(); |
| | | CUserInfo cUserInfo = gson.fromJson(jsonStr, CUserInfo.class); |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(cUserInfo); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 更新个人信息(C端账号) |
| | | * |
| | | * @param languageType 语言类型 |
| | | * @param memberName 用户昵称 |
| | | * @param memberBirthday 用户生日 |
| | | * @param memberHeadIcon 用户头像 |
| | | * @param loginName 登陆账号 |
| | | * @param memberSex 用户性别 |
| | | * @param cloudCallBeak - |
| | | */ |
| | | public void updateMemberInfo(String languageType, |
| | | String memberName, |
| | | String memberBirthday, |
| | | String memberHeadIcon, |
| | | String loginName, |
| | | String memberSex, |
| | | CloudCallBeak<Boolean> cloudCallBeak) { |
| | | String requestUrl = HttpApi.C_POST_UPDATE_MEMBER_INFO; |
| | | JsonObject json = new JsonObject(); |
| | | if (!TextUtils.isEmpty(languageType)) { |
| | | json.addProperty("languageType", languageType);//语言类型 |
| | | } |
| | | if (!TextUtils.isEmpty(memberName)) { |
| | | json.addProperty("memberName", memberName);//用户昵称 |
| | | } |
| | | if (!TextUtils.isEmpty(memberBirthday)) { |
| | | json.addProperty("memberBirthday", memberBirthday);//用户生日 |
| | | } |
| | | if (!TextUtils.isEmpty(memberHeadIcon)) { |
| | | json.addProperty("memberHeadIcon", memberHeadIcon);//用户头像 |
| | | } |
| | | if (!TextUtils.isEmpty(loginName)) { |
| | | json.addProperty("loginName", loginName);//登陆账号 |
| | | } |
| | | if (!TextUtils.isEmpty(memberSex)) { |
| | | json.addProperty("memberSex", memberSex);//用户性别 |
| | | } |
| | | HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String str) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(true); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 注册账号(C端账号) |
| | | * 注意:B |
| | | * 注意:B端不支持注册账号 |
| | | * |
| | | * @param isPhone true表示手机号,否则是邮箱 |
| | | * @param account 账号 (手机或者邮箱) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // endregion |
| | | |
| | | |
| | |
| | | UserConfigManage.getInstance().setRefreshToken(obj.getRefreshToken());//刷新Token用的刷新Token用的 |
| | | boolean isUserId = UserConfigManage.getInstance().getUserId().equals(obj.getUserId()); |
| | | UserConfigManage.getInstance().setTheSameLoginAccount(isUserId);//与上一个账号是否同一个 |
| | | UserConfigManage.getInstance().Save(); |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 获取手机内部存储文件路径 |
| | | */ |
| | | private String getAPPInternalStoreFilesPath() { |
| | | public String getAPPInternalStoreFilesPath() { |
| | | return HDLApp.getInstance().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getPath(); |
| | | } |
| | | |
| | |
| | | package com.hdl.photovoltaic.other; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.os.Handler; |
| | | import android.os.Looper; |
| | | import android.util.Log; |
| | | import android.widget.Toast; |
| | | |
| | | import androidx.appcompat.content.res.AppCompatResources; |
| | | |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.enums.ShowErrorMode; |
| | | import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; |
| | | import com.hdl.photovoltaic.widget.ConfirmationExceptionDialog; |
| | | import com.hdl.photovoltaic.widget.FlashingBoxDialog; |
| | | |
| | | /** |
| | | * 线程逻辑 |
| | |
| | | exception(e, showErrorMode, context); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 全局弹出框,系统默认Toast |
| | | */ |
| | | public static void toast(final Context context, final HDLException hdlException) { |
| | | handler.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Toast.makeText(context, hdlException.getMsg() + "(" + hdlException.getCode() + ")", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 全局弹出框,系统默认Toast |
| | | */ |
| | | public static void toast(final Context context, final int resId) { |
| | | handler.post(new Runnable() { |
| | | @Override |
| | |
| | | |
| | | |
| | | /** |
| | | * 错误提示框(蓝湖上样式) |
| | | * |
| | | * @param isBoolean 图标(true使用成功图标,false使用成功图标) |
| | | * @param msg 信息 |
| | | * @param code 状态 |
| | | */ |
| | | public static void tipFlashingBox(Context context, boolean isBoolean, String msg, int code) { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | FlashingBoxDialog flashingBoxDialog = new FlashingBoxDialog(context); |
| | | if (isBoolean) { |
| | | Drawable drawable = AppCompatResources.getDrawable(context, R.drawable.tip_succeed); |
| | | flashingBoxDialog.setImage(drawable); |
| | | } else { |
| | | Drawable drawable = AppCompatResources.getDrawable(context, R.drawable.tip_fail); |
| | | flashingBoxDialog.setImage(drawable); |
| | | } |
| | | flashingBoxDialog.setContent(msg + "\r\n(" + code + ")"); |
| | | flashingBoxDialog.show(); |
| | | } |
| | | }, null, null); |
| | | } |
| | | |
| | | /** |
| | | * @param ex 异常信息类 |
| | | * @param context 上下文(不需要弹框填null) |
| | | * @param showErrorMode 是否显示错误(不需要填null) |
| | |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | uniCallbackData(null, e.getCode(), e.getMessage(), callback); |
| | | uniCallbackData(null, e.getCode(), e.getMsg(), callback); |
| | | } |
| | | }); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | uniCallbackData(null, e.getCode(), e.getMessage(), callback); |
| | | uniCallbackData(null, e.getCode(), e.getMsg(), callback); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | uniCallbackData(null, e.getCode(), e.getMessage(), callback); |
| | | uniCallbackData(null, e.getCode(), e.getMsg(), callback); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | uniCallbackData(null, e.getCode(), e.getMessage(), callback); |
| | | uniCallbackData(null, e.getCode(), e.getMsg(), callback); |
| | | } |
| | | }); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | uniCallbackData(null, e.getCode(), e.getMessage(), callback); |
| | | uniCallbackData(null, e.getCode(), e.getMsg(), callback); |
| | | } |
| | | }); |
| | | } |
| | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | //发送失败 |
| | | uniCallbackData(null, e.getCode(), e.getMessage(), callback); |
| | | uniCallbackData(null, e.getCode(), e.getMsg(), callback); |
| | | } |
| | | }); |
| | | |
| | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (callback != null) { |
| | | uniCallbackData(null, e.getCode(), e.getMessage(), callback); |
| | | uniCallbackData(null, e.getCode(), e.getMsg(), callback); |
| | | } |
| | | } |
| | | }); |
| | |
| | | package com.hdl.photovoltaic.ui; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | |
| | | import android.Manifest; |
| | | import android.content.Intent; |
| | | import android.content.pm.PackageManager; |
| | | import android.os.Bundle; |
| | | |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.utils.PermissionUtils; |
| | | import com.hdl.photovoltaic.base.CustomBaseActivity; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlResidenceLogic; |
| | | import com.hdl.photovoltaic.ui.bean.HouseIdBean; |
| | | |
| | | public class StartActivity extends AppCompatActivity { |
| | | import java.util.List; |
| | | |
| | | public class StartActivity extends CustomBaseActivity { |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | public Object getContentView() { |
| | | return R.layout.activity_start; |
| | | } |
| | | |
| | | setContentView(R.layout.activity_start); |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | |
| | | if (UserConfigManage.getInstance().isAutoLogin()) { |
| | | // showLoading(); |
| | | HdlResidenceLogic.getInstance().getResidenceIdList("", "", new CloudCallBeak<List<HouseIdBean>>() { |
| | | @Override |
| | | public void onSuccess(List<HouseIdBean> obj) { |
| | | // hideLoading(); |
| | | HdlResidenceLogic.getInstance().setHouseIdList(obj); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, MyPowerStationActivity.class); |
| | | startActivity(intent); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | // hideLoading(); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, MyPowerStationActivity.class); |
| | | startActivity(intent); |
| | | finish(); |
| | | } |
| | | }); |
| | | |
| | | } else { |
| | | Intent intent = new Intent(); |
| | | intent.setClass(this, HomeLoginActivity.class); |
| | | startActivity(intent); |
| | | finish(); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | package com.hdl.photovoltaic.ui.adapter; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.Bitmap; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.appcompat.content.res.AppCompatResources; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import com.bumptech.glide.load.resource.bitmap.RoundedCorners; |
| | |
| | | public class HouseInfoAdapter extends RecyclerView.Adapter<HouseInfoAdapter.MyViewHolder> { |
| | | |
| | | private List<HouseIdBean> mList; |
| | | private Context mContext; |
| | | private final Context mContext; |
| | | private OnclickListener noOnclickListener;//点击了的监听器 |
| | | |
| | | public HouseInfoAdapter(List<HouseIdBean> list, Context context) { |
| | |
| | | |
| | | @Override |
| | | public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { |
| | | |
| | | HouseIdBean houseIdBean = this.mList.get(position); |
| | | holder.homeNameTv.setText(houseIdBean.getHomeName()); |
| | | //装机容量 |
| | | String capacity = mContext.getString(R.string.my_power_station_installed_capacity) + houseIdBean.getInstalledCapacity(); |
| | | holder.capacityTv.setText(capacity); |
| | | //发电功率 |
| | | String power = mContext.getString(R.string.power_station_generated_power) + houseIdBean.getPower(); |
| | | holder.powerTv.setText(power); |
| | | setTextViewStyle(holder.stateTv, houseIdBean.getPowerStationStatus()); |
| | | GlideUtils.getRoundedCornersImage(mContext, houseIdBean.getPowerStationImage(), holder.homeIconIv, new RoundedCorners(4)); |
| | | holder.itemView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | |
| | | this.noOnclickListener = onclickListener; |
| | | } |
| | | |
| | | /** |
| | | * 改变组件样式 |
| | | * @param textView 显示组件 |
| | | * @param state_value 电站状态(1:正常(运行),2:离线,3:连接中,4:故障) |
| | | */ |
| | | private void setTextViewStyle(TextView textView, int state_value) { |
| | | String text = mContext.getString(R.string.my_power_station_operation); |
| | | Drawable drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_06b92a); |
| | | switch (state_value) { |
| | | case 1: { |
| | | text = mContext.getString(R.string.my_power_station_operation); |
| | | |
| | | } |
| | | break; |
| | | case 2: { |
| | | text = mContext.getString(R.string.my_power_station_off_line); |
| | | drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_b9b9b9); |
| | | } |
| | | break; |
| | | case 3: { |
| | | text = mContext.getString(R.string.my_power_station_connecting); |
| | | drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300); |
| | | } |
| | | break; |
| | | case 4: { |
| | | text = mContext.getString(R.string.my_power_station_malfunction); |
| | | drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_e34343); |
| | | } |
| | | break; |
| | | } |
| | | textView.setText(text); |
| | | textView.setBackground(drawable); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 一行布局容器 |
| | | */ |
| | | static class MyViewHolder extends RecyclerView.ViewHolder { |
| | | |
| | | public ImageView homeIconIv;//住宅图片 |
New file |
| | |
| | | package com.hdl.photovoltaic.ui.bean; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * B端用户详情实体类 |
| | | */ |
| | | public class BUserInfo implements Serializable { |
| | | private String userId;//用户ID |
| | | private String userName;//用户名称 |
| | | private String companyId;//公司id |
| | | private String companyName;//公司名称 |
| | | |
| | | public String getUserId() { |
| | | return userId == null ? "" : userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | /** |
| | | * 用户名称 |
| | | * @return - |
| | | */ |
| | | public String getUserName() { |
| | | return userName == null ? "" : userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getCompanyId() { |
| | | return companyId == null ? "" : getCompanyId(); |
| | | } |
| | | |
| | | public void setCompanyId(String companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public String getCompanyName() { |
| | | return companyName == null ? "" : getCompanyName(); |
| | | } |
| | | |
| | | public void setCompanyName(String companyName) { |
| | | this.companyName = companyName; |
| | | } |
| | | } |
New file |
| | |
| | | package com.hdl.photovoltaic.ui.bean; |
| | | |
| | | import android.text.TextUtils; |
| | | |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * C端用户详情实体类 |
| | | */ |
| | | public class CUserInfo implements Serializable { |
| | | |
| | | private String memberId;//用户ID |
| | | private String memberName;//用户名称 |
| | | private String memberPhone;//用户手机号 |
| | | private String memberEmail;//用户邮箱号 |
| | | private String languageType;//语言 |
| | | private String memberHeadIcon;//用户头像 |
| | | private String memberBirthday;//生日 |
| | | private String loginName;//账号 |
| | | private String memberSex;//性别 |
| | | private String region; |
| | | private String createTime; |
| | | private String appCode; |
| | | private String lastLoginTime; |
| | | |
| | | public String getMemberId() { |
| | | return memberId == null ? "" : memberId; |
| | | } |
| | | |
| | | public void setMemberId(String memberId) { |
| | | this.memberId = memberId; |
| | | } |
| | | |
| | | /** |
| | | * 用户名称 |
| | | * |
| | | * @return - |
| | | */ |
| | | public String getMemberName() { |
| | | return TextUtils.isEmpty(memberName) ? UserConfigManage.getInstance().getAccount() : memberName; |
| | | } |
| | | |
| | | public void setMemberName(String memberName) { |
| | | this.memberName = memberName; |
| | | } |
| | | |
| | | |
| | | public String getMemberPhone() { |
| | | return memberPhone == null ? "" : memberPhone; |
| | | } |
| | | |
| | | public void setMemberPhone(String memberPhone) { |
| | | this.memberPhone = memberPhone; |
| | | } |
| | | |
| | | public String getMemberEmail() { |
| | | return memberEmail == null ? "" : memberEmail; |
| | | } |
| | | |
| | | public void setMemberEmail(String memberEmail) { |
| | | this.memberEmail = memberEmail; |
| | | } |
| | | |
| | | public String getLanguageType() { |
| | | return languageType == null ? "" : languageType; |
| | | } |
| | | |
| | | public void setLanguageType(String languageType) { |
| | | this.languageType = languageType; |
| | | } |
| | | |
| | | public String getMemberHeadIcon() { |
| | | return memberHeadIcon == null ? "" : memberHeadIcon; |
| | | } |
| | | |
| | | public void setMemberHeadIcon(String memberHeadIcon) { |
| | | this.memberHeadIcon = memberHeadIcon; |
| | | } |
| | | |
| | | public String getMemberBirthday() { |
| | | return memberBirthday == null ? "" : memberBirthday; |
| | | } |
| | | |
| | | public void setMemberBirthday(String memberBirthday) { |
| | | this.memberBirthday = memberBirthday; |
| | | } |
| | | |
| | | public String getLoginName() { |
| | | return loginName == null ? "" : loginName; |
| | | } |
| | | |
| | | public void setLoginName(String loginName) { |
| | | this.loginName = loginName; |
| | | } |
| | | |
| | | public String getMemberSex() { |
| | | return memberSex == null ? "" : memberSex; |
| | | } |
| | | |
| | | public void setMemberSex(String memberSex) { |
| | | this.memberSex = memberSex; |
| | | } |
| | | |
| | | public String getRegion() { |
| | | return region == null ? "" : region; |
| | | } |
| | | |
| | | public void setRegion(String region) { |
| | | this.region = region; |
| | | } |
| | | |
| | | public String getCreateTime() { |
| | | return createTime == null ? "" : createTime; |
| | | } |
| | | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getAppCode() { |
| | | return appCode == null ? "" : appCode; |
| | | } |
| | | |
| | | public void setAppCode(String appCode) { |
| | | this.appCode = appCode; |
| | | } |
| | | |
| | | public String getLastLoginTime() { |
| | | return lastLoginTime == null ? "" : lastLoginTime; |
| | | } |
| | | |
| | | public void setLastLoginTime(String lastLoginTime) { |
| | | this.lastLoginTime = lastLoginTime; |
| | | } |
| | | } |
| | |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 云端上逆变器子设备实体类 |
| | | */ |
| | | public class CloudInverterChildDeviceBean implements Serializable { |
| | | |
| | | private String deviceOidId;//设备Oid id |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 云端逆变器实体类 |
| | | */ |
| | | public class CloudInverterDeviceBean implements Serializable { |
| | | |
| | | |
| | |
| | | |
| | | private String hwVersion;//软件版本号 |
| | | private String categorySecondName;//设备类型(产品二级分类名称) |
| | | |
| | | |
| | | |
| | | public String getSystemStatusDesc() { |
| | |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 逆变器时间实体类 |
| | | */ |
| | | public class DeviceTimeBean implements Serializable { |
| | | |
| | | private String date; |
| | |
| | | package com.hdl.photovoltaic.ui.bean; |
| | | |
| | | import com.hdl.photovoltaic.R; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 电站Id实体类 |
| | | */ |
| | | public class HouseIdBean implements Serializable { |
| | | private String homeId;//电站id |
| | | private String powerStationImage;//电站图片 |
| | |
| | | public void setPowerStationStatus(int powerStationStatus) { |
| | | this.powerStationStatus = powerStationStatus; |
| | | } |
| | | |
| | | public String getLocalSecret() { |
| | | return localSecret == null ? "" : localSecret; |
| | | } |
| | |
| | | this.localSecret = localSecret; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.hdl.photovoltaic.ui.bean; |
| | | |
| | | /** |
| | | * 电站详情实体类 |
| | | */ |
| | | public class HouseInfoBean extends HouseIdBean { |
| | | private Location location;//电站地址 |
| | | private String address;//详细地址 |
| | |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 登录实体类 |
| | | */ |
| | | public class LoginUserBean implements Serializable { |
| | | /// 用户有效身份Token(不用记录什么有效期,如果登陆失败,就拿RefreshToken去刷新) |
| | | private String accessToken; |
| | |
| | | |
| | | import androidx.appcompat.content.res.AppCompatResources; |
| | | |
| | | import android.graphics.drawable.Drawable; |
| | | import android.os.Bundle; |
| | | import android.text.Editable; |
| | | import android.text.TextUtils; |
| | |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlAccountLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.widget.FlashingBoxDialog; |
| | | |
| | | /** |
| | | * 我的-修改密码-界面 |
| | |
| | | String newPsw = viewBinding.meChangePasswordNewIc.mePswEt.getText().toString().replaceAll(" +", ""); |
| | | String affirmPsw = viewBinding.meChangePasswordAffirmIc.mePswEt.getText().toString().replaceAll(" +", ""); |
| | | if (!isEditTextPassword(newPsw, affirmPsw)) { |
| | | tipFlashingBox(AppCompatResources.getDrawable(_mActivity, R.drawable.tip_fail), getString(R.string.home_login_input_unlike_psw), -1); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_input_unlike_psw), -1); |
| | | return; |
| | | } |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | |
| | | HdlAccountLogic.getInstance().updateBPassword(oldPsw, newPsw, new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String str) { |
| | | tipFlashingBox(AppCompatResources.getDrawable(_mActivity, R.drawable.tip_succeed), getString(R.string.home_login_pws_reset_succeeded), 0); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_pws_reset_succeeded), 0); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | tipFlashingBox(AppCompatResources.getDrawable(_mActivity, R.drawable.tip_fail), e.getMsg(), e.getCode()); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, false, e.getMsg(), e.getCode()); |
| | | } |
| | | }); |
| | | } else { |
| | |
| | | HdlAccountLogic.getInstance().updateCPassword(oldPsw, newPsw, new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String obj) { |
| | | tipFlashingBox(AppCompatResources.getDrawable(_mActivity, R.drawable.tip_succeed), getString(R.string.home_login_pws_reset_succeeded), 0); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_pws_reset_succeeded), 0); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | tipFlashingBox(AppCompatResources.getDrawable(_mActivity, R.drawable.tip_fail), e.getMsg(), e.getCode()); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, false, e.getMsg(), e.getCode()); |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 提示框 |
| | | * |
| | | * @param drawable 图标 |
| | | * @param msg 信息 |
| | | * @param code 状态 |
| | | */ |
| | | private void tipFlashingBox(Drawable drawable, String msg, int code) { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | FlashingBoxDialog flashingBoxDialog = new FlashingBoxDialog(_mActivity); |
| | | flashingBoxDialog.setImage(drawable); |
| | | flashingBoxDialog.setContent(msg + "\r\n(" + code + ")"); |
| | | flashingBoxDialog.show(); |
| | | } |
| | | }, null, null); |
| | | } |
| | | |
| | | /** |
| | | * 初始化 |
| | | */ |
| | | private void initView() { |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBarView.setBackgroundColor(getResources().getColor(R.color.text_FFFFFFFF)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBarView.setBackgroundColor(getResources().getColor(R.color.text_FFFFFFFF,null)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setText(R.string.home_login_change_password); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setTextColor(getResources().getColor(R.color.text_030D1C)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setTextColor(getResources().getColor(R.color.text_030D1C,null)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setVisibility(View.VISIBLE); |
| | | viewBinding.meChangePasswordOldIc.mePswTitleTv.setText(R.string.home_login_old_pws); |
| | | viewBinding.meChangePasswordOldIc.mePswEt.setHint(R.string.home_login_input_old_pws); |
| | |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | |
| | | |
| | | import com.bumptech.glide.load.resource.bitmap.RoundedCorners; |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.base.CustomBaseFragment; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.databinding.FragmentMeBinding; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlAccountLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.ui.bean.BUserInfo; |
| | | import com.hdl.photovoltaic.ui.bean.CUserInfo; |
| | | import com.hdl.photovoltaic.utils.GlideUtils; |
| | | |
| | | /** |
| | | * 我的-界面 |
| | | */ |
| | | public class MeFragment extends CustomBaseFragment { |
| | | private FragmentMeBinding viewBinding; |
| | | |
| | | |
| | | @Override |
| | | public Object getContentView() { |
| | |
| | | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | |
| | | |
| | | //初始化 |
| | | initView(); |
| | | //初始化界面监听器 |
| | | initEvent(); |
| | | //初始化数据 |
| | | initData(); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 初始化数据 |
| | | */ |
| | | private void initData() { |
| | | // showLoading(); |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | | this.getBUserInfo(); |
| | | } else { |
| | | this.getCMemberInfo(); |
| | | } |
| | | } |
| | | |
| | | private void initEvent() { |
| | | |
| | | /** |
| | | * 获取C端个人信息 |
| | | */ |
| | | private void getCMemberInfo() { |
| | | |
| | | HdlAccountLogic.getInstance().getMemberInfo(new CloudCallBeak<CUserInfo>() { |
| | | @Override |
| | | public void onSuccess(CUserInfo cUserInfo) { |
| | | // hideLoading(); |
| | | //获取用户头像路径 |
| | | if (cUserInfo.getMemberHeadIcon().contains("http")) { |
| | | updateView(null, cUserInfo); |
| | | } else { |
| | | HdlAccountLogic.getInstance().getImageKey(cUserInfo.getMemberHeadIcon(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String url) { |
| | | cUserInfo.setMemberHeadIcon(url); |
| | | updateView(null, cUserInfo); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | updateView(null, cUserInfo); |
| | | HdlThreadLogic.toast(_mActivity, e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | // hideLoading(); |
| | | HdlThreadLogic.toast(_mActivity, e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 获取B端个人信息 |
| | | */ |
| | | private void getBUserInfo() { |
| | | |
| | | HdlAccountLogic.getInstance().getUserInfo(new CloudCallBeak<BUserInfo>() { |
| | | @Override |
| | | public void onSuccess(BUserInfo bUserInfo) { |
| | | // hideLoading(); |
| | | updateView(bUserInfo, null); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | // hideLoading(); |
| | | HdlThreadLogic.toast(_mActivity, e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 注册监听器 |
| | | */ |
| | | private void initEvent() { |
| | | viewBinding.fragmentMeLineSetIl.fragmentMeLineRightIconClickIv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 更新ui |
| | | * |
| | | * @param bUserInfo B端个人信息 |
| | | * @param cUserInfo C端个人信息 |
| | | */ |
| | | private void updateView(BUserInfo bUserInfo, CUserInfo cUserInfo) { |
| | | if (viewBinding == null) { |
| | | return; |
| | | } |
| | | String userName = UserConfigManage.getInstance().getUserName(); |
| | | if (bUserInfo != null) { |
| | | //B端 |
| | | userName = bUserInfo.getUserName(); |
| | | } |
| | | if (cUserInfo != null) { |
| | | //C端 |
| | | userName = cUserInfo.getMemberName(); |
| | | GlideUtils.getRoundedCornersImage(_mActivity, cUserInfo.getMemberHeadIcon(), viewBinding.fragmentMeIconIv, new RoundedCorners(4)); |
| | | } |
| | | viewBinding.fragmentMeUserNameIv.setText(userName); |
| | | UserConfigManage.getInstance().setUserName(userName); |
| | | UserConfigManage.getInstance().Save(); |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | //更新用户名称 |
| | | updateView(null, null); |
| | | } |
| | | |
| | | /** |
| | | * 初始化界面 |
| | | */ |
| | | private void initView() { |
| | | viewBinding.toolbarTopFragmentMeRl.topTitleTv.setText(R.string.power_station_me); |
| | | viewBinding.toolbarTopFragmentMeRl.topMoreIv.setVisibility(View.VISIBLE); |
| | |
| | | viewBinding.fragmentMeLineAsregardsIl.fragmentMeLineLeftIconIv.setImageResource(R.drawable.asregards); |
| | | viewBinding.fragmentMeLineAsregardsIl.fragmentMeLineTitleIv.setText(R.string.me_regard); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | |
| | | import com.hdl.linkpm.sdk.HDLLinkPMSdk; |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.linkpm.sdk.user.HDLLinkPMUser; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.base.CustomBaseActivity; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.databinding.ActivitySetBinding; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlAccountLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.widget.ConfirmationInputDialog; |
| | | |
| | | /** |
| | |
| | | |
| | | private void initView() { |
| | | viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setText(R.string.me_set); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setTextColor(getResources().getColor(R.color.text_030D1C)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setTextColor(getResources().getColor(R.color.text_030D1C,null)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setVisibility(View.VISIBLE); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBarView.setBackgroundColor(getResources().getColor(R.color.text_FFFFFFFF)); |
| | | viewBinding.toolbarTopFragmentHouseListRl.topBarView.setBackgroundColor(getResources().getColor(R.color.text_FFFFFFFF,null)); |
| | | viewBinding.setNicknameIl.sllLlRlNameTv.setText(R.string.set_nickname); |
| | | viewBinding.setChangePasswordIl.sllLlRlNameTv.setText(R.string.home_login_change_password); |
| | | viewBinding.setCloseAccountIl.sllLlRlNameTv.setText(R.string.set_close_account); |
| | |
| | | viewBinding.setNicknameIl.sllLlNameRl.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | } else { |
| | | ConfirmationInputDialog confirmationInputDialog = new ConfirmationInputDialog(_mActivity); |
| | | confirmationInputDialog.setTitle(getString(R.string.set_nickname_modification)); |
| | | confirmationInputDialog.setEditContent(UserConfigManage.getInstance().getAccount()); |
| | | confirmationInputDialog.setEditContent(UserConfigManage.getInstance().getUserName()); |
| | | confirmationInputDialog.show(); |
| | | |
| | | confirmationInputDialog.setYesOnclickListener(new ConfirmationInputDialog.onYesOnclickListener() { |
| | | @Override |
| | | public void Confirm(String str) { |
| | | HdlAccountLogic.getInstance().updateMemberInfo("", str, "", "", "", "", new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | UserConfigManage.getInstance().setUserName(str); |
| | | UserConfigManage.getInstance().Save(); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_change_name_succeed),0); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, false, e.getMessage(), e.getCode()); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }); |
| | |
| | | import com.hdl.photovoltaic.base.CustomBaseFragment; |
| | | import com.hdl.photovoltaic.databinding.FragmentMessageBinding; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public class MessageFragment extends CustomBaseFragment { |
| | | |
| | | private FragmentMessageBinding viewBinding; |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <set xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <alpha |
| | | |
| | | android:duration="300" |
| | | android:fromAlpha="1.0" |
| | | android:toAlpha="0" /> |
| | | <!-- <translate--> |
| | | <!-- android:fromXDelta="0"--> |
| | | <!-- android:toXDelta="100%p"--> |
| | | <!-- android:duration="300"--> |
| | | <!-- android:interpolator="@android:anim/accelerate_interpolator"--> |
| | | <!-- />--> |
| | | </set> |
| | | |
| | | |
| | | |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <set xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <alpha |
| | | |
| | | android:duration="300" |
| | | android:fromAlpha="1.0" |
| | | android:toAlpha="0" /> |
| | | <!-- <translate--> |
| | | <!-- android:fromXDelta="0"--> |
| | | <!-- android:toXDelta="100%p"--> |
| | | <!-- android:duration="300"--> |
| | | <!-- android:interpolator="@android:anim/accelerate_interpolator"--> |
| | | <!-- />--> |
| | | </set> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <set xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <alpha |
| | | android:duration="300" |
| | | android:fromAlpha="0" |
| | | android:toAlpha="1.0" /> |
| | | <translate |
| | | android:duration="300" |
| | | android:fromXDelta="100%p" |
| | | android:interpolator="@android:anim/accelerate_interpolator" |
| | | android:toXDelta="0" /> |
| | | </set> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <set xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <alpha |
| | | |
| | | android:duration="300" |
| | | android:fromAlpha="0.0" |
| | | android:toAlpha="1.0" /> |
| | | <!-- <translate--> |
| | | <!-- android:fromXDelta="0"--> |
| | | <!-- android:toXDelta="100%p"--> |
| | | <!-- android:duration="300"--> |
| | | <!-- android:interpolator="@android:anim/accelerate_interpolator"--> |
| | | |
| | | <!-- />--> |
| | | </set> |
| | |
| | | android:layout_width="@dimen/dp_36" |
| | | android:layout_height="@dimen/dp_36" |
| | | android:layout_marginTop="@dimen/dp_28" |
| | | android:background="@drawable/tip_fail" |
| | | app:layout_constraintEnd_toEndOf="@id/tip_parent_cl" |
| | | app:layout_constraintStart_toStartOf="@id/tip_parent_cl" |
| | | app:layout_constraintTop_toTopOf="@id/tip_parent_cl" /> |
| | |
| | | android:layout_width="69dp" |
| | | android:layout_height="69dp" |
| | | android:layout_marginTop="@dimen/dp_39" |
| | | android:background="@color/text_D34545" |
| | | android:background="@drawable/default_user" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toBottomOf="@+id/toolbar_top_fragment_me_rl" /> |
| | |
| | | |
| | | <RelativeLayout |
| | | android:id="@+id/fragment_house_list_line_parent_rl" |
| | | |
| | | android:layout_width="0dp" |
| | | android:layout_height="130dp" |
| | | android:layout_alignParentStart="true" |
| | |
| | | <TextView |
| | | android:id="@+id/fragment_house_list_line_power_tv" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="@dimen/dp_17" |
| | | android:layout_height="wrap_content" |
| | | android:layout_below="@+id/fragment_house_list_line_capacity_tv" |
| | | android:layout_alignStart="@+id/fragment_house_list_line_capacity_tv" |
| | | android:layout_marginTop="@dimen/dp_13" |
| | |
| | | <string name="home_login_input_old_pws">请输入原密码</string> |
| | | <string name="home_login_input_new_pws">请输入新密码</string> |
| | | <string name="home_login_input_affirm_psw">请再次输入新密码</string> |
| | | <string name="home_login_input_unlike_psw">新密码和再次确认密码不一致.</string> |
| | | <string name="home_login_input_unlike_psw">新密码和确认密码不一致.</string> |
| | | <string name="home_login_change_name_succeed">修改备注成功.</string> |
| | | |
| | | |
| | | |
| | |
| | | <string name="power_station">电站</string> |
| | | <string name="power_station_me">我的</string> |
| | | <string name="my_power_station">我的电站</string> |
| | | <string name="power_station_generated_power">发电功率</string> |
| | | <string name="power_station_generated_power">发电功率:</string> |
| | | <string name="power_station_Power_generation_today">今日发电</string> |
| | | <string name="power_station_creation_time">创建时间</string> |
| | | <string name="my_power_station_installed_capacity">装机容量</string> |
| | | <string name="my_power_station_installed_capacity">装机容量:</string> |
| | | <string name="my_power_station_connecting">连接中</string> |
| | | <string name="my_power_station_off_line">离线</string> |
| | | <string name="my_power_station_malfunction">故障</string> |
| | |
| | | <!-- <item name="android:windowBackground">@drawable/dia_bg</item>:设置dialog的背景--> |
| | | </style> |
| | | |
| | | <style name="DCloudMPHostActivityTheme" parent="@style/Theme.AppCompat"> |
| | | <item name="android:windowAnimationStyle">@style/uniMPHostWindowAnimation</item> |
| | | </style> |
| | | |
| | | </resources> |