From 125b1775618a0e6c650d76be051b6f16a559bb1a Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期二, 21 五月 2024 16:00:38 +0800 Subject: [PATCH] 2024年05月21日16:00:32 --- app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java | 1 app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java | 9 ++ app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java | 14 ++-- app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java | 8 ++ app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java | 32 ++++++---- app/src/main/java/com/hdl/photovoltaic/config/ConstantManage.java | 2 app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java | 62 ++++++++++++++++++++ app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java | 27 ++++----- app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java | 9 +++ 9 files changed, 128 insertions(+), 36 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/config/ConstantManage.java b/app/src/main/java/com/hdl/photovoltaic/config/ConstantManage.java index 4014d8a..92e0c8c 100644 --- a/app/src/main/java/com/hdl/photovoltaic/config/ConstantManage.java +++ b/app/src/main/java/com/hdl/photovoltaic/config/ConstantManage.java @@ -24,6 +24,8 @@ //缃戠粶鐘舵�佸彂鐢熷彉鍖� public static final String network_change_post = "network_change"; + //鐢电珯鐘舵�� + public static final String station_status = "station_status"; } diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java index 730f630..6cb0f7b 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java @@ -14,10 +14,14 @@ import com.google.zxing.common.BitMatrix; import com.google.zxing.qrcode.QRCodeWriter; import com.hdl.linkpm.sdk.user.HDLLinkPMUser; +import com.hdl.photovoltaic.config.ConstantManage; import com.hdl.photovoltaic.config.UserConfigManage; +import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; import com.hdl.photovoltaic.enums.UnitType; import com.hdl.photovoltaic.utils.GlideUtils; +import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; +import org.greenrobot.eventbus.EventBus; import org.json.JSONObject; import java.io.InputStream; @@ -195,4 +199,62 @@ } + /** + * 鍙戝竷EventBus绮樻�т簨浠� + * <p> + * 娉ㄦ剰:瑕佸彇娑堢矘鎬т簨浠禘ventBus.getDefault().removeStickyEvent(eventBus); + * + * @param topic 涓婚 + * @param type 浜嬩欢 + */ + public void postEventBusSticky(String topic, String type) { + BaseEventBus baseEventBus = new BaseEventBus(); + baseEventBus.setTopic(topic); + baseEventBus.setType(type); + EventBus.getDefault().postSticky(baseEventBus); + } + + /** + * 鍙戝竷EventBus绮樻�т簨浠� + * <p> + * 娉ㄦ剰:瑕佸彇娑堢矘鎬т簨浠禘ventBus.getDefault().removeStickyEvent(eventBus); + * + * @param topic 涓婚 + * @param type 浜嬩欢 + */ + public void postEventBusSticky(String topic, String type, Object o) { + BaseEventBus baseEventBus = new BaseEventBus(); + baseEventBus.setTopic(topic); + baseEventBus.setType(type); + baseEventBus.setData(o); + EventBus.getDefault().postSticky(baseEventBus); + } + + /** + * 鍙戝竷EventBus浜嬩欢 + * + * @param topic 涓婚 + * @param type 浜嬩欢 + */ + public void postEventBus(String topic, String type) { + BaseEventBus baseEventBus = new BaseEventBus(); + baseEventBus.setTopic(topic); + baseEventBus.setType(type); + EventBus.getDefault().postSticky(baseEventBus); + } + + /** + * 鍙戝竷EventBus浜嬩欢 + * + * @param topic 涓婚 + * @param type 浜嬩欢 + */ + public void postEventBus(String topic, String type, Object o) { + BaseEventBus baseEventBus = new BaseEventBus(); + baseEventBus.setTopic(topic); + baseEventBus.setType(type); + baseEventBus.setData(o); + EventBus.getDefault().postSticky(baseEventBus); + } + } diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java index 540949f..ede598c 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java @@ -32,7 +32,9 @@ import com.hdl.photovoltaic.databinding.ActivityMyPowerStationBinding; import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; import com.hdl.photovoltaic.enums.NetworkType; +import com.hdl.photovoltaic.enums.PowerStationStatusType; import com.hdl.photovoltaic.listener.CloudCallBeak; +import com.hdl.photovoltaic.other.HdlCommonLogic; import com.hdl.photovoltaic.other.HdlDeviceLogic; import com.hdl.photovoltaic.other.HdlLogLogic; import com.hdl.photovoltaic.other.HdlMessageLogic; @@ -306,7 +308,7 @@ currentFragmentIndex = 0; bottomViewChangeOfStyle(); showFragment(); - postEventBus(HomepageTitleTabSwitch.homepage); + HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.homepage.toString()); } }); viewBinding.myPowerStationBottomIl1.clickTv.setOnClickListener(new View.OnClickListener() { @@ -318,7 +320,7 @@ currentFragmentIndex = 1; bottomViewChangeOfStyle(); showFragment(); - postEventBus(HomepageTitleTabSwitch.powerstation); + HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.powerstation.toString()); } }); viewBinding.myMessageBottomIl2.clickTv.setOnClickListener(new View.OnClickListener() { @@ -330,7 +332,7 @@ currentFragmentIndex = 2; bottomViewChangeOfStyle(); showFragment(); - postEventBus(HomepageTitleTabSwitch.message); + HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.message.toString()); } }); viewBinding.myMeBottomIl3.clickTv.setOnClickListener(new View.OnClickListener() { @@ -342,7 +344,7 @@ currentFragmentIndex = 3; bottomViewChangeOfStyle(); showFragment(); - postEventBus(HomepageTitleTabSwitch.me); + HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, HomepageTitleTabSwitch.me.toString()); } }); @@ -410,17 +412,6 @@ } } - /** - * 鍙戝竷鐐瑰嚮浜嬩欢 - * - * @param tabSwitch - - */ - private void postEventBus(HomepageTitleTabSwitch tabSwitch) { - BaseEventBus baseEventBus = new BaseEventBus(); - baseEventBus.setTopic(ConstantManage.homepage_title_tab_switch); - baseEventBus.setType(tabSwitch.toString()); - EventBus.getDefault().postSticky(baseEventBus); - } public void requestPermissions() { //娑堟伅閫氱煡闄愭潈 @@ -636,6 +627,12 @@ } }); } + } else if (event.getTopic().contains(ConstantManage.station_status)) { + currentFragmentIndex = 1; + bottomViewChangeOfStyle(); + showFragment(); + HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, event.getType()); + } } diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java index bc40105..ed03410 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java @@ -21,15 +21,14 @@ import com.hdl.photovoltaic.R; import com.hdl.photovoltaic.base.CustomBaseFragment; import com.hdl.photovoltaic.config.ConstantManage; -import com.hdl.photovoltaic.config.UserConfigManage; import com.hdl.photovoltaic.databinding.FragmentHomePageBinding; import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; import com.hdl.photovoltaic.enums.PowerStationStatus; +import com.hdl.photovoltaic.enums.PowerStationStatusType; import com.hdl.photovoltaic.enums.TimeType; import com.hdl.photovoltaic.enums.UnitType; import com.hdl.photovoltaic.listener.CloudCallBeak; import com.hdl.photovoltaic.other.HdlCommonLogic; -import com.hdl.photovoltaic.other.HdlDeviceLogic; import com.hdl.photovoltaic.other.HdlLogLogic; import com.hdl.photovoltaic.other.HdlPowerStationDataStatisticsLogic; import com.hdl.photovoltaic.other.HdlResidenceLogic; @@ -81,7 +80,6 @@ @Override public void onBindView(Bundle savedInstanceState) { - //鍒濆鍖� initView(); //鍒濆鍖栫晫闈㈢洃鍚櫒 @@ -120,7 +118,7 @@ viewBinding.homeAllIl.parentLl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - + HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.All); } }); @@ -128,18 +126,21 @@ viewBinding.homeFaultsIl.parentLl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.malfunction); } }); //绂荤嚎 viewBinding.homeOfflineIl.parentLl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.off); } }); //寰呮帴鍏� viewBinding.homeConnectedIl.parentLl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + HdlCommonLogic.getInstance().postEventBus(ConstantManage.station_status, PowerStationStatus.connecting); } }); //鏃堕棿閫夋嫨鍣� @@ -388,9 +389,7 @@ aaChartView.callBack = this; if (TimeType.day.equals(timeType)) { aaChartModel = BasicChartComposer.configureAreaChart(getString(R.string.pv_power), fieldNames, fieldValues); - } else if (TimeType.month.equals(timeType) - || TimeType.year.equals(timeType) - || TimeType.all.equals(timeType)) { + } else if (TimeType.month.equals(timeType) || TimeType.year.equals(timeType) || TimeType.all.equals(timeType)) { aaChartModel = configureColorfulColumnChart(getString(R.string.pv_power), fieldNames, fieldValues); } aaChartView.aa_drawChartWithChartModel(aaChartModel); @@ -465,6 +464,7 @@ } } + /** * 鐢电珯鐘舵�佹瑙� */ diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java index fc0caa2..8756651 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java @@ -219,8 +219,15 @@ mMessageAdapter.setOnclickListener(new MessageAdapter.OnClickListener() { @Override public void onClick(int position, MessageBean messageBean) { + String messageStateType; + if (isAlarmDeviceClick) { + messageStateType = MessageStateType.untreated; + } else { + messageStateType = MessageStateType.processed; + } Intent intent = new Intent(); intent.putExtra("msgId", messageBean.getMsgId().toString()); + intent.putExtra("messageStateType", messageStateType); intent.setClass(_mActivity, MessageInfoActivity.class); startActivity(intent); } @@ -298,7 +305,7 @@ // 鍙栨秷绮樻�т簨浠� EventBus.getDefault().removeStickyEvent(eventBus); //杩涙潵璇诲彇涓�娆℃暟鎹�(涓轰簡鏇存柊currentPage锛宑urrentTotal杩欎釜鍊�) - initData(); +// initData(); HdlLogLogic.print("姝e湪鐐瑰嚮銆愭秷鎭��"); } diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java index d90e9cf..2085582 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageInfoActivity.java @@ -34,6 +34,7 @@ private MessageBean mMessageBean; private String mMsgId; + private String mMessageStateType; @Override public Object getContentView() { @@ -47,6 +48,7 @@ setStatusBarTextColor(); try { mMsgId = getIntent().getStringExtra("msgId"); + mMessageStateType = getIntent().getStringExtra("messageStateType"); } catch (Exception ignored) { } @@ -240,5 +242,11 @@ viewBinding.messageInfoAlarmRangeIn.rightContentTv.setText(""); viewBinding.messageInfoPowerStationLocationIn.rightContentTv.setText(""); viewBinding.messageInfoAlarmTimeIn.rightContentTv.setText(""); + + if (mMessageStateType.equals(MessageStateType.processed)) { + //宸茬粡瑙e喅鎺夌殑闅愯棌 + viewBinding.messageInfoBackTv.setVisibility(View.GONE); + viewBinding.messageInfoSolveTv.setVisibility(View.GONE); + } } } \ No newline at end of file diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java index 8894db5..a82aaa3 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java @@ -183,6 +183,7 @@ public void onClick(int position, MessageBean messageBean) { Intent intent = new Intent(); intent.putExtra("msgId", messageBean.getMsgId().toString()); + intent.putExtra("messageStateType", mMessageStateType); intent.setClass(_mActivity, MessageInfoActivity.class); startActivity(intent); } diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java b/app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java index 4d65283..fcc2f67 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java @@ -269,8 +269,17 @@ messageCenterListAdapter.setNoOnclickListener(new MessageCenterListAdapter.OnclickListener() { @Override public void onClick(int position, MessageBean messageBean) { + + + String messageStateType; + if (isAlarmDeviceClick) { + messageStateType = MessageStateType.untreated; + } else { + messageStateType = MessageStateType.processed; + } Intent intent = new Intent(); intent.putExtra("msgId", messageBean.getMsgId().toString()); + intent.putExtra("messageStateType", messageStateType); intent.setClass(_mActivity, MessageInfoActivity.class); startActivity(intent); } diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java index 61965cc..9040eac 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java @@ -59,6 +59,8 @@ * 鐢电珯鍜岃澶�-鐣岄潰 */ public class HouseAndDeviceFragment extends CustomBaseFragment { + + private boolean isReadData = false; private FragmentHouseListBinding viewBinding; private HouseInfoAdapter houseInfoAdapter; @@ -66,8 +68,6 @@ private List<HouseIdBean> houseListBeanIDList; private List<DeviceBean> deviceInfoList; - - private int currentHouseListPage = 0; // 褰撳墠鐢电珯鍒楄〃椤电爜 private int currentHouseListTotal = 0; // 鐢电珯鍒楄〃鎬婚〉鐮� private boolean isHouseLoadingMore = false; // 鏍囪鐢电珯鍒楄〃姝e湪鍔犺浇鏇村鏁版嵁 @@ -96,9 +96,6 @@ @Override public void onBindView(Bundle savedInstanceState) { - //鏀惧湪杩欓噷涔熷锛岃繖閲屽彧鏄鍒涘缓涓�娆� -// loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); -// getStatusOverview(); initData(); //鍒濆鍖� initView(); @@ -126,6 +123,7 @@ viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE); } loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + getStatusOverview(); } }); //璁惧鏍囩 @@ -229,6 +227,7 @@ public void onRefresh() { viewBinding.fragmentHouseSrl.setRefreshing(false); loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + getStatusOverview(); } }); //鐢电珯涓婃媺璇诲彇 @@ -602,14 +601,20 @@ // 鍙栨秷绮樻�т簨浠� EventBus.getDefault().removeStickyEvent(eventBus); HdlLogLogic.print("姝e湪鐐瑰嚮銆愮數绔欍��"); -// HdlThreadLogic.runSubThread(new Runnable() { -// @Override -// public void run() { - loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); - getStatusOverview(); -// } -// }); - + if (!isReadData) { + //1锛屼粠棣栭〉-鏁呴殰-杩涙潵-鐢电珯锛堜笉璇诲彇锛� + //1锛屼粠鐢电珯-杩涙潵-鐢电珯锛堣鍙栦竴娆�,鍚庨潰杩涙潵涓嶅湪璇诲彇锛� + loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); + getStatusOverview(); + } + } else if (eventBus.getType().equals(PowerStationStatus.All)) { + viewBinding.powerStationAllIl.parentLl.performClick(); + } else if (eventBus.getType().equals(PowerStationStatus.malfunction)) { + viewBinding.powerStationFaultsIl.parentLl.performClick(); + } else if (eventBus.getType().equals(PowerStationStatus.off)) { + viewBinding.powerStationOfflineIl.parentLl.performClick(); + } else if (eventBus.getType().equals(PowerStationStatus.connecting)) { + viewBinding.powerStationConnectedIl.parentLl.performClick(); } } } @@ -656,6 +661,7 @@ * @param isClear 鏄惁娓呴櫎鏁版嵁 */ private void loadNextPageHouseList(boolean isRefreshing, String key, String keyValue, String installedCapacityMin, String installedCapacityMax, String gridType, String powerStationStatus, long pageNo, boolean isClear) { + isReadData = true; if (isClear) { clearData(); } -- Gitblit v1.8.0