From 425172a97b80788b3a9e16435588888d53cb47a4 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 27 五月 2024 13:45:32 +0800
Subject: [PATCH] 2024年05月27日13:45:31
---
app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java | 106 ++++++++++++++++++++++++++++++-----------------------
1 files changed, 60 insertions(+), 46 deletions(-)
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 a9457f6..e5a36c3 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
@@ -12,6 +12,7 @@
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+import com.google.gson.Gson;
import com.hdl.linkpm.sdk.core.exception.HDLException;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.base.CustomBaseFragment;
@@ -28,7 +29,7 @@
import com.hdl.photovoltaic.ui.adapter.MessageAdapter;
import com.hdl.photovoltaic.ui.bean.MessageBean;
import com.hdl.photovoltaic.ui.bean.UnCountBean;
-import com.hdl.photovoltaic.widget.TypeTitleListDialog;
+import com.hdl.photovoltaic.widget.BTypeTitleListDialog;
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
import org.greenrobot.eventbus.EventBus;
@@ -117,7 +118,14 @@
viewBinding.messageSearchCl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ String messageStateType;
+ if (isAlarmDeviceClick) {
+ messageStateType = MessageStateType.untreated;
+ } else {
+ messageStateType = MessageStateType.processed;
+ }
Intent intent = new Intent();
+ intent.putExtra("MessageStateType", messageStateType);
intent.setClass(_mActivity, SearchMessageActivity.class);
startActivity(intent);
}
@@ -151,21 +159,7 @@
viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.up);
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.show();
- typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() {
- @Override
- public void onClick(int position, String title) {
-
- viewBinding.allDeviceTitleTv.setText(title);
- mDeviceTypeFilterKye = FilterType.deviceType;
- mDeviceTypeFilterValue = findFilterValueString(title);
- loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
-
- }
- });
-
+ setTypeTitleListDialog(viewBinding.allDeviceTitleTv, FilterType.deviceType, getTypeList(FilterType.deviceType));
}
});
@@ -176,18 +170,8 @@
viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down);
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.show();
- typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() {
- @Override
- public void onClick(int position, String title) {
- viewBinding.allGradeTitleTv.setText(title);
- mTypeFilterKye = FilterType.type;
- mTypeFilterValue = findFilterValueString(title);
- loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
- }
- });
+ setTypeTitleListDialog(viewBinding.allGradeTitleTv, FilterType.type, getTypeList(FilterType.type));
+
}
});
//鍏ㄩ儴鏃堕棿(褰撳ぉ銆佽繎3澶┿�佽繎7澶┿�佽繎30澶�)鎸夐挳
@@ -197,18 +181,7 @@
viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down);
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.show();
- typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() {
- @Override
- public void onClick(int position, String title) {
- viewBinding.allTimeTitleTv.setText(title);
- mTimeTypeFilterKye = FilterType.timeType;
- mTimeTypeFilterValue = findFilterValueString(title);
- loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
- }
- });
+ setTypeTitleListDialog(viewBinding.allTimeTitleTv, FilterType.timeType, getTypeList(FilterType.timeType));
}
});
@@ -248,13 +221,49 @@
@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);
}
});
}
+ }
+
+ /**
+ * 绫诲瀷绛涢��
+ *
+ * @param textView 缁勪欢鏄剧ず
+ * @param filterType 杩囨护绫诲瀷
+ * @param stringList 杩囨护绫诲瀷鍊艰〃
+ */
+ private void setTypeTitleListDialog(TextView textView, String filterType, List<String> stringList) {
+ BTypeTitleListDialog typeTitleListDialog = new BTypeTitleListDialog(_mActivity, stringList);
+ typeTitleListDialog.show();
+ typeTitleListDialog.setOnListener(new BTypeTitleListDialog.OnClickListener() {
+ @Override
+ public void onClick(int position, String title) {
+ textView.setText(title);
+ switch (filterType) {
+ case FilterType.deviceType: {
+ mDeviceTypeFilterKye = filterType;
+ mDeviceTypeFilterValue = findFilterValueString(title);
+ }
+ break;
+ case FilterType.type: {
+ mTypeFilterKye = filterType;
+ mTypeFilterValue = findFilterValueString(title);
+ }
+ break;
+ case FilterType.timeType: {
+ mTimeTypeFilterKye = filterType;
+ mTimeTypeFilterValue = findFilterValueString(title);
+ }
+ break;
+ }
+ loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
+ }
+ });
}
@@ -290,7 +299,7 @@
// 鍙栨秷绮樻�т簨浠�
EventBus.getDefault().removeStickyEvent(eventBus);
//杩涙潵璇诲彇涓�娆℃暟鎹�(涓轰簡鏇存柊currentPage锛宑urrentTotal杩欎釜鍊�)
- initData();
+// initData();
HdlLogLogic.print("姝e湪鐐瑰嚮銆愭秷鎭��");
}
@@ -509,10 +518,15 @@
@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);
- }
+ HdlThreadLogic.runMainThread(new Runnable() {
+ @Override
+ public void run() {
+ TextView textView = _mActivity.findViewById(R.id.my_message_bottom_il2).findViewById(R.id.red_count_tv);
+ if (textView != null) {
+ textView.setVisibility(View.GONE);
+ }
+ }
+ });
}
});
}
--
Gitblit v1.8.0