更新res资源,和新模块2
This commit is contained in:
@@ -19,7 +19,7 @@ public class AppConfig {
|
|||||||
|
|
||||||
/**************************本地*******************************/
|
/**************************本地*******************************/
|
||||||
// public static String BASE_URL = "https://ragged-parting-unrushed.ngrok-free.dev/";//测试
|
// public static String BASE_URL = "https://ragged-parting-unrushed.ngrok-free.dev/";//测试
|
||||||
public static String BASE_URL = "http://192.168.0.196:8080/";//测试
|
public static String BASE_URL = "http://192.168.0.212:8080/";//测试
|
||||||
public static String BASE_URL_TWO = BASE_URL;//测试
|
public static String BASE_URL_TWO = BASE_URL;//测试
|
||||||
public static String BASE_URL_THREE = BASE_URL;//测试
|
public static String BASE_URL_THREE = BASE_URL;//测试
|
||||||
public static boolean IS_TEST_REQUEST = true;
|
public static boolean IS_TEST_REQUEST = true;
|
||||||
@@ -45,6 +45,10 @@ public class AppConfig {
|
|||||||
public final static boolean APP_TEST_FLAG = true;
|
public final static boolean APP_TEST_FLAG = true;
|
||||||
//App权限验证码
|
//App权限验证码
|
||||||
public static String APP_ENTER_CODE = "";
|
public static String APP_ENTER_CODE = "";
|
||||||
|
/** 代理商 App 固定客户端标识,登录请求与 clientid 头保持一致 */
|
||||||
|
public static final String CLIENT_ID = "df7190e91d4bcad0932b649e941c8e47";
|
||||||
|
/** 密码登录授权类型 */
|
||||||
|
public static final String GRANT_TYPE_PASSWORD = "password";
|
||||||
public static String USER_TOKEN = "";
|
public static String USER_TOKEN = "";
|
||||||
public static int MEMBER_ID = 0;
|
public static int MEMBER_ID = 0;
|
||||||
//是否登录
|
//是否登录
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import com.ckkj.griddlebiz.main.MainImpl;
|
|||||||
import com.ckkj.griddlebiz.main.MainPresenter;
|
import com.ckkj.griddlebiz.main.MainPresenter;
|
||||||
import com.ckkj.griddlebiz.main.activity.MainActivity;
|
import com.ckkj.griddlebiz.main.activity.MainActivity;
|
||||||
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.HomeEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.SummaryEntity;
|
||||||
import com.ckkj.griddlebiz.base.WebviewUserAgreement;
|
import com.ckkj.griddlebiz.base.WebviewUserAgreement;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
import com.ckkj.griddlebiz.utils.dataUtil.SharePreUtil;
|
import com.ckkj.griddlebiz.utils.dataUtil.SharePreUtil;
|
||||||
@@ -94,7 +96,7 @@ public class LaunchActivity extends BaseActivity<GuideLayoutBinding, MainPresent
|
|||||||
if(AppConfig.USER_LOGIN && !TextUtils.isEmpty(AppConfig.USER_TOKEN)){
|
if(AppConfig.USER_LOGIN && !TextUtils.isEmpty(AppConfig.USER_TOKEN)){
|
||||||
goTo(mContext, MainActivity.class, null);
|
goTo(mContext, MainActivity.class, null);
|
||||||
}else{
|
}else{
|
||||||
Intent intent = new Intent(mContext, MainActivity.class);
|
Intent intent = new Intent(mContext, LoginActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
@@ -167,4 +169,20 @@ public class LaunchActivity extends BaseActivity<GuideLayoutBinding, MainPresent
|
|||||||
public void getUserInfoSuccess(MineUserInfoBean bean) {
|
public void getUserInfoSuccess(MineUserInfoBean bean) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动页不展示首页聚合数据,仅实现契约方法
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void getHomeSuccess(HomeEntity home) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动页不展示经营统计,仅实现契约方法
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void getStatisticsSuccess(SummaryEntity summary) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,20 +5,87 @@ import com.ckkj.griddlebiz.base.entity.UserInfoEntity;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author fengxiaoyang
|
* 登录响应(文档 2.1 LoginVo)。
|
||||||
* @date 2025/7/28
|
* 同时保留旧字段,兼容历史本地缓存。
|
||||||
* @description TODO: 描述该类的作用
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class LoginEntity implements Serializable {
|
public class LoginEntity implements Serializable {
|
||||||
// 新登录接口只返回 token;保留旧字段以兼容已有本地缓存。
|
|
||||||
private String token;
|
|
||||||
private String access_token;
|
|
||||||
private UserInfoEntity user_info;
|
|
||||||
private long expires_in;
|
|
||||||
|
|
||||||
|
/** 访问令牌,后续请求放在 Authorization: Bearer 中 */
|
||||||
|
private String access_token;
|
||||||
|
/** 刷新令牌,本 App 依赖滑动续期,暂不使用 */
|
||||||
|
private String refresh_token;
|
||||||
|
/** access_token 有效期(秒) */
|
||||||
|
private long expire_in;
|
||||||
|
/** refresh_token 有效期(秒) */
|
||||||
|
private long refresh_expire_in;
|
||||||
|
/** 客户端标识 */
|
||||||
|
private String client_id;
|
||||||
|
/** 权限范围 */
|
||||||
|
private String scope;
|
||||||
|
/** 用户 openid */
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/** 兼容旧接口与旧缓存 */
|
||||||
|
private String token;
|
||||||
|
private UserInfoEntity user_info;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新接口返回 access_token,旧缓存可能只有 token。
|
||||||
|
*/
|
||||||
public String getAccess_token() {
|
public String getAccess_token() {
|
||||||
return token != null && !token.isEmpty() ? token : access_token;
|
return access_token != null && !access_token.isEmpty() ? access_token : token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccess_token(String access_token) {
|
||||||
|
this.access_token = access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRefresh_token() {
|
||||||
|
return refresh_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefresh_token(String refresh_token) {
|
||||||
|
this.refresh_token = refresh_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getExpire_in() {
|
||||||
|
return expire_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpire_in(long expire_in) {
|
||||||
|
this.expire_in = expire_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getRefresh_expire_in() {
|
||||||
|
return refresh_expire_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefresh_expire_in(long refresh_expire_in) {
|
||||||
|
this.refresh_expire_in = refresh_expire_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClient_id() {
|
||||||
|
return client_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClient_id(String client_id) {
|
||||||
|
this.client_id = client_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScope() {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScope(String scope) {
|
||||||
|
this.scope = scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpenid() {
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenid(String openid) {
|
||||||
|
this.openid = openid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToken() {
|
public String getToken() {
|
||||||
@@ -29,10 +96,6 @@ public class LoginEntity implements Serializable {
|
|||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccess_token(String access_token) {
|
|
||||||
this.access_token = access_token;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserInfoEntity getUser_info() {
|
public UserInfoEntity getUser_info() {
|
||||||
return user_info;
|
return user_info;
|
||||||
}
|
}
|
||||||
@@ -40,12 +103,4 @@ public class LoginEntity implements Serializable {
|
|||||||
public void setUser_info(UserInfoEntity user_info) {
|
public void setUser_info(UserInfoEntity user_info) {
|
||||||
this.user_info = user_info;
|
this.user_info = user_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getExpires_in() {
|
|
||||||
return expires_in;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExpires_in(long expires_in) {
|
|
||||||
this.expires_in = expires_in;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ public class LoginContract {
|
|||||||
// 手机号密码登录
|
// 手机号密码登录
|
||||||
void loginByPassword(JSONObject json, CallBack<LoginEntity> callBack);
|
void loginByPassword(JSONObject json, CallBack<LoginEntity> callBack);
|
||||||
|
|
||||||
|
// 退出登录
|
||||||
|
void logout(CallBack<BaseBean> callBack);
|
||||||
|
|
||||||
// 手机号注册
|
// 手机号注册
|
||||||
void register(JSONObject json, CallBack<BaseBean> callBack);
|
void register(JSONObject json, CallBack<BaseBean> callBack);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,22 @@ public class LoginImpl implements LoginContract.DataModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录(文档 2.2),请求头携带 token 与 clientid。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void logout(LoginContract.CallBack<BaseBean> callBack) {
|
||||||
|
try {
|
||||||
|
NetWorkManager.getRequest().logout(NetWorkManager.getToken())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.unsubscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(createAuthObserver(callBack));
|
||||||
|
} catch (Exception e) {
|
||||||
|
callBack.fail(getExceptionMessage(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 两种登录接口返回结构一致,统一处理 Token 和业务状态码
|
* 两种登录接口返回结构一致,统一处理 Token 和业务状态码
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.ckkj.griddlebiz.base.entity.UserInfoEntity;
|
|||||||
import com.ckkj.griddlebiz.login.entity.LoginEntity;
|
import com.ckkj.griddlebiz.login.entity.LoginEntity;
|
||||||
import com.ckkj.griddlebiz.base.repository.UserInfoRepository;
|
import com.ckkj.griddlebiz.base.repository.UserInfoRepository;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
|
import com.ckkj.griddlebiz.network.LoginStateManager;
|
||||||
import com.ckkj.griddlebiz.utils.dataUtil.SharePreUtil;
|
import com.ckkj.griddlebiz.utils.dataUtil.SharePreUtil;
|
||||||
import com.ckkj.griddlebiz.utils.manager.MingDengUserInfoManager;
|
import com.ckkj.griddlebiz.utils.manager.MingDengUserInfoManager;
|
||||||
|
|
||||||
@@ -133,15 +134,17 @@ public class LoginPresenter extends BasePresenter<LoginContract.LoginView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号密码登录
|
* 手机号密码登录(文档 2.1)
|
||||||
*
|
*
|
||||||
* @param phone 手机号
|
* @param phone 登录手机号
|
||||||
* @param password 登录密码
|
* @param password 登录密码
|
||||||
*/
|
*/
|
||||||
public void loginByPassword(String phone, String password) {
|
public void loginByPassword(String phone, String password) {
|
||||||
try {
|
try {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("phoneNumber", phone);
|
json.put("clientId", AppConfig.CLIENT_ID);
|
||||||
|
json.put("grantType", AppConfig.GRANT_TYPE_PASSWORD);
|
||||||
|
json.put("username", phone);
|
||||||
json.put("password", password);
|
json.put("password", password);
|
||||||
requestLogin(json, false);
|
requestLogin(json, false);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
@@ -171,8 +174,8 @@ public class LoginPresenter extends BasePresenter<LoginContract.LoginView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录成功后先保存会话,再异步加载用户资料。
|
* 登录成功后保存会话与本地登录状态。
|
||||||
* 资料加载失败不能撤销已经获得的 Token。
|
* 登录接口只返回 Token,资料由后续的个人资料接口单独获取。
|
||||||
*/
|
*/
|
||||||
private void handleLoginSuccess(LoginEntity entity) {
|
private void handleLoginSuccess(LoginEntity entity) {
|
||||||
if (entity == null || TextUtils.isEmpty(entity.getAccess_token())) {
|
if (entity == null || TextUtils.isEmpty(entity.getAccess_token())) {
|
||||||
@@ -208,12 +211,42 @@ public class LoginPresenter extends BasePresenter<LoginContract.LoginView> {
|
|||||||
saveLoginEntity(entity);
|
saveLoginEntity(entity);
|
||||||
|
|
||||||
EventBus.getDefault().post(new EventMessage(EventMessage.USER_LOGIN_SUCCESS));
|
EventBus.getDefault().post(new EventMessage(EventMessage.USER_LOGIN_SUCCESS));
|
||||||
getUserInfo();
|
// 登录接口只返回 Token,单位资料待接入文档 4.1 后再拉取
|
||||||
if (getView() != null) {
|
if (getView() != null) {
|
||||||
getView().loginSuccess(entity);
|
getView().loginSuccess(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录(文档 2.2):服务端注销成功后清理本地登录态。
|
||||||
|
*/
|
||||||
|
public void logout(LoginContract.CallBack<BaseBean> callBack) {
|
||||||
|
mImpl.logout(new LoginContract.CallBack<BaseBean>() {
|
||||||
|
@Override
|
||||||
|
public void success(BaseBean bean) {
|
||||||
|
clearLoginState();
|
||||||
|
if (callBack != null) {
|
||||||
|
callBack.success(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fail(String msg) {
|
||||||
|
if (callBack != null) {
|
||||||
|
callBack.fail(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空 Token、用户缓存与内存中的登录信息。
|
||||||
|
*/
|
||||||
|
private void clearLoginState() {
|
||||||
|
MingDengUserInfoManager.getInstance().clearUser(MyApplication.getContext());
|
||||||
|
LoginStateManager.reset();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询个人信息
|
* 查询个人信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.ckkj.griddlebiz.main;
|
|||||||
import com.ckkj.griddlebiz.base.IView;
|
import com.ckkj.griddlebiz.base.IView;
|
||||||
import com.ckkj.griddlebiz.base.entity.MineUserInfoBean;
|
import com.ckkj.griddlebiz.base.entity.MineUserInfoBean;
|
||||||
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.HomeEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.SummaryEntity;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@@ -15,6 +17,10 @@ public interface MainContract {
|
|||||||
void checkAppVersionCode(JSONObject json, CallBack callBack);
|
void checkAppVersionCode(JSONObject json, CallBack callBack);
|
||||||
//运势
|
//运势
|
||||||
void getYunshiData(Map<String,Object> map, CallBack callBack);
|
void getYunshiData(Map<String,Object> map, CallBack callBack);
|
||||||
|
//首页聚合(文档 3.1)
|
||||||
|
void getHome(CallBack<HomeEntity> callBack);
|
||||||
|
//经营统计(文档 3.2)
|
||||||
|
void getStatistics(CallBack<SummaryEntity> callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CallBack<T> {
|
interface CallBack<T> {
|
||||||
@@ -33,5 +39,9 @@ public interface MainContract {
|
|||||||
void getYunshiDataSuccess(BaseBean bean);
|
void getYunshiDataSuccess(BaseBean bean);
|
||||||
//获取个人信息成功
|
//获取个人信息成功
|
||||||
void getUserInfoSuccess(MineUserInfoBean bean);
|
void getUserInfoSuccess(MineUserInfoBean bean);
|
||||||
|
//首页聚合数据加载成功
|
||||||
|
void getHomeSuccess(HomeEntity home);
|
||||||
|
//经营统计加载成功,用于首页 Dashboard 面板
|
||||||
|
void getStatisticsSuccess(SummaryEntity summary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.ckkj.griddlebiz.main;
|
|||||||
|
|
||||||
|
|
||||||
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.HomeEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.SummaryEntity;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
import com.ckkj.griddlebiz.network.NetWorkManager;
|
import com.ckkj.griddlebiz.network.NetWorkManager;
|
||||||
|
|
||||||
@@ -59,6 +61,84 @@ public class MainImpl implements MainContract.DataModel{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页聚合(文档 3.1):单位资料、经营概况、未读消息与待激活设备。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void getHome(MainContract.CallBack<HomeEntity> callBack) {
|
||||||
|
try {
|
||||||
|
NetWorkManager.getRequest().getAgentHome(NetWorkManager.getToken())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.unsubscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<BaseBean<HomeEntity>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseBean<HomeEntity> bean) {
|
||||||
|
if (bean.getCode() == 200 && bean.getData() != null) {
|
||||||
|
callBack.success(bean.getData());
|
||||||
|
} else {
|
||||||
|
callBack.fail(bean.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
callBack.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
callBack.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经营统计(文档 3.2):首页 Dashboard 面板使用该接口刷新。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void getStatistics(MainContract.CallBack<SummaryEntity> callBack) {
|
||||||
|
try {
|
||||||
|
NetWorkManager.getRequest().getAgentStatistics(NetWorkManager.getToken())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.unsubscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<BaseBean<SummaryEntity>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseBean<SummaryEntity> bean) {
|
||||||
|
if (bean.getCode() == 200 && bean.getData() != null) {
|
||||||
|
callBack.success(bean.getData());
|
||||||
|
} else {
|
||||||
|
callBack.fail(bean.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
callBack.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
callBack.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getYunshiData(Map<String, Object> map, MainContract.CallBack callBack) {
|
public void getYunshiData(Map<String, Object> map, MainContract.CallBack callBack) {
|
||||||
// try {
|
// try {
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.ckkj.griddlebiz.base.BasePresenter;
|
|||||||
import com.ckkj.griddlebiz.base.entity.MineUserInfoBean;
|
import com.ckkj.griddlebiz.base.entity.MineUserInfoBean;
|
||||||
import com.ckkj.griddlebiz.login.mvp.LoginContract;
|
import com.ckkj.griddlebiz.login.mvp.LoginContract;
|
||||||
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.HomeEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.SummaryEntity;
|
||||||
import com.ckkj.griddlebiz.base.repository.UserInfoRepository;
|
import com.ckkj.griddlebiz.base.repository.UserInfoRepository;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
|
|
||||||
@@ -43,6 +45,48 @@ public class MainPresenter extends BasePresenter<MainContract.MainView> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页聚合数据(文档 3.1)
|
||||||
|
*/
|
||||||
|
public void getHome() {
|
||||||
|
mainImpl.getHome(new MainContract.CallBack<HomeEntity>() {
|
||||||
|
@Override
|
||||||
|
public void success(HomeEntity bean) {
|
||||||
|
if (MainPresenter.this.getView() != null) {
|
||||||
|
MainPresenter.this.getView().getHomeSuccess(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fail(String msg) {
|
||||||
|
if (MainPresenter.this.getView() != null) {
|
||||||
|
MainPresenter.this.getView().showError(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经营统计(文档 3.2),用于首页 Dashboard 面板
|
||||||
|
*/
|
||||||
|
public void getStatistics() {
|
||||||
|
mainImpl.getStatistics(new MainContract.CallBack<SummaryEntity>() {
|
||||||
|
@Override
|
||||||
|
public void success(SummaryEntity bean) {
|
||||||
|
if (MainPresenter.this.getView() != null) {
|
||||||
|
MainPresenter.this.getView().getStatisticsSuccess(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fail(String msg) {
|
||||||
|
if (MainPresenter.this.getView() != null) {
|
||||||
|
MainPresenter.this.getView().showError(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void getYunShiData() {
|
public void getYunShiData() {
|
||||||
Map<String,Object> map = new HashMap<>();
|
Map<String,Object> map = new HashMap<>();
|
||||||
map.put("content","生日:2002年4月28日 下午3点, 性别:男;根据八字命理帮我分析一下命理");
|
map.put("content","生日:2002年4月28日 下午3点, 性别:男;根据八字命理帮我分析一下命理");
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ckkj.griddlebiz.main.activity;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
@@ -22,6 +23,9 @@ import com.ckkj.griddlebiz.main.MainContract;
|
|||||||
import com.ckkj.griddlebiz.main.MainImpl;
|
import com.ckkj.griddlebiz.main.MainImpl;
|
||||||
import com.ckkj.griddlebiz.main.MainPresenter;
|
import com.ckkj.griddlebiz.main.MainPresenter;
|
||||||
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.HomeEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.ProfileEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.SummaryEntity;
|
||||||
import com.ckkj.griddlebiz.mine.MessageCenterActivity;
|
import com.ckkj.griddlebiz.mine.MessageCenterActivity;
|
||||||
import com.ckkj.griddlebiz.mine.MineCenterActivity;
|
import com.ckkj.griddlebiz.mine.MineCenterActivity;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
@@ -39,6 +43,7 @@ import com.gyf.immersionbar.ImmersionBar;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
@@ -86,17 +91,29 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
|
|||||||
.init();
|
.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
// 登录状态下每次回到首页都刷新聚合数据
|
||||||
|
if (AppConfig.USER_LOGIN && mPresenter != null) {
|
||||||
|
mPresenter.getHome();
|
||||||
|
// 经营统计单独刷新 Dashboard 面板(文档 3.2)
|
||||||
|
mPresenter.getStatistics();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initData(Bundle savedInstanceState) {
|
public void initData(Bundle savedInstanceState) {
|
||||||
super.initData(savedInstanceState);
|
super.initData(savedInstanceState);
|
||||||
mPresenter.checkNewVersion();
|
// 原版本检测走的是旧后端的 mobile/version,新代理商接口未提供该接口,
|
||||||
|
// 请求会返回 401 并触发“异地登录”弹窗,这里暂时不再调用。
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页各功能入口点击事件。
|
* 首页各功能入口点击事件。
|
||||||
*/
|
*/
|
||||||
@OnClick({R.id.fl_notifications, R.id.iv_company_profile, R.id.action_product_inbound,
|
@OnClick({R.id.fl_notifications, R.id.iv_company_profile, R.id.action_product_inbound,
|
||||||
R.id.action_product_management, R.id.action_statistics, R.id.action_after_sales,
|
R.id.action_product_management, R.id.action_statistics,
|
||||||
R.id.action_pickup_verification, R.id.feature_user_management,
|
R.id.action_pickup_verification, R.id.feature_user_management,
|
||||||
R.id.feature_user_guide})
|
R.id.feature_user_guide})
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -161,6 +178,68 @@ public class MainActivity extends BaseActivity<MainActivityLayoutBinding, MainPr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页聚合数据加载成功(文档 3.1)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void getHomeSuccess(HomeEntity home) {
|
||||||
|
if (home == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ProfileEntity profile = home.getProfile();
|
||||||
|
if (profile != null) {
|
||||||
|
if (!TextUtils.isEmpty(profile.getUnitName())) {
|
||||||
|
viewBinding.tvCompanyName.setText(profile.getUnitName());
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(profile.getRegion())) {
|
||||||
|
viewBinding.tvCompanyLocation.setText(profile.getRegion());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 未读消息为 0 时隐藏角标
|
||||||
|
long unread = home.getUnreadMessages();
|
||||||
|
if (unread > 0) {
|
||||||
|
viewBinding.tvNotificationCount.setVisibility(View.VISIBLE);
|
||||||
|
viewBinding.tvNotificationCount.setText(unread > 99 ? "99+" : String.valueOf(unread));
|
||||||
|
} else {
|
||||||
|
viewBinding.tvNotificationCount.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3.1 返回的概况先兜底展示,随后 3.2 会刷新同一面板
|
||||||
|
bindSummary(home.getSummary());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经营统计加载成功(文档 3.2),刷新首页 Dashboard 面板
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void getStatisticsSuccess(SummaryEntity summary) {
|
||||||
|
bindSummary(summary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将经营概况绑定到首页统计卡
|
||||||
|
*/
|
||||||
|
private void bindSummary(SummaryEntity summary) {
|
||||||
|
if (summary == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
viewBinding.tvTotalDevicesValue.setText(String.valueOf(summary.getTotalDevices()));
|
||||||
|
viewBinding.tvOnlineDevicesValue.setText(String.valueOf(summary.getOnline()));
|
||||||
|
viewBinding.tvActivatedValue.setText(String.valueOf(summary.getActivated()));
|
||||||
|
viewBinding.tvReductionValue.setText(formatDecimal(summary.getCarbonKg()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 去除 BigDecimal 多余的 0,空值按 0 展示
|
||||||
|
*/
|
||||||
|
private String formatDecimal(BigDecimal value) {
|
||||||
|
if (value == null) {
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
return value.stripTrailingZeros().toPlainString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutResId(Bundle savedInstanceState) {
|
public int getLayoutResId(Bundle savedInstanceState) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ckkj.griddlebiz.mine;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -9,10 +10,20 @@ import androidx.core.view.ViewCompat;
|
|||||||
import androidx.core.view.WindowCompat;
|
import androidx.core.view.WindowCompat;
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.ckkj.griddlebiz.AppConfig;
|
||||||
import com.ckkj.griddlebiz.R;
|
import com.ckkj.griddlebiz.R;
|
||||||
import com.ckkj.griddlebiz.base.BaseActivityNoP;
|
import com.ckkj.griddlebiz.base.BaseActivity;
|
||||||
import com.ckkj.griddlebiz.base.WebviewUserAgreement;
|
import com.ckkj.griddlebiz.base.WebviewUserAgreement;
|
||||||
import com.ckkj.griddlebiz.databinding.MineCenterLayoutBinding;
|
import com.ckkj.griddlebiz.databinding.MineCenterLayoutBinding;
|
||||||
|
import com.ckkj.griddlebiz.login.LoginActivity;
|
||||||
|
import com.ckkj.griddlebiz.login.mvp.LoginContract;
|
||||||
|
import com.ckkj.griddlebiz.login.mvp.LoginImpl;
|
||||||
|
import com.ckkj.griddlebiz.login.mvp.LoginPresenter;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.ProfileEntity;
|
||||||
|
import com.ckkj.griddlebiz.mine.mvp.MineContract;
|
||||||
|
import com.ckkj.griddlebiz.mine.mvp.MineImpl;
|
||||||
|
import com.ckkj.griddlebiz.mine.mvp.MinePresenter;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
import com.ckkj.griddlebiz.utils.show.ToastUtil;
|
import com.ckkj.griddlebiz.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
@@ -20,10 +31,19 @@ import com.gyf.immersionbar.ImmersionBar;
|
|||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人中心:渐变头部展示单位信息与地址,下方为设置入口列表。
|
* 个人中心:渐变头部展示单位资料,下方为设置入口列表。
|
||||||
* 单位名称、地址目前使用设计稿示例,后续接入单位信息接口时替换。
|
* 单位名称、地区与 logo 来自个人资料接口(文档 4.1)。
|
||||||
*/
|
*/
|
||||||
public class MineCenterActivity extends BaseActivityNoP<MineCenterLayoutBinding> {
|
public class MineCenterActivity extends BaseActivity<MineCenterLayoutBinding, MinePresenter>
|
||||||
|
implements MineContract.MineView {
|
||||||
|
|
||||||
|
/** 退出登录复用登录模块的 MVP 流程 */
|
||||||
|
private LoginPresenter mLogoutPresenter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MinePresenter createPresenter() {
|
||||||
|
return new MinePresenter(new MineImpl());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutResId(Bundle savedInstanceState) {
|
public int getLayoutResId(Bundle savedInstanceState) {
|
||||||
@@ -33,6 +53,7 @@ public class MineCenterActivity extends BaseActivityNoP<MineCenterLayoutBinding>
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
mLogoutPresenter = new LoginPresenter(new LoginImpl());
|
||||||
// 头部渐变需要延伸到状态栏,状态栏高度由 spacer 动态补齐
|
// 头部渐变需要延伸到状态栏,状态栏高度由 spacer 动态补齐
|
||||||
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
|
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
|
||||||
View root = viewBinding.getRoot();
|
View root = viewBinding.getRoot();
|
||||||
@@ -57,6 +78,15 @@ public class MineCenterActivity extends BaseActivityNoP<MineCenterLayoutBinding>
|
|||||||
.init();
|
.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
// 从单位信息页返回时重新拉取,保证头部资料实时更新
|
||||||
|
if (AppConfig.USER_LOGIN && mPresenter != null) {
|
||||||
|
mPresenter.getProfile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人中心点击事件。
|
* 个人中心点击事件。
|
||||||
*/
|
*/
|
||||||
@@ -87,16 +117,77 @@ public class MineCenterActivity extends BaseActivityNoP<MineCenterLayoutBinding>
|
|||||||
case R.id.card_about:
|
case R.id.card_about:
|
||||||
case R.id.card_service:
|
case R.id.card_service:
|
||||||
case R.id.card_manual:
|
case R.id.card_manual:
|
||||||
case R.id.tv_sign_out:
|
|
||||||
// 其余入口暂未接入
|
// 其余入口暂未接入
|
||||||
ToastUtil.showShort(mContext, R.string.mine_center_unavailable);
|
ToastUtil.showShort(mContext, R.string.mine_center_unavailable);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case R.id.tv_sign_out:
|
||||||
|
// 退出登录
|
||||||
|
logout();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人资料加载成功(文档 4.1)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void getProfileSuccess(ProfileEntity profile) {
|
||||||
|
if (profile == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(profile.getUnitName())) {
|
||||||
|
viewBinding.tvCompanyName.setText(profile.getUnitName());
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(profile.getRegion())) {
|
||||||
|
viewBinding.tvCompanyLocation.setText(profile.getRegion());
|
||||||
|
}
|
||||||
|
// 单位 logo 为完整地址时才展示,头像文件 ID 无法直接作为图片地址
|
||||||
|
String logo = profile.getUnitLogo();
|
||||||
|
if (!TextUtils.isEmpty(logo) && logo.startsWith("http")) {
|
||||||
|
Glide.with(this).load(logo).centerCrop().into(viewBinding.ivCompanyAvatar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateProfileSuccess() {
|
||||||
|
// 本页不涉及资料修改
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void uploadImageSuccess(long fileId) {
|
||||||
|
// 本页不涉及图片上传
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录:调用文档 2.2 接口,成功后清理本地登录态并回到登录页。
|
||||||
|
*/
|
||||||
|
private void logout() {
|
||||||
|
showLoadingDialog();
|
||||||
|
mLogoutPresenter.logout(new LoginContract.CallBack<BaseBean>() {
|
||||||
|
@Override
|
||||||
|
public void success(BaseBean bean) {
|
||||||
|
hideDialogLoading();
|
||||||
|
ToastUtil.showShort(mContext, R.string.mine_center_logout_success);
|
||||||
|
Intent intent = new Intent(mContext, LoginActivity.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fail(String msg) {
|
||||||
|
hideDialogLoading();
|
||||||
|
String message = (msg == null || msg.isEmpty())
|
||||||
|
? getString(R.string.mine_center_logout_failed) : msg;
|
||||||
|
ToastUtil.showShort(mContext, message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打开用户协议 / 隐私政策 WebView。
|
* 打开用户协议 / 隐私政策 WebView。
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package com.ckkj.griddlebiz.mine;
|
|||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -23,17 +23,24 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.ckkj.griddlebiz.AppConfig;
|
||||||
import com.ckkj.griddlebiz.R;
|
import com.ckkj.griddlebiz.R;
|
||||||
import com.ckkj.griddlebiz.base.BaseActivity;
|
import com.ckkj.griddlebiz.base.BaseActivity;
|
||||||
import com.ckkj.griddlebiz.base.IPresenter;
|
|
||||||
import com.ckkj.griddlebiz.databinding.DialogPhotoPickerBinding;
|
import com.ckkj.griddlebiz.databinding.DialogPhotoPickerBinding;
|
||||||
import com.ckkj.griddlebiz.databinding.MineInfomationLayoutBinding;
|
import com.ckkj.griddlebiz.databinding.MineInfomationLayoutBinding;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.ProfileEntity;
|
||||||
|
import com.ckkj.griddlebiz.mine.entity.ProfileBo;
|
||||||
|
import com.ckkj.griddlebiz.mine.mvp.MineContract;
|
||||||
|
import com.ckkj.griddlebiz.mine.mvp.MineImpl;
|
||||||
|
import com.ckkj.griddlebiz.mine.mvp.MinePresenter;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
import com.ckkj.griddlebiz.utils.show.ToastUtil;
|
import com.ckkj.griddlebiz.utils.show.ToastUtil;
|
||||||
import com.github.chrisbanes.photoview.PhotoView;
|
import com.github.chrisbanes.photoview.PhotoView;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
@@ -41,13 +48,24 @@ import pub.devrel.easypermissions.EasyPermissions;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 单位信息:维护单位基础资料、证照照片与公司简介。
|
* 单位信息:维护单位基础资料、证照照片与公司简介。
|
||||||
* 表单值目前使用设计稿示例,后续接入单位信息接口时替换。
|
* 资料来自个人资料接口(文档 4.1),图片选择后通过 4.5 上传,保存时提交 4.2。
|
||||||
*/
|
*/
|
||||||
public class MineInfomationActivity extends BaseActivity<MineInfomationLayoutBinding, IPresenter>
|
public class MineInfomationActivity
|
||||||
implements EasyPermissions.PermissionCallbacks {
|
extends BaseActivity<MineInfomationLayoutBinding, MinePresenter>
|
||||||
|
implements MineContract.MineView, EasyPermissions.PermissionCallbacks {
|
||||||
|
|
||||||
private static final int REQUEST_CAMERA_PHOTO = 0x150;
|
private static final int REQUEST_CAMERA_PHOTO = 0x150;
|
||||||
|
|
||||||
|
/** 上传位置,用于把 4.5 返回的文件 ID 写回对应资料字段 */
|
||||||
|
private static final int SLOT_NONE = -1;
|
||||||
|
private static final int SLOT_AVATAR = 0;
|
||||||
|
private static final int SLOT_LICENSE_1 = 1;
|
||||||
|
private static final int SLOT_LICENSE_2 = 2;
|
||||||
|
private static final int SLOT_PERMIT_1 = 3;
|
||||||
|
private static final int SLOT_PERMIT_2 = 4;
|
||||||
|
private static final int SLOT_ID_FRONT = 5;
|
||||||
|
private static final int SLOT_ID_BACK = 6;
|
||||||
|
|
||||||
private Dialog mPhotoDialog;
|
private Dialog mPhotoDialog;
|
||||||
private DialogPhotoPickerBinding mPhotoBinding;
|
private DialogPhotoPickerBinding mPhotoBinding;
|
||||||
|
|
||||||
@@ -56,15 +74,30 @@ public class MineInfomationActivity extends BaseActivity<MineInfomationLayoutBin
|
|||||||
private View mPendingPlaceholder;
|
private View mPendingPlaceholder;
|
||||||
/** 当前上传框容器,上传完成后去掉描边 */
|
/** 当前上传框容器,上传完成后去掉描边 */
|
||||||
private View mPendingContainer;
|
private View mPendingContainer;
|
||||||
|
/** 当前选择的图片位置 */
|
||||||
|
private int mPendingSlot = SLOT_NONE;
|
||||||
|
/** 正在上传的位置,失败时用于回滚预览 */
|
||||||
|
private int mUploadingSlot = SLOT_NONE;
|
||||||
|
|
||||||
/** 拍照临时文件地址 */
|
/** 拍照临时文件地址 */
|
||||||
private Uri mPhotoUri;
|
private Uri mPhotoUri;
|
||||||
|
|
||||||
|
/** 4.1 返回的资料,保存时用于保留页面未展示的字段 */
|
||||||
|
private ProfileEntity mProfile;
|
||||||
|
/** 头像 OSS 文件 ID */
|
||||||
|
private Long mAvatarId;
|
||||||
|
/** 营业执照、经营许可证各支持两张,按位置保存文件 ID */
|
||||||
|
private final String[] mLicenseIds = new String[]{"", ""};
|
||||||
|
private final String[] mPermitIds = new String[]{"", ""};
|
||||||
|
/** 身份证正反面文件 ID */
|
||||||
|
private String mIdFrontId = "";
|
||||||
|
private String mIdBackId = "";
|
||||||
|
|
||||||
/** 相机拍照结果 */
|
/** 相机拍照结果 */
|
||||||
private final ActivityResultLauncher<Uri> mCameraLauncher = registerForActivityResult(
|
private final ActivityResultLauncher<Uri> mCameraLauncher = registerForActivityResult(
|
||||||
new ActivityResultContracts.TakePicture(), success -> {
|
new ActivityResultContracts.TakePicture(), success -> {
|
||||||
if (success && mPhotoUri != null) {
|
if (success && mPhotoUri != null) {
|
||||||
showSelectedImage(mPhotoUri);
|
onImagePicked(mPhotoUri);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -72,13 +105,13 @@ public class MineInfomationActivity extends BaseActivity<MineInfomationLayoutBin
|
|||||||
private final ActivityResultLauncher<PickVisualMediaRequest> mGalleryLauncher =
|
private final ActivityResultLauncher<PickVisualMediaRequest> mGalleryLauncher =
|
||||||
registerForActivityResult(new ActivityResultContracts.PickVisualMedia(), uri -> {
|
registerForActivityResult(new ActivityResultContracts.PickVisualMedia(), uri -> {
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
showSelectedImage(uri);
|
onImagePicked(uri);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPresenter createPresenter() {
|
public MinePresenter createPresenter() {
|
||||||
return null;
|
return new MinePresenter(new MineImpl());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,7 +132,12 @@ public class MineInfomationActivity extends BaseActivity<MineInfomationLayoutBin
|
|||||||
@Override
|
@Override
|
||||||
public void initData(Bundle savedInstanceState) {
|
public void initData(Bundle savedInstanceState) {
|
||||||
super.initData(savedInstanceState);
|
super.initData(savedInstanceState);
|
||||||
// 点击事件统一由 onClick 处理。
|
// 登录手机号与地区由后端维护,页面只做展示
|
||||||
|
viewBinding.etPhone.setEnabled(false);
|
||||||
|
viewBinding.etAddress.setEnabled(false);
|
||||||
|
if (AppConfig.USER_LOGIN && mPresenter != null) {
|
||||||
|
mPresenter.getProfile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,8 +166,8 @@ public class MineInfomationActivity extends BaseActivity<MineInfomationLayoutBin
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.btn_save:
|
case R.id.btn_save:
|
||||||
// 保存单位信息,接口待接入
|
// 校验并提交资料修改(文档 4.2)
|
||||||
ToastUtil.showShort(mContext, R.string.mine_info_saved);
|
saveProfile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -145,39 +183,47 @@ public class MineInfomationActivity extends BaseActivity<MineInfomationLayoutBin
|
|||||||
mPendingContainer = null;
|
mPendingContainer = null;
|
||||||
switch (viewId) {
|
switch (viewId) {
|
||||||
case R.id.fl_avatar:
|
case R.id.fl_avatar:
|
||||||
|
mPendingSlot = SLOT_AVATAR;
|
||||||
mPendingImage = viewBinding.ivAvatar;
|
mPendingImage = viewBinding.ivAvatar;
|
||||||
break;
|
break;
|
||||||
case R.id.upload_license_1:
|
case R.id.upload_license_1:
|
||||||
|
mPendingSlot = SLOT_LICENSE_1;
|
||||||
mPendingImage = viewBinding.ivLicense1;
|
mPendingImage = viewBinding.ivLicense1;
|
||||||
mPendingPlaceholder = viewBinding.placeholderLicense1;
|
mPendingPlaceholder = viewBinding.placeholderLicense1;
|
||||||
mPendingContainer = viewBinding.uploadLicense1;
|
mPendingContainer = viewBinding.uploadLicense1;
|
||||||
break;
|
break;
|
||||||
case R.id.upload_license_2:
|
case R.id.upload_license_2:
|
||||||
|
mPendingSlot = SLOT_LICENSE_2;
|
||||||
mPendingImage = viewBinding.ivLicense2;
|
mPendingImage = viewBinding.ivLicense2;
|
||||||
mPendingPlaceholder = viewBinding.placeholderLicense2;
|
mPendingPlaceholder = viewBinding.placeholderLicense2;
|
||||||
mPendingContainer = viewBinding.uploadLicense2;
|
mPendingContainer = viewBinding.uploadLicense2;
|
||||||
break;
|
break;
|
||||||
case R.id.upload_permit_1:
|
case R.id.upload_permit_1:
|
||||||
|
mPendingSlot = SLOT_PERMIT_1;
|
||||||
mPendingImage = viewBinding.ivPermit1;
|
mPendingImage = viewBinding.ivPermit1;
|
||||||
mPendingPlaceholder = viewBinding.placeholderPermit1;
|
mPendingPlaceholder = viewBinding.placeholderPermit1;
|
||||||
mPendingContainer = viewBinding.uploadPermit1;
|
mPendingContainer = viewBinding.uploadPermit1;
|
||||||
break;
|
break;
|
||||||
case R.id.upload_permit_2:
|
case R.id.upload_permit_2:
|
||||||
|
mPendingSlot = SLOT_PERMIT_2;
|
||||||
mPendingImage = viewBinding.ivPermit2;
|
mPendingImage = viewBinding.ivPermit2;
|
||||||
mPendingPlaceholder = viewBinding.placeholderPermit2;
|
mPendingPlaceholder = viewBinding.placeholderPermit2;
|
||||||
mPendingContainer = viewBinding.uploadPermit2;
|
mPendingContainer = viewBinding.uploadPermit2;
|
||||||
break;
|
break;
|
||||||
case R.id.upload_id_front:
|
case R.id.upload_id_front:
|
||||||
|
mPendingSlot = SLOT_ID_FRONT;
|
||||||
mPendingImage = viewBinding.ivIdFront;
|
mPendingImage = viewBinding.ivIdFront;
|
||||||
mPendingPlaceholder = viewBinding.placeholderIdFront;
|
mPendingPlaceholder = viewBinding.placeholderIdFront;
|
||||||
mPendingContainer = viewBinding.uploadIdFront;
|
mPendingContainer = viewBinding.uploadIdFront;
|
||||||
break;
|
break;
|
||||||
case R.id.upload_id_back:
|
case R.id.upload_id_back:
|
||||||
|
mPendingSlot = SLOT_ID_BACK;
|
||||||
mPendingImage = viewBinding.ivIdBack;
|
mPendingImage = viewBinding.ivIdBack;
|
||||||
mPendingPlaceholder = viewBinding.placeholderIdBack;
|
mPendingPlaceholder = viewBinding.placeholderIdBack;
|
||||||
mPendingContainer = viewBinding.uploadIdBack;
|
mPendingContainer = viewBinding.uploadIdBack;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
mPendingSlot = SLOT_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,8 +239,9 @@ public class MineInfomationActivity extends BaseActivity<MineInfomationLayoutBin
|
|||||||
mPhotoDialog = new Dialog(this, R.style.ActionShareDialogStyle);
|
mPhotoDialog = new Dialog(this, R.style.ActionShareDialogStyle);
|
||||||
mPhotoDialog.setContentView(mPhotoBinding.getRoot());
|
mPhotoDialog.setContentView(mPhotoBinding.getRoot());
|
||||||
mPhotoDialog.setCanceledOnTouchOutside(true);
|
mPhotoDialog.setCanceledOnTouchOutside(true);
|
||||||
// 已上传图片时提供查看大图入口
|
// 已有图片时提供查看大图入口(本地 Uri 或远端地址)
|
||||||
boolean hasImage = mPendingImage != null && mPendingImage.getTag() instanceof Uri;
|
Object tag = mPendingImage == null ? null : mPendingImage.getTag();
|
||||||
|
boolean hasImage = tag instanceof Uri || tag instanceof String;
|
||||||
mPhotoBinding.tvViewPhoto.setVisibility(hasImage ? View.VISIBLE : View.GONE);
|
mPhotoBinding.tvViewPhoto.setVisibility(hasImage ? View.VISIBLE : View.GONE);
|
||||||
mPhotoBinding.tvTakePhoto.setOnClickListener(this::onPhotoDialogClick);
|
mPhotoBinding.tvTakePhoto.setOnClickListener(this::onPhotoDialogClick);
|
||||||
mPhotoBinding.tvPickGallery.setOnClickListener(this::onPhotoDialogClick);
|
mPhotoBinding.tvPickGallery.setOnClickListener(this::onPhotoDialogClick);
|
||||||
@@ -296,6 +343,17 @@ public class MineInfomationActivity extends BaseActivity<MineInfomationLayoutBin
|
|||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片选择完成:先本地预览,再上传获取 OSS 文件 ID。
|
||||||
|
*/
|
||||||
|
private void onImagePicked(Uri uri) {
|
||||||
|
if (mPendingImage == null || mPendingSlot == SLOT_NONE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showSelectedImage(uri);
|
||||||
|
uploadImage(uri);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将选中的图片回填到当前上传位置。
|
* 将选中的图片回填到当前上传位置。
|
||||||
*/
|
*/
|
||||||
@@ -320,24 +378,309 @@ public class MineInfomationActivity extends BaseActivity<MineInfomationLayoutBin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把相册 / 拍照得到的 Uri 复制到缓存目录,供 4.5 以文件形式上传。
|
||||||
|
*/
|
||||||
|
private void uploadImage(Uri uri) {
|
||||||
|
File file = copyUriToCache(uri);
|
||||||
|
if (file == null) {
|
||||||
|
ToastUtil.showShort(mContext, R.string.mine_info_upload_failed);
|
||||||
|
restorePendingSlot();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mUploadingSlot = mPendingSlot;
|
||||||
|
showLoadingDialog();
|
||||||
|
mPresenter.uploadImage(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取内容 Uri 并写入缓存文件,避免依赖相册的真实路径。
|
||||||
|
*/
|
||||||
|
private File copyUriToCache(Uri uri) {
|
||||||
|
File dir = new File(getCacheDir(), "uploads");
|
||||||
|
if (!dir.exists() && !dir.mkdirs()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String suffix = ".jpg";
|
||||||
|
String mimeType = getContentResolver().getType(uri);
|
||||||
|
if (mimeType != null && mimeType.contains("png")) {
|
||||||
|
suffix = ".png";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
File file = File.createTempFile("upload_", suffix, dir);
|
||||||
|
try (InputStream input = getContentResolver().openInputStream(uri);
|
||||||
|
FileOutputStream output = new FileOutputStream(file)) {
|
||||||
|
if (input == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
byte[] buffer = new byte[8192];
|
||||||
|
int length;
|
||||||
|
while ((length = input.read(buffer)) != -1) {
|
||||||
|
output.write(buffer, 0, length);
|
||||||
|
}
|
||||||
|
output.flush();
|
||||||
|
}
|
||||||
|
return file;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传成功:按位置记录文件 ID,保存资料时一并提交。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void uploadImageSuccess(long fileId) {
|
||||||
|
hideDialogLoading();
|
||||||
|
String id = String.valueOf(fileId);
|
||||||
|
switch (mUploadingSlot) {
|
||||||
|
case SLOT_AVATAR:
|
||||||
|
mAvatarId = fileId;
|
||||||
|
break;
|
||||||
|
case SLOT_LICENSE_1:
|
||||||
|
mLicenseIds[0] = id;
|
||||||
|
break;
|
||||||
|
case SLOT_LICENSE_2:
|
||||||
|
mLicenseIds[1] = id;
|
||||||
|
break;
|
||||||
|
case SLOT_PERMIT_1:
|
||||||
|
mPermitIds[0] = id;
|
||||||
|
break;
|
||||||
|
case SLOT_PERMIT_2:
|
||||||
|
mPermitIds[1] = id;
|
||||||
|
break;
|
||||||
|
case SLOT_ID_FRONT:
|
||||||
|
mIdFrontId = id;
|
||||||
|
break;
|
||||||
|
case SLOT_ID_BACK:
|
||||||
|
mIdBackId = id;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
mUploadingSlot = SLOT_NONE;
|
||||||
|
ToastUtil.showShort(mContext, R.string.mine_info_upload_success);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传失败时撤销本地预览,避免保存到未上传成功的图片。
|
||||||
|
*/
|
||||||
|
private void restorePendingSlot() {
|
||||||
|
if (mPendingImage == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mPendingImage.setTag(null);
|
||||||
|
mPendingImage.setImageDrawable(null);
|
||||||
|
if (mPendingSlot == SLOT_AVATAR) {
|
||||||
|
// 头像没有占位层,恢复默认图标
|
||||||
|
mPendingImage.setImageResource(R.mipmap.ic_launcher);
|
||||||
|
mPendingImage.setVisibility(View.VISIBLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mPendingImage.setVisibility(View.GONE);
|
||||||
|
if (mPendingContainer != null) {
|
||||||
|
mPendingContainer.setBackgroundResource(R.drawable.mine_info_input_bg);
|
||||||
|
int margin = Math.max(1, (int) getResources().getDisplayMetrics().density);
|
||||||
|
ViewGroup.MarginLayoutParams params =
|
||||||
|
(ViewGroup.MarginLayoutParams) mPendingImage.getLayoutParams();
|
||||||
|
params.setMargins(margin, margin, margin, margin);
|
||||||
|
mPendingImage.setLayoutParams(params);
|
||||||
|
}
|
||||||
|
if (mPendingPlaceholder != null) {
|
||||||
|
mPendingPlaceholder.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人资料加载成功(文档 4.1),回显表单与已上传图片。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void getProfileSuccess(ProfileEntity profile) {
|
||||||
|
if (profile == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mProfile = profile;
|
||||||
|
viewBinding.etUnitName.setText(safeText(profile.getUnitName()));
|
||||||
|
// 设计稿的「联系人」对应资料中的昵称字段(4.2 必填项)
|
||||||
|
viewBinding.etContact.setText(safeText(profile.getNickName()));
|
||||||
|
// 手机号与地区由后端维护,只读展示
|
||||||
|
viewBinding.etPhone.setText(safeText(profile.getLoginPhone()));
|
||||||
|
viewBinding.etAddress.setText(safeText(profile.getRegion()));
|
||||||
|
viewBinding.etProfile.setText(safeText(profile.getCompanyProfile()));
|
||||||
|
|
||||||
|
mAvatarId = profile.getAvatar();
|
||||||
|
// 单位 logo 为完整地址时作为默认头像展示
|
||||||
|
if (isHttpUrl(profile.getUnitLogo())) {
|
||||||
|
Glide.with(this).load(profile.getUnitLogo()).centerCrop().into(viewBinding.ivAvatar);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 证照字段按逗号分隔保存多个文件 ID / 地址
|
||||||
|
String[] licenses = splitValues(profile.getBusinessLicense());
|
||||||
|
String[] permits = splitValues(profile.getBusinessPermit());
|
||||||
|
fillIds(mLicenseIds, licenses);
|
||||||
|
fillIds(mPermitIds, permits);
|
||||||
|
mIdFrontId = safeText(profile.getIdCardFront());
|
||||||
|
mIdBackId = safeText(profile.getIdCardBack());
|
||||||
|
|
||||||
|
showStoredImage(licenses, 0, viewBinding.ivLicense1,
|
||||||
|
viewBinding.placeholderLicense1, viewBinding.uploadLicense1);
|
||||||
|
showStoredImage(licenses, 1, viewBinding.ivLicense2,
|
||||||
|
viewBinding.placeholderLicense2, viewBinding.uploadLicense2);
|
||||||
|
showStoredImage(permits, 0, viewBinding.ivPermit1,
|
||||||
|
viewBinding.placeholderPermit1, viewBinding.uploadPermit1);
|
||||||
|
showStoredImage(permits, 1, viewBinding.ivPermit2,
|
||||||
|
viewBinding.placeholderPermit2, viewBinding.uploadPermit2);
|
||||||
|
showSingleStoredImage(mIdFrontId, viewBinding.ivIdFront,
|
||||||
|
viewBinding.placeholderIdFront, viewBinding.uploadIdFront);
|
||||||
|
showSingleStoredImage(mIdBackId, viewBinding.ivIdBack,
|
||||||
|
viewBinding.placeholderIdBack, viewBinding.uploadIdBack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存资料(文档 4.2):联系人必填,其余字段按表单提交。
|
||||||
|
*/
|
||||||
|
private void saveProfile() {
|
||||||
|
// 资料未加载成功时禁止提交,避免把未回显的字段清空
|
||||||
|
if (mProfile == null) {
|
||||||
|
ToastUtil.showShort(mContext, R.string.mine_info_profile_not_ready);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 联系人对应 4.2 的 nickName,后端要求必填
|
||||||
|
String nickName = viewBinding.etContact.getText().toString().trim();
|
||||||
|
if (TextUtils.isEmpty(nickName)) {
|
||||||
|
ToastUtil.showShort(mContext, R.string.mine_info_contact_required);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (nickName.length() > 30) {
|
||||||
|
ToastUtil.showShort(mContext, R.string.mine_info_contact_too_long);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProfileBo bo = new ProfileBo();
|
||||||
|
bo.setNickName(nickName);
|
||||||
|
bo.setUnitName(viewBinding.etUnitName.getText().toString().trim());
|
||||||
|
bo.setCompanyProfile(viewBinding.etProfile.getText().toString().trim());
|
||||||
|
// 没有头像文件 ID 时不传该字段,避免误清空
|
||||||
|
if (mAvatarId != null && mAvatarId > 0) {
|
||||||
|
bo.setAvatar(mAvatarId);
|
||||||
|
}
|
||||||
|
bo.setBusinessLicense(joinIds(mLicenseIds));
|
||||||
|
bo.setBusinessPermit(joinIds(mPermitIds));
|
||||||
|
bo.setIdCardFront(mIdFrontId);
|
||||||
|
bo.setIdCardBack(mIdBackId);
|
||||||
|
// 页面没有该字段的输入项,原样回传避免被清空
|
||||||
|
if (mProfile != null) {
|
||||||
|
bo.setSocialCreditCode(mProfile.getSocialCreditCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
showLoadingDialog();
|
||||||
|
mPresenter.updateProfile(bo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资料保存成功:关闭页面,个人中心返回时会重新拉取资料。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateProfileSuccess() {
|
||||||
|
hideDialogLoading();
|
||||||
|
ToastUtil.showShort(mContext, R.string.mine_info_saved);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已有图片是完整地址时直接展示;文件 ID 无法作为图片地址,保留占位层。
|
||||||
|
*/
|
||||||
|
private void showStoredImage(String[] values, int index, ImageView image,
|
||||||
|
View placeholder, View container) {
|
||||||
|
if (values == null || index >= values.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showSingleStoredImage(values[index], image, placeholder, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showSingleStoredImage(String value, ImageView image,
|
||||||
|
View placeholder, View container) {
|
||||||
|
if (!isHttpUrl(value)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
image.setTag(value);
|
||||||
|
image.setVisibility(View.VISIBLE);
|
||||||
|
container.setBackgroundResource(R.drawable.mine_info_upload_filled_bg);
|
||||||
|
ViewGroup.MarginLayoutParams params =
|
||||||
|
(ViewGroup.MarginLayoutParams) image.getLayoutParams();
|
||||||
|
params.setMargins(0, 0, 0, 0);
|
||||||
|
image.setLayoutParams(params);
|
||||||
|
Glide.with(this).load(value).centerCrop().into(image);
|
||||||
|
placeholder.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全屏查看当前上传的图片,点击图片关闭。
|
* 全屏查看当前上传的图片,点击图片关闭。
|
||||||
*/
|
*/
|
||||||
private void showPreviewImage() {
|
private void showPreviewImage() {
|
||||||
if (mPendingImage == null || !(mPendingImage.getTag() instanceof Uri)) {
|
if (mPendingImage == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Object tag = mPendingImage.getTag();
|
||||||
|
if (!(tag instanceof Uri) && !(tag instanceof String)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Uri uri = (Uri) mPendingImage.getTag();
|
|
||||||
Dialog dialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
|
Dialog dialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
|
||||||
PhotoView photoView = new PhotoView(this);
|
PhotoView photoView = new PhotoView(this);
|
||||||
photoView.setBackgroundColor(Color.BLACK);
|
photoView.setBackgroundColor(Color.BLACK);
|
||||||
dialog.setContentView(photoView, new FrameLayout.LayoutParams(
|
dialog.setContentView(photoView, new FrameLayout.LayoutParams(
|
||||||
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
|
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
|
||||||
Glide.with(this).load(uri).into(photoView);
|
Glide.with(this).load(tag).into(photoView);
|
||||||
photoView.setOnPhotoTapListener((view, x, y) -> dialog.dismiss());
|
photoView.setOnPhotoTapListener((view, x, y) -> dialog.dismiss());
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逗号分隔的字段拆成数组,用于回显多个证照位置。
|
||||||
|
*/
|
||||||
|
private String[] splitValues(String value) {
|
||||||
|
if (TextUtils.isEmpty(value)) {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
|
String[] values = value.split(",");
|
||||||
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
values[i] = values[i].trim();
|
||||||
|
}
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillIds(String[] target, String[] source) {
|
||||||
|
for (int i = 0; i < target.length; i++) {
|
||||||
|
target[i] = i < source.length ? source[i].trim() : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过滤空位置后用逗号拼接,空列表提交空串表示清空。
|
||||||
|
*/
|
||||||
|
private String joinIds(String[] ids) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
for (String id : ids) {
|
||||||
|
if (TextUtils.isEmpty(id)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (builder.length() > 0) {
|
||||||
|
builder.append(",");
|
||||||
|
}
|
||||||
|
builder.append(id);
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isHttpUrl(String value) {
|
||||||
|
return !TextUtils.isEmpty(value) && value.startsWith("http");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String safeText(String value) {
|
||||||
|
return value == null ? "" : value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||||
@NonNull int[] grantResults) {
|
@NonNull int[] grantResults) {
|
||||||
@@ -363,7 +706,14 @@ public class MineInfomationActivity extends BaseActivity<MineInfomationLayoutBin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showError(String message) {
|
public void showError(String message) {
|
||||||
hideLoading();
|
hideDialogLoading();
|
||||||
|
// 上传阶段失败要撤销预览,保存 / 加载失败只提示
|
||||||
|
if (mUploadingSlot != SLOT_NONE) {
|
||||||
|
restorePendingSlot();
|
||||||
|
mUploadingSlot = SLOT_NONE;
|
||||||
|
ToastUtil.showShort(mContext, R.string.mine_info_upload_failed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (message != null && !message.isEmpty()) {
|
if (message != null && !message.isEmpty()) {
|
||||||
ToastUtil.showShort(mContext, message);
|
ToastUtil.showShort(mContext, message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -337,6 +337,8 @@ public class NetWorkManager {
|
|||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
map.put("Authorization", "Bearer " + AppConfig.USER_TOKEN);
|
map.put("Authorization", "Bearer " + AppConfig.USER_TOKEN);
|
||||||
|
// 登录后所有业务请求都需要携带与登录时一致的 clientid
|
||||||
|
map.put("clientid", AppConfig.CLIENT_ID);
|
||||||
// map.put("Authorization", "Bearer " + "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxOTI1NzYwMTgxMTMyNzI2MDIyLCJ1c2VyX2tleSI6IjY0YjVmMjRjLTIyM2ItNDRkZC1iMDJlLTI0ZTRiNzNmODgxZCIsInVzZXJuYW1lIjoiMTg2NDU5MDQzMDIifQ.PiIjBZlQ9UtOuotfhd5mZZO2e8SbMpbXU7VDvVeiWZIecsFDUd51Rae09EFxQ_MJmBUEvIdyysnyqYiBC2AEfw");
|
// map.put("Authorization", "Bearer " + "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxOTI1NzYwMTgxMTMyNzI2MDIyLCJ1c2VyX2tleSI6IjY0YjVmMjRjLTIyM2ItNDRkZC1iMDJlLTI0ZTRiNzNmODgxZCIsInVzZXJuYW1lIjoiMTg2NDU5MDQzMDIifQ.PiIjBZlQ9UtOuotfhd5mZZO2e8SbMpbXU7VDvVeiWZIecsFDUd51Rae09EFxQ_MJmBUEvIdyysnyqYiBC2AEfw");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -11,20 +11,31 @@ import com.ckkj.griddlebiz.chat.entity.CharHistoryEntity;
|
|||||||
import com.ckkj.griddlebiz.chat.entity.ChatAiMsgEntity;
|
import com.ckkj.griddlebiz.chat.entity.ChatAiMsgEntity;
|
||||||
import com.ckkj.griddlebiz.chat.entity.IndexTemplateEntity;
|
import com.ckkj.griddlebiz.chat.entity.IndexTemplateEntity;
|
||||||
import com.ckkj.griddlebiz.login.entity.LoginEntity;
|
import com.ckkj.griddlebiz.login.entity.LoginEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.HomeEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.ProfileEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.SummaryEntity;
|
||||||
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
import com.ckkj.griddlebiz.main.entity.CheckVersionEntity;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.DeviceEntity;
|
||||||
|
import com.ckkj.griddlebiz.mine.entity.ProfileBo;
|
||||||
import com.ckkj.griddlebiz.plate.entity.BaziResultBean;
|
import com.ckkj.griddlebiz.plate.entity.BaziResultBean;
|
||||||
import com.ckkj.griddlebiz.plate.entity.BaziSaveSuccessEntity;
|
import com.ckkj.griddlebiz.plate.entity.BaziSaveSuccessEntity;
|
||||||
import com.ckkj.griddlebiz.plate.entity.PaipanHistoryEntity;
|
import com.ckkj.griddlebiz.plate.entity.PaipanHistoryEntity;
|
||||||
|
import com.ckkj.griddlebiz.product.entity.ScanPreviewEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
|
import okhttp3.MultipartBody;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.HeaderMap;
|
import retrofit2.http.HeaderMap;
|
||||||
|
import retrofit2.http.Multipart;
|
||||||
import retrofit2.http.POST;
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.PUT;
|
||||||
|
import retrofit2.http.Part;
|
||||||
|
import retrofit2.http.Path;
|
||||||
import retrofit2.http.QueryMap;
|
import retrofit2.http.QueryMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,9 +94,42 @@ public interface Request {
|
|||||||
// 新账号接口:公开接口不携带旧会话令牌,请求参数统一放入 JSON 请求体
|
// 新账号接口:公开接口不携带旧会话令牌,请求参数统一放入 JSON 请求体
|
||||||
@POST("app/auth/sms/code")
|
@POST("app/auth/sms/code")
|
||||||
Observable<BaseBean> sendAuthPhoneCode(@Body RequestBody requestBody);
|
Observable<BaseBean> sendAuthPhoneCode(@Body RequestBody requestBody);
|
||||||
// 手机号和密码登录
|
// 手机号和密码登录(文档 2.1)
|
||||||
@POST("app/auth/login")
|
@POST("auth/login")
|
||||||
Observable<BaseBean<LoginEntity>> loginByPassword(@Body RequestBody requestBody);
|
Observable<BaseBean<LoginEntity>> loginByPassword(@Body RequestBody requestBody);
|
||||||
|
// 退出登录(文档 2.2)
|
||||||
|
@POST("auth/logout")
|
||||||
|
Observable<BaseBean> logout(@HeaderMap Map<String, String> headMap);
|
||||||
|
// 首页聚合(文档 3.1)
|
||||||
|
@GET("app/agent/home")
|
||||||
|
Observable<BaseBean<HomeEntity>> getAgentHome(@HeaderMap Map<String, String> headMap);
|
||||||
|
// 经营统计(文档 3.2)
|
||||||
|
@GET("app/agent/statistics")
|
||||||
|
Observable<BaseBean<SummaryEntity>> getAgentStatistics(@HeaderMap Map<String, String> headMap);
|
||||||
|
// 获取个人资料(文档 4.1)
|
||||||
|
@GET("app/agent/profile")
|
||||||
|
Observable<BaseBean<ProfileEntity>> getAgentProfile(@HeaderMap Map<String, String> headMap);
|
||||||
|
// 修改个人资料(文档 4.2)
|
||||||
|
@PUT("app/agent/profile")
|
||||||
|
Observable<BaseBean> updateAgentProfile(@HeaderMap Map<String, String> headMap,
|
||||||
|
@Body ProfileBo body);
|
||||||
|
// 上传头像 / 证照图片(文档 4.5),表单字段名固定为 file
|
||||||
|
@Multipart
|
||||||
|
@POST("app/agent/profile/avatar")
|
||||||
|
Observable<BaseBean<Long>> uploadAgentAvatar(@HeaderMap Map<String, String> headMap,
|
||||||
|
@Part MultipartBody.Part file);
|
||||||
|
// 商品列表(文档 5.1)
|
||||||
|
@GET("app/agent/products")
|
||||||
|
Observable<BaseBean<PageResult<DeviceEntity>>> getAgentProducts(
|
||||||
|
@HeaderMap Map<String, String> headMap, @QueryMap Map<String, Object> params);
|
||||||
|
// 商品详情(文档 5.2)
|
||||||
|
@GET("app/agent/products/{deviceId}")
|
||||||
|
Observable<BaseBean<DeviceEntity>> getAgentProductDetail(
|
||||||
|
@HeaderMap Map<String, String> headMap, @Path("deviceId") long deviceId);
|
||||||
|
// 扫码入库预览(文档 5.3)
|
||||||
|
@POST("app/agent/products/stock-in/preview")
|
||||||
|
Observable<BaseBean<ScanPreviewEntity>> previewProductStockIn(
|
||||||
|
@HeaderMap Map<String, String> headMap, @Body RequestBody body);
|
||||||
// 手机号注册,邀请码临时使用 visCode 字段
|
// 手机号注册,邀请码临时使用 visCode 字段
|
||||||
@POST("app/auth/register")
|
@POST("app/auth/register")
|
||||||
Observable<BaseBean> registerByPhone(@Body RequestBody requestBody);
|
Observable<BaseBean> registerByPhone(@Body RequestBody requestBody);
|
||||||
|
|||||||
@@ -3,33 +3,46 @@ package com.ckkj.griddlebiz.product;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.ckkj.griddlebiz.AppConfig;
|
||||||
import com.ckkj.griddlebiz.R;
|
import com.ckkj.griddlebiz.R;
|
||||||
import com.ckkj.griddlebiz.base.BaseActivityNoP;
|
import com.ckkj.griddlebiz.base.BaseActivity;
|
||||||
import com.ckkj.griddlebiz.databinding.DeviceDetailLayoutBinding;
|
import com.ckkj.griddlebiz.databinding.DeviceDetailLayoutBinding;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.DeviceEntity;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
|
import com.ckkj.griddlebiz.network.PageResult;
|
||||||
|
import com.ckkj.griddlebiz.product.mvp.ProductContract;
|
||||||
|
import com.ckkj.griddlebiz.product.mvp.ProductImpl;
|
||||||
|
import com.ckkj.griddlebiz.product.mvp.ProductPresenter;
|
||||||
import com.ckkj.griddlebiz.utils.show.ToastUtil;
|
import com.ckkj.griddlebiz.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备详情:在线、故障、离线三种状态共用一套信息列表,只切换状态卡。
|
* 设备详情:按 deviceId 加载商品详情(文档 5.2),在线、故障、离线三种状态共用一套信息列表。
|
||||||
*/
|
*/
|
||||||
public class DeviceDetailActivity extends BaseActivityNoP<DeviceDetailLayoutBinding> {
|
public class DeviceDetailActivity
|
||||||
|
extends BaseActivity<DeviceDetailLayoutBinding, ProductPresenter>
|
||||||
|
implements ProductContract.ProductView {
|
||||||
|
|
||||||
public static final String EXTRA_STATE = "extra_state";
|
public static final String EXTRA_DEVICE_ID = "extra_device_id";
|
||||||
public static final int STATE_ONLINE = 0;
|
|
||||||
public static final int STATE_FAULT = 1;
|
|
||||||
public static final int STATE_OFFLINE = 2;
|
|
||||||
|
|
||||||
public static Intent createIntent(Context context, int state) {
|
public static Intent createIntent(Context context, long deviceId) {
|
||||||
return new Intent(context, DeviceDetailActivity.class)
|
return new Intent(context, DeviceDetailActivity.class)
|
||||||
.putExtra(EXTRA_STATE, state);
|
.putExtra(EXTRA_DEVICE_ID, deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int mState = STATE_ONLINE;
|
private long mDeviceId;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProductPresenter createPresenter() {
|
||||||
|
return new ProductPresenter(new ProductImpl());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutResId(Bundle savedInstanceState) {
|
public int getLayoutResId(Bundle savedInstanceState) {
|
||||||
@@ -44,8 +57,16 @@ public class DeviceDetailActivity extends BaseActivityNoP<DeviceDetailLayoutBind
|
|||||||
.statusBarDarkFont(true)
|
.statusBarDarkFont(true)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
mState = getIntent().getIntExtra(EXTRA_STATE, STATE_ONLINE);
|
mDeviceId = getIntent().getLongExtra(EXTRA_DEVICE_ID, 0);
|
||||||
applyState(mState);
|
if (mDeviceId <= 0) {
|
||||||
|
ToastUtil.showShort(mContext, R.string.device_detail_load_failed);
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (AppConfig.USER_LOGIN && mPresenter != null) {
|
||||||
|
showLoadingDialog();
|
||||||
|
mPresenter.getProductDetail(mDeviceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,25 +85,56 @@ public class DeviceDetailActivity extends BaseActivityNoP<DeviceDetailLayoutBind
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyState(int state) {
|
/**
|
||||||
boolean online = state == STATE_ONLINE;
|
* 商品详情加载成功(文档 5.2)
|
||||||
boolean fault = state == STATE_FAULT;
|
*/
|
||||||
boolean offline = state == STATE_OFFLINE;
|
@Override
|
||||||
|
public void getProductDetailSuccess(DeviceEntity device) {
|
||||||
|
hideDialogLoading();
|
||||||
|
if (device == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
applyState(device);
|
||||||
|
bindDeviceInfo(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getProductsSuccess(PageResult<DeviceEntity> result) {
|
||||||
|
// 本页只加载详情
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据在线 / 故障状态切换顶部状态卡
|
||||||
|
*/
|
||||||
|
private void applyState(DeviceEntity device) {
|
||||||
|
boolean fault = "1".equals(device.getFaultStatus());
|
||||||
|
boolean online = !fault && "1".equals(device.getOnlineStatus());
|
||||||
|
String lastOnlineTime = formatDateTime(device.getLastOnlineTime());
|
||||||
|
|
||||||
viewBinding.bannerOnline.setVisibility(online ? View.VISIBLE : View.GONE);
|
viewBinding.bannerOnline.setVisibility(online ? View.VISIBLE : View.GONE);
|
||||||
viewBinding.bannerFault.setVisibility(fault ? View.VISIBLE : View.GONE);
|
viewBinding.bannerFault.setVisibility(fault ? View.VISIBLE : View.GONE);
|
||||||
viewBinding.bannerOffline.setVisibility(offline ? View.VISIBLE : View.GONE);
|
viewBinding.bannerOffline.setVisibility(!online && !fault ? View.VISIBLE : View.GONE);
|
||||||
|
viewBinding.tvOnlineBanner.setText(
|
||||||
|
getString(R.string.device_detail_banner_online_time, lastOnlineTime));
|
||||||
|
viewBinding.tvOfflineBanner.setText(
|
||||||
|
getString(R.string.device_detail_banner_offline_time, lastOnlineTime));
|
||||||
|
|
||||||
if (online) {
|
if (fault) {
|
||||||
viewBinding.tvStatus.setText(R.string.device_manage_status_online);
|
|
||||||
viewBinding.tvStatus.setBackgroundResource(R.drawable.device_manage_status_online_bg);
|
|
||||||
viewBinding.tvStatus.setTextColor(getColor(R.color.device_manage_status_online));
|
|
||||||
viewBinding.ivDeviceIcon.setImageResource(R.mipmap.icon_device_manage_box);
|
|
||||||
} else if (fault) {
|
|
||||||
viewBinding.tvStatus.setText(R.string.device_manage_status_fault);
|
viewBinding.tvStatus.setText(R.string.device_manage_status_fault);
|
||||||
viewBinding.tvStatus.setBackgroundResource(R.drawable.device_manage_status_fault_bg);
|
viewBinding.tvStatus.setBackgroundResource(R.drawable.device_manage_status_fault_bg);
|
||||||
viewBinding.tvStatus.setTextColor(getColor(R.color.device_manage_status_fault));
|
viewBinding.tvStatus.setTextColor(getColor(R.color.device_manage_status_fault));
|
||||||
viewBinding.ivDeviceIcon.setImageResource(R.mipmap.icon_device_manage_box);
|
viewBinding.ivDeviceIcon.setImageResource(R.mipmap.icon_device_manage_box);
|
||||||
|
// 故障描述优先,接口没有单独的故障时间字段
|
||||||
|
String faultDesc = !TextUtils.isEmpty(device.getFaultDesc())
|
||||||
|
? device.getFaultDesc() : device.getFaultCode();
|
||||||
|
viewBinding.tvFaultBanner.setText(TextUtils.isEmpty(faultDesc)
|
||||||
|
? getString(R.string.device_detail_banner_fault) : faultDesc);
|
||||||
|
viewBinding.tvFaultTime.setText("--");
|
||||||
|
} else if (online) {
|
||||||
|
viewBinding.tvStatus.setText(R.string.device_manage_status_online);
|
||||||
|
viewBinding.tvStatus.setBackgroundResource(R.drawable.device_manage_status_online_bg);
|
||||||
|
viewBinding.tvStatus.setTextColor(getColor(R.color.device_manage_status_online));
|
||||||
|
viewBinding.ivDeviceIcon.setImageResource(R.mipmap.icon_device_manage_box);
|
||||||
} else {
|
} else {
|
||||||
viewBinding.tvStatus.setText(R.string.device_manage_status_offline);
|
viewBinding.tvStatus.setText(R.string.device_manage_status_offline);
|
||||||
viewBinding.tvStatus.setBackgroundResource(R.drawable.device_manage_status_offline_bg);
|
viewBinding.tvStatus.setBackgroundResource(R.drawable.device_manage_status_offline_bg);
|
||||||
@@ -91,10 +143,55 @@ public class DeviceDetailActivity extends BaseActivityNoP<DeviceDetailLayoutBind
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回填设备信息,接口没有的字段统一展示 --
|
||||||
|
*/
|
||||||
|
private void bindDeviceInfo(DeviceEntity device) {
|
||||||
|
String deviceCode = safeText(device.getDeviceCode());
|
||||||
|
viewBinding.tvDeviceCode.setText(deviceCode);
|
||||||
|
viewBinding.tvDeviceName.setText(safeText(device.getDeviceName()));
|
||||||
|
|
||||||
|
viewBinding.tvInfoSn.setText(deviceCode);
|
||||||
|
viewBinding.tvInfoModel.setText(device.getModelId() == null
|
||||||
|
? "--" : String.valueOf(device.getModelId()));
|
||||||
|
// 所属单位、关联用户不在 DeviceVo 中,避免展示设计稿假数据
|
||||||
|
viewBinding.tvInfoOwner.setText("--");
|
||||||
|
viewBinding.tvInfoUser.setText("--");
|
||||||
|
viewBinding.tvInfoActivationTime.setText(formatDateTime(device.getActivationTime()));
|
||||||
|
viewBinding.tvInfoLocation.setText(TextUtils.isEmpty(device.getCountryName())
|
||||||
|
? "--" : device.getCountryName());
|
||||||
|
viewBinding.tvInfoRuntime.setText(formatRuntime(device.getTotalRuntime()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口时间可能是 ISO-8601 字符串,展示到秒并去掉时区后缀
|
||||||
|
*/
|
||||||
|
private String formatDateTime(String value) {
|
||||||
|
if (TextUtils.isEmpty(value)) {
|
||||||
|
return "--";
|
||||||
|
}
|
||||||
|
String time = value.replace('T', ' ');
|
||||||
|
return time.length() > 19 ? time.substring(0, 19) : time;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累计使用时长去掉多余小数并带单位
|
||||||
|
*/
|
||||||
|
private String formatRuntime(BigDecimal value) {
|
||||||
|
if (value == null) {
|
||||||
|
return "0 小时";
|
||||||
|
}
|
||||||
|
return value.stripTrailingZeros().toPlainString() + " 小时";
|
||||||
|
}
|
||||||
|
|
||||||
|
private String safeText(String value) {
|
||||||
|
return value == null ? "" : value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showError(String message) {
|
public void showError(String message) {
|
||||||
hideLoading();
|
hideDialogLoading();
|
||||||
if (message != null && !message.isEmpty()) {
|
if (!TextUtils.isEmpty(message)) {
|
||||||
ToastUtil.showShort(mContext, message);
|
ToastUtil.showShort(mContext, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,25 +2,58 @@ package com.ckkj.griddlebiz.product;
|
|||||||
|
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.ckkj.griddlebiz.AppConfig;
|
||||||
import com.ckkj.griddlebiz.R;
|
import com.ckkj.griddlebiz.R;
|
||||||
import com.ckkj.griddlebiz.base.BaseActivityNoP;
|
import com.ckkj.griddlebiz.base.BaseActivity;
|
||||||
import com.ckkj.griddlebiz.databinding.DeviceManageLayoutBinding;
|
import com.ckkj.griddlebiz.databinding.DeviceManageLayoutBinding;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.DeviceEntity;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
|
import com.ckkj.griddlebiz.network.PageResult;
|
||||||
|
import com.ckkj.griddlebiz.product.adapter.DeviceListAdapter;
|
||||||
|
import com.ckkj.griddlebiz.product.mvp.ProductContract;
|
||||||
|
import com.ckkj.griddlebiz.product.mvp.ProductImpl;
|
||||||
|
import com.ckkj.griddlebiz.product.mvp.ProductPresenter;
|
||||||
import com.ckkj.griddlebiz.utils.show.ToastUtil;
|
import com.ckkj.griddlebiz.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备管理:全部设备与待激活两个 Tab。
|
* 设备管理:全部设备与待激活两个 Tab,数据来自商品列表接口(文档 5.1)。
|
||||||
* 页面数据目前使用设计稿示例,后续接入设备列表接口时替换。
|
|
||||||
*/
|
*/
|
||||||
public class DeviceManageActivity extends BaseActivityNoP<DeviceManageLayoutBinding> {
|
public class DeviceManageActivity extends BaseActivity<DeviceManageLayoutBinding, ProductPresenter>
|
||||||
|
implements ProductContract.ProductView {
|
||||||
|
|
||||||
|
/** 全部设备 */
|
||||||
|
private static final String TAB_ALL = "all";
|
||||||
|
/** 待激活设备 */
|
||||||
|
private static final String TAB_PENDING = "pendingActivation";
|
||||||
|
|
||||||
|
private DeviceListAdapter mAllAdapter;
|
||||||
|
private DeviceListAdapter mPendingAdapter;
|
||||||
|
|
||||||
|
/** 全部设备最近一次接口返回,用于状态筛选 */
|
||||||
|
private final List<DeviceEntity> mAllDevices = new ArrayList<>();
|
||||||
|
/** 当前状态筛选,默认全部 */
|
||||||
|
private int mStatusFilter = R.id.chip_all;
|
||||||
|
/** 当前是否处于全部设备 Tab */
|
||||||
|
private boolean mAllTab = true;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProductPresenter createPresenter() {
|
||||||
|
return new ProductPresenter(new ProductImpl());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutResId(Bundle savedInstanceState) {
|
public int getLayoutResId(Bundle savedInstanceState) {
|
||||||
@@ -36,17 +69,14 @@ public class DeviceManageActivity extends BaseActivityNoP<DeviceManageLayoutBind
|
|||||||
.keyboardEnable(true)
|
.keyboardEnable(true)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
|
initRecyclerViews();
|
||||||
|
|
||||||
// 状态筛选默认选中“全部”,时间筛选默认不选中。
|
// 状态筛选默认选中“全部”,时间筛选默认不选中。
|
||||||
updateChipGroup(R.id.chip_all, viewBinding.chipAll, viewBinding.chipOnline,
|
updateChipGroup(R.id.chip_all, viewBinding.chipAll, viewBinding.chipOnline,
|
||||||
viewBinding.chipOffline, viewBinding.chipFault);
|
viewBinding.chipOffline, viewBinding.chipFault);
|
||||||
updateChipGroup(View.NO_ID, viewBinding.chipLast7Days, viewBinding.chipLast30Days,
|
updateChipGroup(View.NO_ID, viewBinding.chipLast7Days, viewBinding.chipLast30Days,
|
||||||
viewBinding.chipCustom);
|
viewBinding.chipCustom);
|
||||||
|
|
||||||
viewBinding.tvTotalDevices.setText(
|
|
||||||
getString(R.string.device_manage_total_devices, 24));
|
|
||||||
viewBinding.tvInStock.setText(getString(R.string.device_manage_in_stock, 3));
|
|
||||||
viewBinding.tvSold.setText(getString(R.string.device_manage_sold, 5));
|
|
||||||
|
|
||||||
viewBinding.etSearch.setOnEditorActionListener((v, actionId, event) -> {
|
viewBinding.etSearch.setOnEditorActionListener((v, actionId, event) -> {
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||||
onSearch();
|
onSearch();
|
||||||
@@ -58,11 +88,23 @@ public class DeviceManageActivity extends BaseActivityNoP<DeviceManageLayoutBind
|
|||||||
selectTab(true);
|
selectTab(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化两个列表:全部设备与待激活设备使用不同的 item 布局。
|
||||||
|
*/
|
||||||
|
private void initRecyclerViews() {
|
||||||
|
mAllAdapter = new DeviceListAdapter(this, false, this::openDeviceDetail);
|
||||||
|
viewBinding.rvDevices.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
viewBinding.rvDevices.setAdapter(mAllAdapter);
|
||||||
|
|
||||||
|
mPendingAdapter = new DeviceListAdapter(this, true, this::openDeviceDetail);
|
||||||
|
viewBinding.rvPending.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
viewBinding.rvPending.setAdapter(mPendingAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备管理页点击事件。
|
* 设备管理页点击事件。
|
||||||
*/
|
*/
|
||||||
@OnClick({R.id.iv_back, R.id.tab_all, R.id.tab_pending, R.id.card_online,
|
@OnClick({R.id.iv_back, R.id.tab_all, R.id.tab_pending, R.id.iv_search, R.id.chip_all,
|
||||||
R.id.card_fault, R.id.card_offline, R.id.iv_search, R.id.chip_all,
|
|
||||||
R.id.chip_online, R.id.chip_offline, R.id.chip_fault,
|
R.id.chip_online, R.id.chip_offline, R.id.chip_fault,
|
||||||
R.id.chip_last_7_days, R.id.chip_last_30_days, R.id.chip_custom})
|
R.id.chip_last_7_days, R.id.chip_last_30_days, R.id.chip_custom})
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -82,24 +124,6 @@ public class DeviceManageActivity extends BaseActivityNoP<DeviceManageLayoutBind
|
|||||||
selectTab(false);
|
selectTab(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.card_online:
|
|
||||||
// 查看在线设备详情
|
|
||||||
startActivity(DeviceDetailActivity.createIntent(mContext,
|
|
||||||
DeviceDetailActivity.STATE_ONLINE));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.card_fault:
|
|
||||||
// 查看故障设备详情
|
|
||||||
startActivity(DeviceDetailActivity.createIntent(mContext,
|
|
||||||
DeviceDetailActivity.STATE_FAULT));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.card_offline:
|
|
||||||
// 查看离线设备详情
|
|
||||||
startActivity(DeviceDetailActivity.createIntent(mContext,
|
|
||||||
DeviceDetailActivity.STATE_OFFLINE));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.iv_search:
|
case R.id.iv_search:
|
||||||
// 搜索设备
|
// 搜索设备
|
||||||
onSearch();
|
onSearch();
|
||||||
@@ -109,15 +133,17 @@ public class DeviceManageActivity extends BaseActivityNoP<DeviceManageLayoutBind
|
|||||||
case R.id.chip_online:
|
case R.id.chip_online:
|
||||||
case R.id.chip_offline:
|
case R.id.chip_offline:
|
||||||
case R.id.chip_fault:
|
case R.id.chip_fault:
|
||||||
// 状态筛选,同一时间只能选中一个
|
// 状态筛选,同一时间只能选中一个,接口没有状态参数,按本地数据过滤
|
||||||
updateChipGroup(v.getId(), viewBinding.chipAll, viewBinding.chipOnline,
|
updateChipGroup(v.getId(), viewBinding.chipAll, viewBinding.chipOnline,
|
||||||
viewBinding.chipOffline, viewBinding.chipFault);
|
viewBinding.chipOffline, viewBinding.chipFault);
|
||||||
|
mStatusFilter = v.getId();
|
||||||
|
applyStatusFilter();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.chip_last_7_days:
|
case R.id.chip_last_7_days:
|
||||||
case R.id.chip_last_30_days:
|
case R.id.chip_last_30_days:
|
||||||
case R.id.chip_custom:
|
case R.id.chip_custom:
|
||||||
// 激活时间筛选,同一时间只能选中一个
|
// 接口暂未提供激活时间筛选参数,仅保留交互状态
|
||||||
updateChipGroup(v.getId(), viewBinding.chipLast7Days,
|
updateChipGroup(v.getId(), viewBinding.chipLast7Days,
|
||||||
viewBinding.chipLast30Days, viewBinding.chipCustom);
|
viewBinding.chipLast30Days, viewBinding.chipCustom);
|
||||||
break;
|
break;
|
||||||
@@ -127,7 +153,11 @@ public class DeviceManageActivity extends BaseActivityNoP<DeviceManageLayoutBind
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换 Tab 并加载对应列表
|
||||||
|
*/
|
||||||
private void selectTab(boolean allDevices) {
|
private void selectTab(boolean allDevices) {
|
||||||
|
mAllTab = allDevices;
|
||||||
viewBinding.scrollAll.setVisibility(allDevices ? View.VISIBLE : View.GONE);
|
viewBinding.scrollAll.setVisibility(allDevices ? View.VISIBLE : View.GONE);
|
||||||
viewBinding.scrollPending.setVisibility(allDevices ? View.GONE : View.VISIBLE);
|
viewBinding.scrollPending.setVisibility(allDevices ? View.GONE : View.VISIBLE);
|
||||||
viewBinding.indicatorAll.setVisibility(allDevices ? View.VISIBLE : View.INVISIBLE);
|
viewBinding.indicatorAll.setVisibility(allDevices ? View.VISIBLE : View.INVISIBLE);
|
||||||
@@ -146,6 +176,103 @@ public class DeviceManageActivity extends BaseActivityNoP<DeviceManageLayoutBind
|
|||||||
} else {
|
} else {
|
||||||
viewBinding.scrollPending.scrollTo(0, 0);
|
viewBinding.scrollPending.scrollTo(0, 0);
|
||||||
}
|
}
|
||||||
|
loadDevices();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按当前 Tab 和搜索关键字加载商品列表。
|
||||||
|
*/
|
||||||
|
private void loadDevices() {
|
||||||
|
if (!AppConfig.USER_LOGIN || mPresenter == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String keyword = viewBinding.etSearch.getText().toString().trim();
|
||||||
|
mPresenter.getProducts(mAllTab ? TAB_ALL : TAB_PENDING, keyword);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品列表加载成功(文档 5.1)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void getProductsSuccess(PageResult<DeviceEntity> result) {
|
||||||
|
if (result == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<DeviceEntity> rows = result.getRows() == null
|
||||||
|
? new ArrayList<>() : result.getRows();
|
||||||
|
if (mAllTab) {
|
||||||
|
mAllDevices.clear();
|
||||||
|
mAllDevices.addAll(rows);
|
||||||
|
applyStatusFilter();
|
||||||
|
viewBinding.tvTotalDevices.setText(
|
||||||
|
getString(R.string.device_manage_total_devices, result.getTotal()));
|
||||||
|
} else {
|
||||||
|
mPendingAdapter.setData(rows);
|
||||||
|
viewBinding.tvPendingTotal.setText(String.valueOf(result.getTotal()));
|
||||||
|
updatePendingCount(rows);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getProductDetailSuccess(DeviceEntity device) {
|
||||||
|
// 详情由 DeviceDetailActivity 处理
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计待激活列表中的库存与已售数量
|
||||||
|
*/
|
||||||
|
private void updatePendingCount(List<DeviceEntity> rows) {
|
||||||
|
int inStock = 0;
|
||||||
|
int sold = 0;
|
||||||
|
for (DeviceEntity device : rows) {
|
||||||
|
if ("1".equals(device.getSaleStatus())) {
|
||||||
|
sold++;
|
||||||
|
} else {
|
||||||
|
inStock++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
viewBinding.tvInStock.setText(getString(R.string.device_manage_in_stock, inStock));
|
||||||
|
viewBinding.tvSold.setText(getString(R.string.device_manage_sold, sold));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按在线 / 离线 / 故障筛选全部设备列表
|
||||||
|
*/
|
||||||
|
private void applyStatusFilter() {
|
||||||
|
List<DeviceEntity> filtered = new ArrayList<>();
|
||||||
|
for (DeviceEntity device : mAllDevices) {
|
||||||
|
boolean online = "1".equals(device.getOnlineStatus());
|
||||||
|
boolean fault = "1".equals(device.getFaultStatus());
|
||||||
|
boolean match;
|
||||||
|
switch (mStatusFilter) {
|
||||||
|
case R.id.chip_online:
|
||||||
|
match = online && !fault;
|
||||||
|
break;
|
||||||
|
case R.id.chip_offline:
|
||||||
|
match = !online;
|
||||||
|
break;
|
||||||
|
case R.id.chip_fault:
|
||||||
|
match = fault;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
match = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (match) {
|
||||||
|
filtered.add(device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mAllAdapter.setData(filtered);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开设备详情,接口需要 deviceId
|
||||||
|
*/
|
||||||
|
private void openDeviceDetail(DeviceEntity device) {
|
||||||
|
if (device == null || device.getDeviceId() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
startActivity(DeviceDetailActivity.createIntent(mContext, device.getDeviceId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,18 +294,21 @@ public class DeviceManageActivity extends BaseActivityNoP<DeviceManageLayoutBind
|
|||||||
selected ? "sans-serif-medium" : "sans-serif", Typeface.NORMAL));
|
selected ? "sans-serif-medium" : "sans-serif", Typeface.NORMAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收起键盘后按关键字重新查询
|
||||||
|
*/
|
||||||
private void onSearch() {
|
private void onSearch() {
|
||||||
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||||
if (imm != null) {
|
if (imm != null) {
|
||||||
imm.hideSoftInputFromWindow(viewBinding.etSearch.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(viewBinding.etSearch.getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
ToastUtil.showShort(mContext, R.string.device_manage_search_unavailable);
|
loadDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showError(String message) {
|
public void showError(String message) {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
if (message != null && !message.isEmpty()) {
|
if (!TextUtils.isEmpty(message)) {
|
||||||
ToastUtil.showShort(mContext, message);
|
ToastUtil.showShort(mContext, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import com.ckkj.griddlebiz.base.BaseActivity;
|
|||||||
import com.ckkj.griddlebiz.databinding.DialogProductInboundManualLayoutBinding;
|
import com.ckkj.griddlebiz.databinding.DialogProductInboundManualLayoutBinding;
|
||||||
import com.ckkj.griddlebiz.databinding.ProductInboundLayoutBinding;
|
import com.ckkj.griddlebiz.databinding.ProductInboundLayoutBinding;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
import com.ckkj.griddlebiz.pickup.PickupVerifyActivity;
|
import com.ckkj.griddlebiz.product.entity.ScanPreviewEntity;
|
||||||
import com.ckkj.griddlebiz.product.mvp.ProductInboundContract;
|
import com.ckkj.griddlebiz.product.mvp.ProductInboundContract;
|
||||||
import com.ckkj.griddlebiz.product.mvp.ProductInboundImpl;
|
import com.ckkj.griddlebiz.product.mvp.ProductInboundImpl;
|
||||||
import com.ckkj.griddlebiz.product.mvp.ProductInboundPresenter;
|
import com.ckkj.griddlebiz.product.mvp.ProductInboundPresenter;
|
||||||
@@ -54,7 +54,8 @@ public class ProductInboundActivity extends BaseActivity<ProductInboundLayoutBin
|
|||||||
if (TextUtils.isEmpty(code)) {
|
if (TextUtils.isEmpty(code)) {
|
||||||
ToastUtil.showShort(mContext, R.string.product_scan_empty);
|
ToastUtil.showShort(mContext, R.string.product_scan_empty);
|
||||||
} else {
|
} else {
|
||||||
mPresenter.submitCode(code);
|
showLoadingDialog();
|
||||||
|
mPresenter.previewDevice(code);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -99,8 +100,8 @@ public class ProductInboundActivity extends BaseActivity<ProductInboundLayoutBin
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.tv_manual_entry:
|
case R.id.tv_manual_entry:
|
||||||
// 跳转到提货核销页
|
// 扫码失败时,弹出手动输入编码弹窗
|
||||||
startActivity(new Intent(this, PickupVerifyActivity.class));
|
showManualCodeDialog();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -225,7 +226,8 @@ public class ProductInboundActivity extends BaseActivity<ProductInboundLayoutBin
|
|||||||
ToastUtil.showShort(mContext, R.string.product_manual_code_empty);
|
ToastUtil.showShort(mContext, R.string.product_manual_code_empty);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mPresenter.submitCode(code);
|
showLoadingDialog();
|
||||||
|
mPresenter.previewDevice(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dismissManualCodeDialog() {
|
private void dismissManualCodeDialog() {
|
||||||
@@ -236,10 +238,20 @@ public class ProductInboundActivity extends BaseActivity<ProductInboundLayoutBin
|
|||||||
mManualBinding = null;
|
mManualBinding = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扫码预览成功(文档 5.3):先提示识别到的设备,后续再接入整批入库。
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onCodeSubmitted(String code) {
|
public void onPreviewSuccess(ScanPreviewEntity preview) {
|
||||||
|
hideDialogLoading();
|
||||||
dismissManualCodeDialog();
|
dismissManualCodeDialog();
|
||||||
ToastUtil.showShort(mContext, getString(R.string.product_manual_code_submitted, code));
|
if (preview == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String name = TextUtils.isEmpty(preview.getDeviceName())
|
||||||
|
? preview.getDeviceCode() : preview.getDeviceName();
|
||||||
|
ToastUtil.showShort(mContext, getString(R.string.product_preview_success,
|
||||||
|
name, preview.getDeviceCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.ckkj.griddlebiz.product.mvp;
|
package com.ckkj.griddlebiz.product.mvp;
|
||||||
|
|
||||||
import com.ckkj.griddlebiz.base.IView;
|
import com.ckkj.griddlebiz.base.IView;
|
||||||
|
import com.ckkj.griddlebiz.product.entity.ScanPreviewEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品入库页面的基础 MVP 协议。
|
* 商品入库页面的 MVP 协议。
|
||||||
*/
|
*/
|
||||||
public class ProductInboundContract {
|
public class ProductInboundContract {
|
||||||
|
|
||||||
@@ -15,12 +16,13 @@ public class ProductInboundContract {
|
|||||||
|
|
||||||
public interface DataModel {
|
public interface DataModel {
|
||||||
/**
|
/**
|
||||||
* 提交手动输入的二维码编号;后续接入入库接口时在此实现网络请求。
|
* 扫码预览(文档 5.3):提交设备 SN,返回设备信息
|
||||||
*/
|
*/
|
||||||
void submitCode(String code, CallBack<String> callback);
|
void previewDevice(String deviceCode, CallBack<ScanPreviewEntity> callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ProductInboundView extends IView {
|
public interface ProductInboundView extends IView {
|
||||||
void onCodeSubmitted(String code);
|
// 扫码预览成功
|
||||||
|
void onPreviewSuccess(ScanPreviewEntity preview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,63 @@
|
|||||||
package com.ckkj.griddlebiz.product.mvp;
|
package com.ckkj.griddlebiz.product.mvp;
|
||||||
|
|
||||||
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
|
import com.ckkj.griddlebiz.network.NetWorkManager;
|
||||||
|
import com.ckkj.griddlebiz.product.entity.ScanPreviewEntity;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.annotations.NonNull;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品入库数据层。当前仅保留基础回调结构,后续在此接入真实入库接口。
|
* 商品入库数据层。
|
||||||
*/
|
*/
|
||||||
public class ProductInboundImpl implements ProductInboundContract.DataModel {
|
public class ProductInboundImpl implements ProductInboundContract.DataModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扫码预览(文档 5.3)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void submitCode(String code, ProductInboundContract.CallBack<String> callback) {
|
public void previewDevice(String deviceCode,
|
||||||
callback.success(code);
|
ProductInboundContract.CallBack<ScanPreviewEntity> callback) {
|
||||||
|
try {
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("deviceCode", deviceCode);
|
||||||
|
NetWorkManager.getRequest()
|
||||||
|
.previewProductStockIn(NetWorkManager.getToken(),
|
||||||
|
NetWorkManager.toRequestBody(json))
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.unsubscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<BaseBean<ScanPreviewEntity>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseBean<ScanPreviewEntity> bean) {
|
||||||
|
if (bean.getCode() == 200 && bean.getData() != null) {
|
||||||
|
callback.success(bean.getData());
|
||||||
|
} else {
|
||||||
|
callback.fail(bean.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
callback.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
callback.fail(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.ckkj.griddlebiz.product.mvp;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.ckkj.griddlebiz.base.BasePresenter;
|
import com.ckkj.griddlebiz.base.BasePresenter;
|
||||||
|
import com.ckkj.griddlebiz.product.entity.ScanPreviewEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品入库业务协调层。
|
* 商品入库业务协调层。
|
||||||
@@ -15,7 +16,10 @@ public class ProductInboundPresenter extends BasePresenter<ProductInboundContrac
|
|||||||
this.mImpl = impl;
|
this.mImpl = impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submitCode(String code) {
|
/**
|
||||||
|
* 扫码 / 手动输入后调用 5.3 预览接口
|
||||||
|
*/
|
||||||
|
public void previewDevice(String code) {
|
||||||
String value = code == null ? "" : code.trim();
|
String value = code == null ? "" : code.trim();
|
||||||
if (TextUtils.isEmpty(value)) {
|
if (TextUtils.isEmpty(value)) {
|
||||||
if (getView() != null) {
|
if (getView() != null) {
|
||||||
@@ -23,11 +27,11 @@ public class ProductInboundPresenter extends BasePresenter<ProductInboundContrac
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mImpl.submitCode(value, new ProductInboundContract.CallBack<String>() {
|
mImpl.previewDevice(value, new ProductInboundContract.CallBack<ScanPreviewEntity>() {
|
||||||
@Override
|
@Override
|
||||||
public void success(String data) {
|
public void success(ScanPreviewEntity data) {
|
||||||
if (getView() != null) {
|
if (getView() != null) {
|
||||||
getView().onCodeSubmitted(data);
|
getView().onPreviewSuccess(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,22 +7,30 @@ import android.text.Spanned;
|
|||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.ckkj.griddlebiz.AppConfig;
|
||||||
import com.ckkj.griddlebiz.R;
|
import com.ckkj.griddlebiz.R;
|
||||||
import com.ckkj.griddlebiz.base.BaseActivityNoP;
|
import com.ckkj.griddlebiz.base.BaseActivity;
|
||||||
import com.ckkj.griddlebiz.databinding.StatisticsLayoutBinding;
|
import com.ckkj.griddlebiz.databinding.StatisticsLayoutBinding;
|
||||||
|
import com.ckkj.griddlebiz.main.entity.SummaryEntity;
|
||||||
import com.ckkj.griddlebiz.network.BaseBean;
|
import com.ckkj.griddlebiz.network.BaseBean;
|
||||||
|
import com.ckkj.griddlebiz.statistics.mvp.StatisticsContract;
|
||||||
|
import com.ckkj.griddlebiz.statistics.mvp.StatisticsImpl;
|
||||||
|
import com.ckkj.griddlebiz.statistics.mvp.StatisticsPresenter;
|
||||||
import com.ckkj.griddlebiz.statistics.widget.BarChartView;
|
import com.ckkj.griddlebiz.statistics.widget.BarChartView;
|
||||||
import com.ckkj.griddlebiz.statistics.widget.DonutChartView;
|
import com.ckkj.griddlebiz.statistics.widget.DonutChartView;
|
||||||
import com.ckkj.griddlebiz.utils.show.ToastUtil;
|
import com.ckkj.griddlebiz.utils.show.ToastUtil;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据统计:顶部 Tab 切换"数据统计"和"故障分析"。
|
* 数据统计:顶部 Tab 切换"数据统计"和"故障分析"。
|
||||||
* 统计数据与图表数值目前使用设计稿示例,后续接入统计接口时替换。
|
* 库存结构数据来自经营统计接口(文档 3.2),其余图表暂用设计稿示例。
|
||||||
*/
|
*/
|
||||||
public class StatisticsActivity extends BaseActivityNoP<StatisticsLayoutBinding> {
|
public class StatisticsActivity extends BaseActivity<StatisticsLayoutBinding, StatisticsPresenter>
|
||||||
|
implements StatisticsContract.StatisticsView {
|
||||||
|
|
||||||
/** 故障类型占比:按设计稿环形图的扇形顺序(橙、紫、红、蓝)。 */
|
/** 故障类型占比:按设计稿环形图的扇形顺序(橙、紫、红、蓝)。 */
|
||||||
private static final float[] FAULT_PERCENTS = {29f, 25f, 19f, 27f};
|
private static final float[] FAULT_PERCENTS = {29f, 25f, 19f, 27f};
|
||||||
@@ -36,6 +44,11 @@ public class StatisticsActivity extends BaseActivityNoP<StatisticsLayoutBinding>
|
|||||||
private static final float[] DURATION_VALUES = {59f, 38f, 42f, 18f, 52f};
|
private static final float[] DURATION_VALUES = {59f, 38f, 42f, 18f, 52f};
|
||||||
private static final String[] DURATION_LABELS = {"500", "1000", "1500", "2000", "3000"};
|
private static final String[] DURATION_LABELS = {"500", "1000", "1500", "2000", "3000"};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StatisticsPresenter createPresenter() {
|
||||||
|
return new StatisticsPresenter(new StatisticsImpl());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutResId(Bundle savedInstanceState) {
|
public int getLayoutResId(Bundle savedInstanceState) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -52,6 +65,11 @@ public class StatisticsActivity extends BaseActivityNoP<StatisticsLayoutBinding>
|
|||||||
initCharts();
|
initCharts();
|
||||||
initLegends();
|
initLegends();
|
||||||
selectTab(true);
|
selectTab(true);
|
||||||
|
|
||||||
|
// 登录后拉取经营统计,未登录时保留设计稿示例
|
||||||
|
if (AppConfig.USER_LOGIN) {
|
||||||
|
mPresenter.getStatistics();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -143,6 +161,53 @@ public class StatisticsActivity extends BaseActivityNoP<StatisticsLayoutBinding>
|
|||||||
statsSelected ? Typeface.NORMAL : Typeface.BOLD));
|
statsSelected ? Typeface.NORMAL : Typeface.BOLD));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经营统计加载成功(文档 3.2)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void getStatisticsSuccess(SummaryEntity summary) {
|
||||||
|
bindSummary(summary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将接口返回的经营概况绑定到统计卡与库存结构图
|
||||||
|
*/
|
||||||
|
private void bindSummary(SummaryEntity summary) {
|
||||||
|
if (summary == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
viewBinding.tvStatsTotal.setText(String.valueOf(summary.getTotalDevices()));
|
||||||
|
|
||||||
|
// 环形图按接口返回的占比重新绘制
|
||||||
|
float soldRatio = toFloat(summary.getSoldRatio());
|
||||||
|
float inventoryRatio = toFloat(summary.getInventoryRatio());
|
||||||
|
if (soldRatio + inventoryRatio > 0) {
|
||||||
|
viewBinding.donutStats.setData(new float[]{soldRatio, inventoryRatio}, STOCK_COLORS);
|
||||||
|
}
|
||||||
|
|
||||||
|
viewBinding.tvLegendSold.setText(boldPercent(getString(R.string.statistics_legend_sold,
|
||||||
|
String.valueOf(summary.getSold()), formatPercent(summary.getSoldRatio()))));
|
||||||
|
viewBinding.tvLegendStock.setText(boldPercent(getString(R.string.statistics_legend_stock,
|
||||||
|
String.valueOf(summary.getInventory()), formatPercent(summary.getInventoryRatio()))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BigDecimal 占比转图表需要的 float,空值按 0 处理
|
||||||
|
*/
|
||||||
|
private float toFloat(BigDecimal value) {
|
||||||
|
return value == null ? 0f : value.floatValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 占比去掉多余的 0 后拼接百分号
|
||||||
|
*/
|
||||||
|
private String formatPercent(BigDecimal value) {
|
||||||
|
if (value == null) {
|
||||||
|
return "0%";
|
||||||
|
}
|
||||||
|
return value.stripTrailingZeros().toPlainString() + "%";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showError(String message) {
|
public void showError(String message) {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|||||||
@@ -66,5 +66,8 @@ public class MingDengUserInfoManager {
|
|||||||
AppConfig.RONG_CLOUD_TALK_TOKEN = "";
|
AppConfig.RONG_CLOUD_TALK_TOKEN = "";
|
||||||
AppConfig.USER_ID = "";
|
AppConfig.USER_ID = "";
|
||||||
AppConfig.USER_RONGCLOUD_ID = "";
|
AppConfig.USER_RONGCLOUD_ID = "";
|
||||||
|
// 同步清空内存缓存,避免退出后仍能读到旧资料
|
||||||
|
entity = null;
|
||||||
|
userInfo = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,7 @@
|
|||||||
android:src="@mipmap/icon_device_detail_banner_online" />
|
android:src="@mipmap/icon_device_detail_banner_online" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_online_banner"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -110,6 +111,7 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_fault_banner"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -119,6 +121,7 @@
|
|||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_fault_time"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="15dp"
|
android:layout_height="15dp"
|
||||||
@@ -148,6 +151,7 @@
|
|||||||
android:src="@mipmap/icon_device_detail_banner_offline" />
|
android:src="@mipmap/icon_device_detail_banner_offline" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_offline_banner"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -183,6 +187,7 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_device_code"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="17dp"
|
android:layout_height="17dp"
|
||||||
@@ -192,6 +197,7 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_device_name"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="15dp"
|
android:layout_height="15dp"
|
||||||
@@ -267,6 +273,7 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_info_sn"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -308,6 +315,7 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_info_model"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -349,6 +357,7 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_info_owner"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -391,6 +400,7 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_info_user"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -432,6 +442,7 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_info_activation_time"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -473,6 +484,7 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_info_location"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -515,6 +527,7 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_info_runtime"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -300,482 +300,15 @@
|
|||||||
android:textColor="#666666"
|
android:textColor="#666666"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rv_devices"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:orientation="vertical"
|
android:clipToPadding="false"
|
||||||
android:paddingBottom="24dp">
|
android:nestedScrollingEnabled="false"
|
||||||
|
android:overScrollMode="never"
|
||||||
<!-- 在线设备 -->
|
android:paddingBottom="24dp" />
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/card_online"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="130dp"
|
|
||||||
android:layout_marginHorizontal="24dp"
|
|
||||||
android:background="@drawable/device_manage_card_bg"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:contentDescription="@null"
|
|
||||||
android:src="@mipmap/icon_device_manage_box" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:text="SN-AIR2024031201"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:text="KF-800 → Air Purifier KF-800"
|
|
||||||
android:textColor="#999999"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="27dp"
|
|
||||||
android:layout_gravity="top"
|
|
||||||
android:background="@drawable/device_manage_status_online_bg"
|
|
||||||
android:gravity="center"
|
|
||||||
android:minWidth="68dp"
|
|
||||||
android:paddingHorizontal="16dp"
|
|
||||||
android:text="@string/device_manage_status_online"
|
|
||||||
android:textColor="#22A45D"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0.5dp"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:background="#DDDDDD" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="13dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="121dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_activation_date"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="2026-10-13"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="112dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_total_runtime"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="13h"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_fault_status"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="@string/device_manage_fault_normal"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- 故障设备 -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/card_fault"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="130dp"
|
|
||||||
android:layout_marginStart="24dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginEnd="24dp"
|
|
||||||
android:background="@drawable/device_manage_card_bg"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:contentDescription="@null"
|
|
||||||
android:src="@mipmap/icon_device_manage_box" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:text="SN-AIR2024031201"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:text="KF-800 → Air Purifier KF-800"
|
|
||||||
android:textColor="#999999"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="27dp"
|
|
||||||
android:layout_gravity="top"
|
|
||||||
android:background="@drawable/device_manage_status_fault_bg"
|
|
||||||
android:gravity="center"
|
|
||||||
android:minWidth="68dp"
|
|
||||||
android:paddingHorizontal="16dp"
|
|
||||||
android:text="@string/device_manage_status_fault"
|
|
||||||
android:textColor="#E5484D"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0.5dp"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:background="#DDDDDD" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="13dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="121dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_activation_date"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="2026-10-13"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="112dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_total_runtime"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="13h"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_fault_status"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="@string/device_manage_fault_normal"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- 离线设备:整张卡片弱化 -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/card_offline"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="130dp"
|
|
||||||
android:layout_marginStart="24dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginEnd="24dp"
|
|
||||||
android:background="@drawable/device_manage_card_bg"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:contentDescription="@null"
|
|
||||||
android:src="@mipmap/icon_device_manage_box_offline" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:text="SN-AIR2024031201"
|
|
||||||
android:textColor="#999999"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:text="KF-800 → Air Purifier KF-800"
|
|
||||||
android:textColor="#999999"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="27dp"
|
|
||||||
android:layout_gravity="top"
|
|
||||||
android:background="@drawable/device_manage_status_offline_bg"
|
|
||||||
android:gravity="center"
|
|
||||||
android:minWidth="68dp"
|
|
||||||
android:paddingHorizontal="16dp"
|
|
||||||
android:text="@string/device_manage_status_offline"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0.5dp"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:background="#DDDDDD" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="13dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="121dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_activation_date"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="2026-10-13"
|
|
||||||
android:textColor="#999999"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="112dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_total_runtime"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="13h"
|
|
||||||
android:textColor="#999999"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_fault_status"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="@string/device_manage_fault_normal"
|
|
||||||
android:textColor="#999999"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
@@ -873,6 +406,7 @@
|
|||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
|
android:id="@+id/tv_pending_total"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="8"
|
android:text="8"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
@@ -935,267 +469,15 @@
|
|||||||
android:textColor="#666666"
|
android:textColor="#666666"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rv_pending"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:orientation="vertical"
|
android:clipToPadding="false"
|
||||||
android:paddingBottom="24dp">
|
android:nestedScrollingEnabled="false"
|
||||||
|
android:overScrollMode="never"
|
||||||
<!-- 未激活 -->
|
android:paddingBottom="24dp" />
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="130dp"
|
|
||||||
android:layout_marginHorizontal="24dp"
|
|
||||||
android:background="@drawable/device_manage_card_bg"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:contentDescription="@null"
|
|
||||||
android:src="@mipmap/icon_device_manage_box" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:text="SN-AIR2024031201"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:text="KF-800 → Air Purifier KF-800"
|
|
||||||
android:textColor="#999999"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:layout_gravity="top"
|
|
||||||
android:text="@string/device_manage_not_activated"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0.5dp"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:background="#DDDDDD" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="13dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="121dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_stock_in_date"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="2026-10-13"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_activation_time_column"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="--"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- 已售未激活 -->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="130dp"
|
|
||||||
android:layout_marginStart="24dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginEnd="24dp"
|
|
||||||
android:background="@drawable/device_manage_card_bg"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:contentDescription="@null"
|
|
||||||
android:src="@mipmap/icon_device_manage_box" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:text="SN-AIR2024031201"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:text="KF-800 → Air Purifier KF-800"
|
|
||||||
android:textColor="#999999"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:layout_gravity="top"
|
|
||||||
android:text="@string/device_manage_sold_not_activated"
|
|
||||||
android:textColor="#FF6900"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0.5dp"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:background="#DDDDDD" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="14dp"
|
|
||||||
android:layout_marginTop="13dp"
|
|
||||||
android:layout_marginEnd="14dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="121dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_stock_in_date"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="2026-10-13"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:text="@string/device_manage_activation_time_column"
|
|
||||||
android:textColor="#666666"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="17dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="2026-10-13"
|
|
||||||
android:textColor="#222222"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_loading"
|
android:id="@+id/img_loading"
|
||||||
android:layout_width="@dimen/dp_80"
|
android:layout_width="@dimen/dp_50"
|
||||||
android:layout_height="@dimen/dp_80"
|
android:layout_height="@dimen/dp_50"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
android:src="@mipmap/icon_refresh_logo"/>
|
android:src="@mipmap/loading_ls"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
android:layout_width="@dimen/dp_50"
|
android:layout_width="@dimen/dp_50"
|
||||||
android:layout_height="@dimen/dp_50"
|
android:layout_height="@dimen/dp_50"
|
||||||
android:layout_marginTop="@dimen/dp_3"
|
android:layout_marginTop="@dimen/dp_3"
|
||||||
android:src="@mipmap/icon_loading_taiji"
|
android:src="@mipmap/loading_ls"
|
||||||
android:visibility="visible"/>
|
android:visibility="visible"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
@@ -185,6 +185,7 @@
|
|||||||
style="@style/HomeStatValue"
|
style="@style/HomeStatValue"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
|
android:id="@+id/tv_total_devices_value"
|
||||||
android:text="159"
|
android:text="159"
|
||||||
android:textColor="#FF6900" />
|
android:textColor="#FF6900" />
|
||||||
|
|
||||||
@@ -245,6 +246,7 @@
|
|||||||
style="@style/HomeStatValue"
|
style="@style/HomeStatValue"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
|
android:id="@+id/tv_online_devices_value"
|
||||||
android:text="123"
|
android:text="123"
|
||||||
android:textColor="#38BE2C" />
|
android:textColor="#38BE2C" />
|
||||||
|
|
||||||
@@ -309,6 +311,7 @@
|
|||||||
style="@style/HomeStatValue"
|
style="@style/HomeStatValue"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
|
android:id="@+id/tv_activated_value"
|
||||||
android:text="28"
|
android:text="28"
|
||||||
android:textColor="#00AEFF" />
|
android:textColor="#00AEFF" />
|
||||||
|
|
||||||
@@ -369,6 +372,7 @@
|
|||||||
style="@style/HomeStatValue"
|
style="@style/HomeStatValue"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
|
android:id="@+id/tv_reduction_value"
|
||||||
android:text="4529"
|
android:text="4529"
|
||||||
android:textColor="#BF40FF" />
|
android:textColor="#BF40FF" />
|
||||||
|
|
||||||
@@ -465,27 +469,6 @@
|
|||||||
android:text="@string/home_statistics" />
|
android:text="@string/home_statistics" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/action_after_sales"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="60dp"
|
|
||||||
android:contentDescription="@null"
|
|
||||||
android:src="@mipmap/icon_home_after_sales" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/HomeQuickLabel"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
android:text="@string/home_after_sales" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/action_pickup_verification"
|
android:id="@+id/action_pickup_verification"
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
app:cardPreventCornerOverlap="false">
|
app:cardPreventCornerOverlap="false">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/iv_company_avatar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
@@ -74,6 +75,7 @@
|
|||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_company_name"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="169dp"
|
android:layout_width="169dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
@@ -106,6 +108,7 @@
|
|||||||
android:src="@mipmap/icon_home_location" />
|
android:src="@mipmap/icon_home_location" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_company_location"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingStart="14dp"
|
android:paddingStart="14dp"
|
||||||
android:paddingEnd="14dp"
|
android:paddingEnd="14dp"
|
||||||
android:text="@string/mine_info_sample_unit"
|
android:hint="@string/mine_info_sample_unit"
|
||||||
android:textColor="#666666"
|
android:textColor="#666666"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingStart="14dp"
|
android:paddingStart="14dp"
|
||||||
android:paddingEnd="14dp"
|
android:paddingEnd="14dp"
|
||||||
android:text="@string/mine_info_sample_contact"
|
android:hint="@string/mine_info_sample_contact"
|
||||||
android:textColor="#666666"
|
android:textColor="#666666"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingStart="14dp"
|
android:paddingStart="14dp"
|
||||||
android:paddingEnd="14dp"
|
android:paddingEnd="14dp"
|
||||||
android:text="@string/mine_info_sample_phone"
|
android:hint="@string/mine_info_sample_phone"
|
||||||
android:textColor="#666666"
|
android:textColor="#666666"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@
|
|||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingStart="14dp"
|
android:paddingStart="14dp"
|
||||||
android:paddingEnd="14dp"
|
android:paddingEnd="14dp"
|
||||||
android:text="@string/mine_info_sample_address"
|
android:hint="@string/mine_info_sample_address"
|
||||||
android:textColor="#666666"
|
android:textColor="#666666"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
|||||||
@@ -55,9 +55,9 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_scan"
|
android:id="@+id/iv_scan"
|
||||||
android:layout_width="88dp"
|
android:layout_width="118dp"
|
||||||
android:layout_height="88dp"
|
android:layout_height="118dp"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="20dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:contentDescription="@string/product_inbound_scan_tip"
|
android:contentDescription="@string/product_inbound_scan_tip"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
|
|||||||
@@ -341,6 +341,7 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_stats_total"
|
||||||
style="@style/HomeText"
|
style="@style/HomeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="29dp"
|
android:layout_height="29dp"
|
||||||
|
|||||||
@@ -7,5 +7,5 @@
|
|||||||
android:id="@+id/ivRefresh"
|
android:id="@+id/ivRefresh"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:src="@mipmap/icon_refresh_logo" />
|
android:src="@mipmap/ic_launcher" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
BIN
app/src/main/res/mipmap-xxxhdpi/loading_ls.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/loading_ls.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 954 B |
@@ -1,6 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="device_detail_title">Device Details</string>
|
<string name="device_detail_title">Device Details</string>
|
||||||
|
<string name="device_detail_load_failed">Failed to load device information, please try again</string>
|
||||||
|
<string name="device_detail_banner_online_time">Device is running normally with a good signal ·\nLast online: %1$s</string>
|
||||||
|
<string name="device_detail_banner_offline_time">Last online %1$s · Data will update automatically after the device reconnects</string>
|
||||||
<string name="device_detail_section_info">Device Info</string>
|
<string name="device_detail_section_info">Device Info</string>
|
||||||
<string name="device_detail_label_sn">Device SN</string>
|
<string name="device_detail_label_sn">Device SN</string>
|
||||||
<string name="device_detail_label_model">Device Model</string>
|
<string name="device_detail_label_model">Device Model</string>
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
<string name="mine_center_privacy">Privacy Policy</string>
|
<string name="mine_center_privacy">Privacy Policy</string>
|
||||||
<string name="mine_center_manual">User Manual</string>
|
<string name="mine_center_manual">User Manual</string>
|
||||||
<string name="mine_center_sign_out">Sign Out</string>
|
<string name="mine_center_sign_out">Sign Out</string>
|
||||||
|
<string name="mine_center_logout_success">Signed out</string>
|
||||||
|
<string name="mine_center_logout_failed">Sign out failed, please try again</string>
|
||||||
<string name="mine_center_unavailable">This feature is not connected yet</string>
|
<string name="mine_center_unavailable">This feature is not connected yet</string>
|
||||||
<string name="mine_center_company">Huadong Youxuan Electrical</string>
|
<string name="mine_center_company">Huadong Youxuan Electrical</string>
|
||||||
<string name="mine_center_location">Zhejiang Province - Hangzhou City - Xihu District</string>
|
<string name="mine_center_location">Zhejiang Province - Hangzhou City - Xihu District</string>
|
||||||
|
|||||||
@@ -26,6 +26,11 @@
|
|||||||
<string name="mine_info_permission_content">Taking photos of your certificates requires the camera. If you decline, you can still choose images from the gallery.</string>
|
<string name="mine_info_permission_content">Taking photos of your certificates requires the camera. If you decline, you can still choose images from the gallery.</string>
|
||||||
<string name="mine_info_permission_denied">Camera permission was not granted. You can choose from the gallery instead.</string>
|
<string name="mine_info_permission_denied">Camera permission was not granted. You can choose from the gallery instead.</string>
|
||||||
<string name="mine_info_camera_failed">Unable to open the camera</string>
|
<string name="mine_info_camera_failed">Unable to open the camera</string>
|
||||||
|
<string name="mine_info_contact_required">Please enter a contact person</string>
|
||||||
|
<string name="mine_info_contact_too_long">Contact person must be 30 characters or fewer</string>
|
||||||
|
<string name="mine_info_upload_success">Image uploaded</string>
|
||||||
|
<string name="mine_info_upload_failed">Image upload failed, please try again</string>
|
||||||
|
<string name="mine_info_profile_not_ready">Profile is still loading, please try again later</string>
|
||||||
<string name="mine_info_sample_unit">Hangzhou Zhikao Electrical Appliance Co., Ltd.</string>
|
<string name="mine_info_sample_unit">Hangzhou Zhikao Electrical Appliance Co., Ltd.</string>
|
||||||
<string name="mine_info_sample_contact">Chen Zhiyuan</string>
|
<string name="mine_info_sample_contact">Chen Zhiyuan</string>
|
||||||
<string name="mine_info_sample_phone">138 0013 8000</string>
|
<string name="mine_info_sample_phone">138 0013 8000</string>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<string name="product_camera_permission_denied">Camera permission was not granted. You can enter the SN code manually.</string>
|
<string name="product_camera_permission_denied">Camera permission was not granted. You can enter the SN code manually.</string>
|
||||||
<string name="product_camera_unavailable">No camera is available on this device. Please enter the SN code manually.</string>
|
<string name="product_camera_unavailable">No camera is available on this device. Please enter the SN code manually.</string>
|
||||||
<string name="product_scan_empty">No barcode was detected. Please try again.</string>
|
<string name="product_scan_empty">No barcode was detected. Please try again.</string>
|
||||||
|
<string name="product_preview_success">Device found: %1$s (%2$s)</string>
|
||||||
<string name="product_scan_title">Scan to Inbound</string>
|
<string name="product_scan_title">Scan to Inbound</string>
|
||||||
<string name="product_scan_gallery">Choose from Gallery</string>
|
<string name="product_scan_gallery">Choose from Gallery</string>
|
||||||
<string name="product_scan_decoding">Decoding image…</string>
|
<string name="product_scan_decoding">Decoding image…</string>
|
||||||
|
|||||||
@@ -11,7 +11,10 @@
|
|||||||
<string name="device_detail_label_runtime">累计运行</string>
|
<string name="device_detail_label_runtime">累计运行</string>
|
||||||
|
|
||||||
<string name="device_detail_banner_online">设备运行正常,信号良好 ·\n最近在线:刚刚</string>
|
<string name="device_detail_banner_online">设备运行正常,信号良好 ·\n最近在线:刚刚</string>
|
||||||
|
<string name="device_detail_banner_online_time">设备运行正常,信号良好 ·\n最近在线:%1$s</string>
|
||||||
|
<string name="device_detail_banner_offline_time">最近在线 %1$s ・设备重新连接后数据将自动更新</string>
|
||||||
<string name="device_detail_banner_fault">E04 过热保护 | 温度 > 260°C・\n已自动断电</string>
|
<string name="device_detail_banner_fault">E04 过热保护 | 温度 > 260°C・\n已自动断电</string>
|
||||||
<string name="device_detail_banner_fault_time">触发时间 2024-05-18 14:32 ・持续 2 小时 18 分</string>
|
<string name="device_detail_banner_fault_time">触发时间 2024-05-18 14:32 ・持续 2 小时 18 分</string>
|
||||||
<string name="device_detail_banner_offline">最近在线 2024-05-20 08:12 ・已离线 6 小时。设备重新连接后数据将自动更新</string>
|
<string name="device_detail_banner_offline">最近在线 2024-05-20 08:12 ・已离线 6 小时。设备重新连接后数据将自动更新</string>
|
||||||
|
<string name="device_detail_load_failed">设备信息加载失败,请重试</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
<string name="mine_center_privacy">隐私政策</string>
|
<string name="mine_center_privacy">隐私政策</string>
|
||||||
<string name="mine_center_manual">使用手册</string>
|
<string name="mine_center_manual">使用手册</string>
|
||||||
<string name="mine_center_sign_out">退出登录</string>
|
<string name="mine_center_sign_out">退出登录</string>
|
||||||
|
<string name="mine_center_logout_success">已退出登录</string>
|
||||||
|
<string name="mine_center_logout_failed">退出失败,请稍后重试</string>
|
||||||
<string name="mine_center_unavailable">功能待接入</string>
|
<string name="mine_center_unavailable">功能待接入</string>
|
||||||
<string name="mine_center_company">华东优选电气</string>
|
<string name="mine_center_company">华东优选电气</string>
|
||||||
<string name="mine_center_location">浙江省 - 杭州市 - 西湖区</string>
|
<string name="mine_center_location">浙江省 - 杭州市 - 西湖区</string>
|
||||||
|
|||||||
@@ -26,6 +26,11 @@
|
|||||||
<string name="mine_info_permission_content">上传单位证照需要使用相机拍摄照片。拒绝或取消授权不影响从相册选择图片。</string>
|
<string name="mine_info_permission_content">上传单位证照需要使用相机拍摄照片。拒绝或取消授权不影响从相册选择图片。</string>
|
||||||
<string name="mine_info_permission_denied">未获得相机权限,可从相册选择图片</string>
|
<string name="mine_info_permission_denied">未获得相机权限,可从相册选择图片</string>
|
||||||
<string name="mine_info_camera_failed">无法打开相机</string>
|
<string name="mine_info_camera_failed">无法打开相机</string>
|
||||||
|
<string name="mine_info_contact_required">请填写联系人</string>
|
||||||
|
<string name="mine_info_contact_too_long">联系人不能超过 30 个字符</string>
|
||||||
|
<string name="mine_info_upload_success">图片上传成功</string>
|
||||||
|
<string name="mine_info_upload_failed">图片上传失败,请重试</string>
|
||||||
|
<string name="mine_info_profile_not_ready">资料尚未加载完成,请稍后重试</string>
|
||||||
<string name="mine_info_sample_unit">杭州智考电器有限公司</string>
|
<string name="mine_info_sample_unit">杭州智考电器有限公司</string>
|
||||||
<string name="mine_info_sample_contact">陈志远</string>
|
<string name="mine_info_sample_contact">陈志远</string>
|
||||||
<string name="mine_info_sample_phone">138 0013 8000</string>
|
<string name="mine_info_sample_phone">138 0013 8000</string>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<string name="product_camera_permission_denied">未获得相机权限,可手动输入 SN 码</string>
|
<string name="product_camera_permission_denied">未获得相机权限,可手动输入 SN 码</string>
|
||||||
<string name="product_camera_unavailable">当前设备没有可用相机,请手动输入 SN 码</string>
|
<string name="product_camera_unavailable">当前设备没有可用相机,请手动输入 SN 码</string>
|
||||||
<string name="product_scan_empty">未识别到条码,请重试</string>
|
<string name="product_scan_empty">未识别到条码,请重试</string>
|
||||||
|
<string name="product_preview_success">识别成功:%1$s(%2$s)</string>
|
||||||
<string name="product_scan_title">扫码入库</string>
|
<string name="product_scan_title">扫码入库</string>
|
||||||
<string name="product_scan_gallery">从相册选择</string>
|
<string name="product_scan_gallery">从相册选择</string>
|
||||||
<string name="product_scan_decoding">正在识别图片…</string>
|
<string name="product_scan_decoding">正在识别图片…</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user