| | |
| | | import android.content.pm.PackageManager; |
| | | import android.hardware.camera2.CameraManager; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.view.View; |
| | | |
| | | import androidx.annotation.NonNull; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.config.AppConfigManage; |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.databinding.FragmentHouseListBinding; |
| | | import com.hdl.photovoltaic.base.CustomBaseFragment; |
| | | import com.hdl.photovoltaic.enums.ShowErrorMode; |
| | |
| | | //点击住宅详情 |
| | | HdlLogLogic.print("点击住宅详情===" + new Gson().toJson(houseIdBean), false); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean); |
| | | String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName(); |
| | | String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS |
| | | + "?homeId=" + houseIdBean.getHomeId() |
| | | + "&homeName=" + houseIdBean.getHomeName() |
| | | + "&powerStationStatus=" + houseIdBean.getPowerStationStatus() |
| | | + "&serverAddress=" + AppConfigManage.getUserRegionUrl(); |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | | |
| | | } |
| | |
| | | |
| | | private void initData() { |
| | | this.houseListBeanIDList = new ArrayList<>(); |
| | | // for (int i = 0; i < 11; i++) { |
| | | // HouseListBean houseListBean = new HouseListBean(); |
| | | // houseListBean.setHomeName("电站" + i); |
| | | // this.houseListBeanList.add(houseListBean); |
| | | // } |
| | | this.houseListBeanIDList.addAll(HdlResidenceLogic.getInstance().getHouseIdList()); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void onEventMessage(BaseEventBus eventBus) { |
| | | super.onEventMessage(eventBus); |
| | | if (HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION.equals(eventBus.getType())) { |
| | | //uin创建电站成功后通知 |
| | | updateUIData(false); |
| | | if (eventBus.getData() != null) { |
| | | Gson gson = new Gson(); |
| | | String json = eventBus.getData().toString(); |
| | | HouseIdBean houseIdBean = gson.fromJson(json, HouseIdBean.class); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean); |
| | | if (HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL.equals(eventBus.getTopic())) { |
| | | if (HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION.equals(eventBus.getType())) { |
| | | //uin创建电站成功后通知 |
| | | updateUIData(false); |
| | | if (eventBus.getData() != null) { |
| | | Gson gson = new Gson(); |
| | | String json = eventBus.getData().toString(); |
| | | HouseIdBean houseIdBean = gson.fromJson(json, HouseIdBean.class); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean); |
| | | |
| | | } |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT.equals(eventBus.getType())) { |
| | | //uin编辑住宅通知 |
| | | String homeId = HdlUniLogic.getInstance().getKeyValue("homeId", eventBus.getData()); |
| | | String home_name = HdlUniLogic.getInstance().getKeyValue("powerStationName", eventBus.getData()); |
| | | if (TextUtils.isEmpty(homeId) || TextUtils.isEmpty(home_name)) { |
| | | return; |
| | | } |
| | | int index = -1; |
| | | for (int i = 0; i < houseListBeanIDList.size(); i++) { |
| | | HouseIdBean houseIdBean = houseListBeanIDList.get(i); |
| | | if (houseIdBean.getHomeId().equals(homeId)) { |
| | | index = i; |
| | | houseIdBean.setHomeName(home_name); |
| | | break; |
| | | } |
| | | } |
| | | if (index > -1) { |
| | | if (houseInfoAdapter != null) { |
| | | //更新单个数据 |
| | | houseInfoAdapter.notifyItemChanged(index); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_CLOSE_HOME_DETAILS_PAGE.equals(eventBus.getType())) { |