From 3ccff7173fb73322f7785d8eaedc90a1b5d8765d Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期二, 10 十二月 2024 22:44:03 +0800 Subject: [PATCH] 2024年12月10日22:43:59 --- app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java | 288 +++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 197 insertions(+), 91 deletions(-) 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 ffc245f..0267890 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 @@ -1,7 +1,9 @@ package com.hdl.photovoltaic.ui.newC; +import android.content.DialogInterface; import android.content.Intent; +import android.graphics.Typeface; import android.os.Bundle; import android.view.View; import android.widget.TextView; @@ -11,8 +13,8 @@ import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; +import com.google.gson.JsonObject; import com.hdl.linkpm.sdk.core.exception.HDLException; import com.hdl.photovoltaic.R; import com.hdl.photovoltaic.base.CustomBaseActivity; @@ -26,9 +28,12 @@ import com.hdl.photovoltaic.other.HdlLogLogic; import com.hdl.photovoltaic.other.HdlMessageLogic; import com.hdl.photovoltaic.other.HdlThreadLogic; +import com.hdl.photovoltaic.other.HdlUniLogic; import com.hdl.photovoltaic.ui.bean.MessageBean; +import com.hdl.photovoltaic.ui.bean.UnCountBean; import com.hdl.photovoltaic.ui.message.MessageInfoActivity; import com.hdl.photovoltaic.ui.newC.adapter.MessageCenterListAdapter; +import com.hdl.photovoltaic.uni.HDLUniMP; import com.hdl.photovoltaic.widget.TypeTitleListDialog; import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; @@ -58,10 +63,22 @@ private int mTotalCount1 = 0;//娑堟伅鏁伴噺鎬绘暟 private int mTotalCount2 = 0;//娑堟伅鏁伴噺鎬绘暟 - private String mFilterKye = FilterType.all;//杩囨护绫诲瀷 - private String mFilterValue = FilterType.all;//杩囨护绫诲瀷鍊� + private String mDeviceTypeFilterKye = FilterType.all;//杩囨护绫诲瀷 deviceType锛圛NV 锛氶�嗗彉鍣紱BMS 锛欱MS鎺у埗鐩掞紱BATTERY 锛氱數姹犲崟鍏冿級 + private String mDeviceTypeFilterValue = FilterType.all;//杩囨护绫诲瀷鍊� deviceType锛圛NV 锛氶�嗗彉鍣紱BMS 锛欱MS鎺у埗鐩掞紱BATTERY 锛氱數姹犲崟鍏冿級 + + private String mTypeFilterKye = FilterType.all;//杩囨护绫诲瀷 type锛團AULT 锛氭晠闅滐紱 WARN 锛氬憡璀︼紱 EVENT 锛氫簨浠�(鎻愮ず)锛夛紱 + private String mTypeFilterValue = FilterType.all;//杩囨护绫诲瀷鍊� type锛團AULT 锛氭晠闅滐紱 WARN 锛氬憡璀︼紱 EVENT 锛氫簨浠�(鎻愮ず)锛夛紱 + + private String mTimeTypeFilterKye = FilterType.all;//杩囨护绫诲瀷 timeType锛圱ODAY 锛氫粖澶╋紱LAST_3_DAYS: 杩�3澶╋紱LAST_7_DAYS 锛氳繎7澶╋紱LAST_30_DAYS 锛氳繎30澶╋級锛� + private String mTimeTypeFilterValue = FilterType.all;//杩囨护绫诲瀷鍊� timeType锛圱ODAY 锛氫粖澶╋紱LAST_3_DAYS: 杩�3澶╋紱LAST_7_DAYS 锛氳繎7澶╋紱LAST_30_DAYS 锛氳繎30澶╋級锛� + + + //deviceType_filter_value deviceType锛圛NV 锛氶�嗗彉鍣紱BMS 锛欱MS鎺у埗鐩掞紱BATTERY 锛氱數姹犲崟鍏冿級锛� + // * type锛團AULT 锛氭晠闅滐紱 WARN 锛氬憡璀︼紱 EVENT 锛氫簨浠�(鎻愮ず)锛夛紱 + // * timeType锛圱ODAY 锛氫粖澶╋紱LAST_3_DAYS: 杩�3澶╋紱LAST_7_DAYS 锛氳繎7澶╋紱LAST_30_DAYS 锛氳繎30澶╋級锛� private boolean isLoadingMore = false; // 鏍囪姝e湪鍔犺浇鏇村鏁版嵁 LinearLayoutManager mLayoutManager; + @Override public Object getContentView() { @@ -71,22 +88,39 @@ @Override public void onBindView(Bundle savedInstanceState) { + setStatusBarTranslucent(); + getWindow().setNavigationBarColor(getColor(R.color.text_FF333738)); //鍒濆鍖栨暟鎹� initData(); //鍒濆鍖� initView(); //鍒濆鍖栫晫闈㈢洃鍚櫒 initEvent(); + getUnreadCount(); //杩涙潵璇诲彇涓�娆℃暟鎹�(涓轰簡鏇存柊currentPage锛宑urrentTotal杩欎釜鍊�) - loadNextPageMessageList(1, true, FilterType.all, FilterType.all); + loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue); + } + + + @Override + protected void onResume() { + super.onResume(); + //杩涙潵璇诲彇涓�娆℃暟鎹�(涓轰簡鏇存柊currentPage锛宑urrentTotal杩欎釜鍊�) +// loadNextPageMessageList(1, true, mFilterKye, mFilterValue); } private void initEvent() { //杩斿洖鎸夐挳 - viewBinding.toolbarTopMessageCenterListRl.topBackBtn.setOnClickListener(new View.OnClickListener() { + viewBinding.toolbarTopMessageCenterListRl.topBackLl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { clearCacheData(); + HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); + uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_REFRESH_UNREAD_NUMBER); + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty("homeId", UserConfigManage.getInstance().getHomeId()); + uniCallBackBaseBean.setData(jsonObject); + HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean); finish(); } }); @@ -99,7 +133,9 @@ @Override public void onSuccess(Boolean obj) { hideLoading(); - loadNextPageMessageList(1, true, mFilterKye, mFilterValue); + loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue); +// HdlMessageLogic.getInstance().setAllRead(true); +// updateListData(); } @Override @@ -119,17 +155,25 @@ viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down); viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down); List<String> stringList = getTypeList(FilterType.deviceType); - TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList); + TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList, viewBinding.allDeviceTitleTv.getText().toString()); typeTitleListDialog.show(); typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() { @Override public void onClick(int position, String title) { viewBinding.allDeviceTitleTv.setText(title); - mFilterKye = FilterType.deviceType; - mFilterValue = findFilterValueString(title); - loadNextPageMessageList(1, true, mFilterKye, mFilterValue); + mDeviceTypeFilterKye = FilterType.deviceType; + mDeviceTypeFilterValue = findFilterValueString(title); + loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue); + } + }); + typeTitleListDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down); + viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down); + viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down); } }); @@ -144,15 +188,23 @@ viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.up); viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down); List<String> stringList = getTypeList(FilterType.type); - TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList); + TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList, viewBinding.allGradeTitleTv.getText().toString()); typeTitleListDialog.show(); typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() { @Override public void onClick(int position, String title) { viewBinding.allGradeTitleTv.setText(title); - mFilterKye = FilterType.type; - mFilterValue = findFilterValueString(title); - loadNextPageMessageList(1, true, mFilterKye, mFilterValue); + mTypeFilterKye = FilterType.type; + mTypeFilterValue = findFilterValueString(title); + loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue); + } + }); + typeTitleListDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down); + viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down); + viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down); } }); } @@ -165,15 +217,23 @@ viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down); viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.up); List<String> stringList = getTypeList(FilterType.timeType); - TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList); + TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList, viewBinding.allTimeTitleTv.getText().toString()); typeTitleListDialog.show(); typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() { @Override public void onClick(int position, String title) { viewBinding.allTimeTitleTv.setText(title); - mFilterKye = FilterType.timeType; - mFilterValue = findFilterValueString(title); - loadNextPageMessageList(1, true, mFilterKye, mFilterValue); + mTimeTypeFilterKye = FilterType.timeType; + mTimeTypeFilterValue = findFilterValueString(title); + loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue); + } + }); + typeTitleListDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down); + viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down); + viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down); } }); } @@ -186,9 +246,18 @@ if (isAlarmDeviceClick) { return;//闃叉澶氭鐐瑰嚮 } + mDeviceTypeFilterKye = FilterType.all; + mDeviceTypeFilterValue = FilterType.all; + mTypeFilterKye = FilterType.all; + mTypeFilterValue = FilterType.all; + mTimeTypeFilterKye = FilterType.all; + mTimeTypeFilterValue = FilterType.all; + viewBinding.allDeviceTitleTv.setText(getString(R.string.alarm_all_device)); + viewBinding.allGradeTitleTv.setText(getString(R.string.alarm_all_grade)); + viewBinding.allTimeTitleTv.setText(getString(R.string.alarm_all_time)); isAlarmDeviceClick = true; refreshBottomStyle(true); - loadNextPageMessageList(1, true, mFilterKye, mFilterValue); + loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue); } }); //鍛婅璁板綍鎸夐挳 @@ -198,9 +267,18 @@ if (!isAlarmDeviceClick) { return;//闃叉澶氭鐐瑰嚮 } + mDeviceTypeFilterKye = FilterType.all; + mDeviceTypeFilterValue = FilterType.all; + mTypeFilterKye = FilterType.all; + mTypeFilterValue = FilterType.all; + mTimeTypeFilterKye = FilterType.all; + mTimeTypeFilterValue = FilterType.all; + viewBinding.allDeviceTitleTv.setText(getString(R.string.alarm_all_device)); + viewBinding.allGradeTitleTv.setText(getString(R.string.alarm_all_grade)); + viewBinding.allTimeTitleTv.setText(getString(R.string.alarm_all_time)); isAlarmDeviceClick = false; refreshBottomStyle(false); - loadNextPageMessageList(1, true, mFilterKye, mFilterValue); + loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue); } }); @@ -211,7 +289,7 @@ @Override public void onRefresh() { viewBinding.messageContentSrl.setRefreshing(false); - loadNextPageMessageList(1, true, mFilterKye, mFilterValue); + loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue); } }); //涓婃媺鎸夐挳 @@ -231,7 +309,7 @@ if (!isLoadingMore) { // 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔 HdlLogLogic.print("--->婊戝姩鍒颁簡搴曢儴"); - loadNextPageMessageList(++mCurrentPage, false, mFilterKye, mFilterValue); + loadNextPageMessageList(++mCurrentPage, false, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue); } } } @@ -241,7 +319,7 @@ @Override public void onClick(int position, MessageBean messageBean) { Intent intent = new Intent(); - intent.putExtra("msgId", messageBean.getMsgId().toString()); + intent.putExtra("messageBean", new Gson().toJson(messageBean)); intent.setClass(_mActivity, MessageInfoActivity.class); startActivity(intent); } @@ -251,14 +329,12 @@ } private void initView() { - viewBinding.toolbarTopMessageCenterListRl.getRoot().setBackgroundColor(getColor(R.color.text_FFFFFFFF)); - viewBinding.toolbarTopMessageCenterListRl.topBackBtn.setVisibility(View.VISIBLE); - viewBinding.toolbarTopMessageCenterListRl.topLeftIv.setImageResource(R.drawable.back_c); + viewBinding.toolbarTopMessageCenterListRl.topBackLl.setVisibility(View.VISIBLE); viewBinding.toolbarTopMessageCenterListRl.topTitleTv.setText(R.string.set_message_center); viewBinding.toolbarTopMessageCenterListRl.topMoreBtn.setVisibility(View.VISIBLE); viewBinding.toolbarTopMessageCenterListRl.topMoreIv.setImageResource(R.drawable.clearall); //榛樿閫変腑鍏ㄩ儴璁惧 - viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.up); + viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down); viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down); viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down); refreshBottomStyle(true); @@ -267,23 +343,43 @@ viewBinding.messageContentRl.setLayoutManager(mLayoutManager); viewBinding.messageContentRl.setAdapter(messageCenterListAdapter); messageCenterListAdapter.setList(mList); - this.nullDataUpdateUi(); +// this.nullDataUpdateUi(); } private void initData() { + try { + Intent intent = getIntent(); + if (intent != null) { + String isShowFault = intent.getStringExtra("isShowFault"); + if (isShowFault != null && isShowFault.equals("true")) { + //榛樿鏁呴殰鍏ㄩ儴 + mDeviceTypeFilterKye = FilterType.all; + mDeviceTypeFilterValue = FilterType.all; + mTypeFilterKye = FilterType.type; + mTypeFilterValue = "FAULT"; + mTimeTypeFilterKye = FilterType.all; + mTimeTypeFilterValue = FilterType.all; + viewBinding.allGradeTitleTv.setText(getString(R.string.alarm_all_grade_malfunction)); + } + } + } catch (Exception ignored) { + } } /** * 鍔犺浇涓�椤垫暟鎹� * - * @param pageNo 椤垫暟 - * @param isShowLoading 鏄惁鍚姩鍔犺浇妗� true鍚姩 - * @param filter_key 绫诲瀷锛堣澶囷紝绛夌骇锛屾椂闂达級 - * @param filter_value deviceType锛圛NV 锛氶�嗗彉鍣紱BMS 锛欱MS鎺у埗鐩掞紱BATTERY 锛氱數姹犲崟鍏冿級锛� - * type锛團AULT 锛氭晠闅滐紱 WARN 锛氬憡璀︼紱 EVENT 锛氫簨浠�(鎻愮ず)锛夛紱 - * timeType锛圱ODAY 锛氫粖澶╋紱LAST_3_DAYS: 杩�3澶╋紱LAST_7_DAYS 锛氳繎7澶╋紱LAST_30_DAYS 锛氳繎30澶╋級锛� + * @param pageNo 椤垫暟 + * @param isShowLoading 鏄惁鍚姩鍔犺浇妗� true鍚姩 + * @param deviceType_filter_key 绫诲瀷锛堣澶囷紝绛夌骇锛屾椂闂达級 + * @param deviceType_filter_value deviceType锛圛NV 锛氶�嗗彉鍣紱BMS 锛欱MS鎺у埗鐩掞紱BATTERY 锛氱數姹犲崟鍏冿級锛� + * type锛團AULT 锛氭晠闅滐紱 WARN 锛氬憡璀︼紱 EVENT 锛氫簨浠�(鎻愮ず)锛夛紱 + * timeType锛圱ODAY 锛氫粖澶╋紱LAST_3_DAYS: 杩�3澶╋紱LAST_7_DAYS 锛氳繎7澶╋紱LAST_30_DAYS 锛氳繎30澶╋級锛� */ - private void loadNextPageMessageList(int pageNo, boolean isShowLoading, String filter_key, String filter_value) { + private void loadNextPageMessageList(int pageNo, boolean isShowLoading, + String deviceType_filter_key, String deviceType_filter_value, + String type_filter_key, String type_filter_value, + String timeType_filter_key, String timeType_filter_value) { if (pageNo == 1) { //琛ㄧず浠庣涓�椤靛彲浠ヨ鍙栵紝榛樿娓呯┖鎵�鏈夌紦瀛樻暟鎹�; clearCacheData(); @@ -304,77 +400,70 @@ } else { messageStateType = MessageStateType.processed; } - HdlMessageLogic.getInstance().getPageNoMessageList_C(pageNo, messageStateType, filter_key, filter_value, new CloudCallBeak<HdlMessageLogic.MessageListClass>() { - @Override - public void onSuccess(HdlMessageLogic.MessageListClass messageListClass) { - if (messageListClass != null) { - mCurrentTotal = (int) messageListClass.getTotalPage(); - mCurrentPage = (int) messageListClass.getPageNo(); - int totalCount = (int) messageListClass.getTotalCount(); - if (isAlarmDeviceClick) { - mTotalCount1 = totalCount; - } else { - mTotalCount2 = totalCount; + HdlMessageLogic.getInstance().getPageNoMessageList(UserConfigManage.getInstance().getHomeId(), pageNo, messageStateType, + deviceType_filter_key, deviceType_filter_value, + type_filter_key, type_filter_value, + timeType_filter_key, timeType_filter_value, + "", + new CloudCallBeak<HdlMessageLogic.MessageListClass>() { + @Override + public void onSuccess(HdlMessageLogic.MessageListClass messageListClass) { + if (messageListClass != null) { + mCurrentTotal = (int) messageListClass.getTotalPage(); + mCurrentPage = (int) messageListClass.getPageNo(); + int totalCount = (int) messageListClass.getTotalCount(); + if (isAlarmDeviceClick) { + mTotalCount1 = totalCount; + } else { + mTotalCount2 = totalCount; + } + updateListData(); + } + isLoadingMore = false; + if (isShowLoading) { + hideLoading(); + } } - updateListData(); - } - isLoadingMore = false; - if (isShowLoading) { - hideLoading(); - } - } - @Override - public void onFailure(HDLException e) { - if (mCurrentPage > 1) { - --mCurrentPage; - } - isLoadingMore = false; - if (isShowLoading) { - hideLoading(); - } - } - }); + @Override + public void onFailure(HDLException e) { + if (mCurrentPage > 1) { + --mCurrentPage; + } + isLoadingMore = false; + if (isShowLoading) { + hideLoading(); + } + } + }); } /** - * 璇诲彇娑堟伅銆愭湭璇绘暟閲忋�� + * 璇诲彇娑堟伅銆愭湭璇绘暟閲�,鏈鐞嗘�绘暟閲忥紝宸插鐞嗘�绘暟閲忋�� */ private void getUnreadCount() { - HdlMessageLogic.getInstance().getMessageUntreatedCount(new CloudCallBeak<String>() { + HdlMessageLogic.getInstance().getMessageUntreatedCount(UserConfigManage.getInstance().getHomeId(), new CloudCallBeak<UnCountBean>() { @Override - public void onSuccess(String data) { - + public void onSuccess(UnCountBean unCountBean) { HdlThreadLogic.runMainThread(new Runnable() { @Override public void run() { - JSONObject jsonObject = JSON.parseObject(data); - if (jsonObject.containsKey("untreatedCount")) { - //鏈鐞嗘暟閲� - String untreatedCount = jsonObject.getString("untreatedCount"); - refreshCount(); + if (unCountBean == null) { + return; } - if (jsonObject.containsKey("unreadCount")) { - //鏈鏁伴噺 - String unreadCount = jsonObject.getString("unreadCount"); - } + mTotalCount1 = unCountBean.getUntreatedCount(); + mTotalCount2 = unCountBean.getProcessedCount(); } }); - } @Override public void onFailure(HDLException e) { - TextView textView = _mActivity.findViewById(R.id.my_message_bottom_il2).findViewById(R.id.red_count_tv); - if (textView != null) { - textView.setVisibility(View.GONE); - } } }); } - @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) public void onEventMessage(BaseEventBus eventBus) { @@ -434,16 +523,10 @@ @Override public void run() { if (typeClick) { - viewBinding.messageBottomAlarmDeviceTitleTv.setTextColor(getColor(R.color.text_191919)); viewBinding.messageBottomAlarmDeviceLineV.setVisibility(View.VISIBLE); - viewBinding.messageBottomAlarmRecordTitleTv.setTextColor(getColor(R.color.text_B2B2B2)); viewBinding.messageBottomAlarmRecordLineV.setVisibility(View.GONE); - - } else { - viewBinding.messageBottomAlarmDeviceTitleTv.setTextColor(getColor(R.color.text_B2B2B2)); viewBinding.messageBottomAlarmDeviceLineV.setVisibility(View.GONE); - viewBinding.messageBottomAlarmRecordTitleTv.setTextColor(getColor(R.color.text_191919)); viewBinding.messageBottomAlarmRecordLineV.setVisibility(View.VISIBLE); } @@ -496,7 +579,13 @@ */ private void updateCacheData() { mList.clear(); - mList.addAll(HdlMessageLogic.getInstance().getAllMessageList()); + if (isAlarmDeviceClick) { + //璁惧鎶ヨ + mList.addAll(HdlMessageLogic.getInstance().getNascentMessageMemoryList()); + } else { + //鎶ヨ璁板綍 + mList.addAll(HdlMessageLogic.getInstance().getRecoverMessageMemoryList()); + } } @@ -519,6 +608,7 @@ map.put(getString(R.string.alarm_all_device_inverter), "INV"); map.put(getString(R.string.alarm_all_device_bms), "BMS"); map.put(getString(R.string.alarm_all_device_battery_cell), "BATTERY"); + map.put(getString(R.string.alarm_all_device_load_centre), "LOAD_CENTRE"); map.put(getString(R.string.alarm_all_grade), "");//璁剧瓑绾у叏閮� map.put(getString(R.string.alarm_all_grade_malfunction), "FAULT"); map.put(getString(R.string.alarm_all_grade_warning), "WARN"); @@ -551,6 +641,7 @@ stringList.add(getString(R.string.alarm_all_device_inverter)); stringList.add(getString(R.string.alarm_all_device_bms)); stringList.add(getString(R.string.alarm_all_device_battery_cell)); + stringList.add(getString(R.string.alarm_all_device_load_centre)); } break; case FilterType.type: { @@ -571,4 +662,19 @@ } return stringList; } + + /** + * 鐗╃悊鎸夐敭杩斿洖浜嬩欢 + */ + @Override + public void onBackPressed() { + clearCacheData(); + HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); + uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_REFRESH_UNREAD_NUMBER); + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty("homeId", UserConfigManage.getInstance().getHomeId()); + uniCallBackBaseBean.setData(jsonObject); + HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean); + super.onBackPressed(); + } } \ No newline at end of file -- Gitblit v1.8.0