mac
2024-03-27 05df9bdaf543227c53f8026386339a3d78c5d769
app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
@@ -68,6 +68,8 @@
    @Override
    public void onBindView(Bundle savedInstanceState) {
        setNotificationBarBackgroundColor(CustomColor.white);
        setStatusBarTextColor();
        //C端启动App自动打开小程序电站详情界面
        startAppAutomaticallyOpenUni();
        //注册监听
@@ -76,6 +78,13 @@
        this.initMqttClient();
        //上传极光注册ID到云端
        this.pushTokens();
    }
    @Override
    protected void onResume() {
        super.onResume();
        //目的是为启动页遮住下一页
        AppManagerUtils.getAppManager().finishActivity(StartActivity.class);
    }
    @Subscribe(threadMode = ThreadMode.MAIN)
@@ -157,8 +166,48 @@
                    }
                });
            }
        } else if (event.getTopic().contains(HDLUniMP.UNI_EVENT_REPLY_OTHER_MODEL)
                && event.getType().contains(HDLUniMP.UNI_EVENT_REPLY_OTHER_BACK)) {
        } else if (event.getTopic().contains(HDLUniMP.UNI_EVENT_REPLY_OTHER_MODEL) && event.getType().contains(HDLUniMP.UNI_EVENT_REPLY_OTHER_BACK)) {
            //物理按键返回事件(包括左滑移除事件)
            killProcessApp();
        }
    }
    /**
     * C端启动App自动打开小程序电站详情界面
     */
    private void startAppAutomaticallyOpenUni() {
        List<HouseIdBean> HouseIdList = HdlResidenceLogic.getInstance().getHouseIdList();
        if (HouseIdList.size() == 0) {
            String path = HDLUniMP.UNI_EVENT_OPEN_HOME_Null_C;
            HdlUniLogic.getInstance().openUniMP(path, null);
        } else {
            int select_home = 0;
            for (int i = 0; i < HouseIdList.size(); i++) {
                if (HouseIdList.get(i).getHomeId().equals(UserConfigManage.getInstance().getHomeId())) {
                    select_home = i;
                    break;
                }
            }
            HouseIdBean houseIdBean = HouseIdList.get(select_home);
            HdlResidenceLogic.getInstance().switchHouse(houseIdBean);
            String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS_C + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus();
            HdlUniLogic.getInstance().openUniMP(path, null);
        }
    }
//    /**
//     * 物理按键返回事件(包括左滑移除事件)
//     */
//    @Override
//    public void onBackPressed() {
//        killProcessApp();
//        super.onBackPressed();
//    }
    private void killProcessApp() {
            //物理按键返回事件(包括左滑移除事件)
            if (AppManagerUtils.getAppManager().getActivitySize() <= 1) {
                if (backPressTimes == 0) {
@@ -183,39 +232,9 @@
                        HDLUniMPSDKManager.getInstance().getUniMP().closeUniMP();
                    }
                    AppManagerUtils.getAppManager().finishAllActivity();
                    HDLUniMPSDKManager.getInstance().initDCUniMPSDK(HDLApp.getInstance());
                    Process.killProcess(Process.myPid());
                }
            }
        }
    }
    /**
     * C端启动App自动打开小程序电站详情界面
     */
    private void startAppAutomaticallyOpenUni() {
        List<HouseIdBean> HouseIdList = HdlResidenceLogic.getInstance().getHouseIdList();
        if (HouseIdList.size() == 0) {
            String path = HDLUniMP.UNI_EVENT_OPEN_HOME_Null_C;
            HdlUniLogic.getInstance().openUniMP(path, null);
        } else {
            int select_home = 0;
            for (int i = 0; i < HouseIdList.size(); i++) {
                if (HouseIdList.get(i).getHomeId().equals(UserConfigManage.getInstance().getHomeId())) {
                    select_home = i;
                    break;
                }
            }
            HouseIdBean houseIdBean = HouseIdList.get(select_home);
            HdlResidenceLogic.getInstance().switchHouse(houseIdBean);
            String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS_C
                    + "?homeId=" + houseIdBean.getHomeId()
                    + "&homeName=" + houseIdBean.getHomeName()
                    + "&powerStationStatus=" + houseIdBean.getPowerStationStatus();
            HdlUniLogic.getInstance().openUniMP(path, null);
        }
    }