From 48bd94f4e362c8a604017cbaf4c12e08be10c816 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 10 五月 2024 17:25:37 +0800
Subject: [PATCH] 2024年05月10日17:25:30
---
app/src/main/res/values/strings.xml | 5
app/src/main/res/layout/fragment_message.xml | 354 +++++++++----
app/src/main/java/com/hdl/photovoltaic/ui/message/RecoverMessageFragment.java | 26
app/src/main/java/com/hdl/photovoltaic/ui/adapter/MessageAdapter.java | 53 +
app/src/main/res/drawable/house_list_line_parent_bg.xml | 2
app/src/main/res/layout/item_message.xml | 16
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | 5
app/src/main/res/layout/item_type_title.xml | 1
app/src/main/java/com/hdl/photovoltaic/other/HdlOtaLogic.java | 8
app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java | 2
/dev/null | 317 ------------
app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java | 619 +++++++++++++++++++-----
app/src/main/java/com/hdl/photovoltaic/ui/bean/UnCountBean.java | 36 +
app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java | 12
app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java | 25
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java | 8
16 files changed, 866 insertions(+), 623 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
index c3e0a85..76837f2 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
@@ -11,6 +11,7 @@
import com.hdl.photovoltaic.internet.api.HttpApi;
import com.hdl.photovoltaic.listener.CloudCallBeak;
import com.hdl.photovoltaic.ui.bean.MessageBean;
+import com.hdl.photovoltaic.ui.bean.UnCountBean;
import java.util.ArrayList;
import java.util.Comparator;
@@ -309,7 +310,7 @@
*
* @param cloudCallBeak -
*/
- public void getMessageUntreatedCount(String homeId, CloudCallBeak<String> cloudCallBeak) {
+ public void getMessageUntreatedCount(String homeId, CloudCallBeak<UnCountBean> cloudCallBeak) {
String requestUrl = HttpApi.POST_Message_UntreatedCount;
JsonObject json = new JsonObject();
if (!TextUtils.isEmpty(homeId)) {
@@ -318,8 +319,16 @@
HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
@Override
public void onSuccess(String str) {
+ if (TextUtils.isEmpty(str)) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onSuccess(new UnCountBean());
+ }
+ return;
+ }
+
+ UnCountBean unCountBean = new Gson().fromJson(str, UnCountBean.class);
if (cloudCallBeak != null) {
- cloudCallBeak.onSuccess(str);
+ cloudCallBeak.onSuccess(unCountBean);
}
}
@@ -491,9 +500,9 @@
}
/**
- * 鑾峰彇鎸囧畾椤电殑鑾峰彇娑堟伅鍒楄〃(鐢ㄤ簬C绔�)
+ * 鑾峰彇鎸囧畾椤电殑鑾峰彇娑堟伅鍒楄〃
*
- * @param homeId 鐢电珯id
+ * @param homeId 鐢电珯id(濉�""榛樿璐﹀彿涓嬫墍鏈夋秷鎭�)
* @param pageNo 椤电爜
* @param messageStateType all:鍏ㄩ儴,UNTREATED:鏈鐞�,PROCESSED:宸插鐞�;
* @param deviceType_filter_key 绫诲瀷锛堣澶囷紝绛夌骇锛屾椂闂达級
@@ -502,7 +511,7 @@
* timeType锛圱ODAY 锛氫粖澶╋紱LAST_3_DAYS: 杩�3澶╋紱LAST_7_DAYS 锛氳繎7澶╋紱LAST_30_DAYS 锛氳繎30澶╋級锛�
* @param cloudCallBeak -
*/
- public void getPageNoMessageList_C(String homeId, int pageNo, String messageStateType, String deviceType_filter_key, String deviceType_filter_value, String type_filter_key, String type_filter_value, String timeType_filter_key, String timeType_filter_value, CloudCallBeak<MessageListClass> cloudCallBeak) {
+ public void getPageNoMessageList(String homeId, int pageNo, String messageStateType, String deviceType_filter_key, String deviceType_filter_value, String type_filter_key, String type_filter_value, String timeType_filter_key, String timeType_filter_value, CloudCallBeak<MessageListClass> cloudCallBeak) {
String requestUrl = HttpApi.POST_Message_List;
JsonObject json = new JsonObject();
if (!TextUtils.isEmpty(homeId)) {
@@ -619,13 +628,15 @@
/**
* 娑堟伅鍏ㄩ儴宸茶
*
- * @param homeId 娑堟伅id
+ * @param homeId 娑堟伅id(涓嶄紶宸茶鎵�鏈夌數绔欑殑锛屼紶鍊煎凡璇绘寚瀹氱數绔欑殑)
* @param cloudCallBeak -
*/
public void messageAllRead(String homeId, CloudCallBeak<Boolean> cloudCallBeak) {
String requestUrl = HttpApi.POST_Message_AllRead;
JsonObject json = new JsonObject();
- json.addProperty("homeId", homeId);
+ if (!TextUtils.isEmpty(homeId)) {
+ json.addProperty("homeId", homeId);
+ }
HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
@Override
public void onSuccess(String str) {
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlOtaLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlOtaLogic.java
index da664cc..bfc5c94 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlOtaLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlOtaLogic.java
@@ -536,12 +536,10 @@
//-100:娌℃湁鏁版嵁;-101:娌℃湁md5绉橀挜;-102:md5绉橀挜涓嶅;-103:鏈夊紓甯�;
if (zipData == null) {
this.eventBusPost(fileFullPath, driver, -100, HDLApp.getInstance().getString(R.string.exception_unable_to_pull_up_the_cloud_upgrade_file_data));
-// HdlLogLogic.print("鎷変笉鍒颁簯绔崌绾ф枃浠舵暟鎹�(-100)", true);
return false;
}
if (TextUtils.isEmpty(md5)) {
this.eventBusPost(fileFullPath, driver, -101, HDLApp.getInstance().getString(R.string.exception_failed_to_obtain_the_md5_key_of_the_upgrade_file_on_the_cloud));
-// HdlLogLogic.print("鎷夸笉鍒颁簯绔笂鍗囩骇鏂囦欢md5绉橀挜(-101)", true);
return false;
}
InputStream is = null;
@@ -555,7 +553,6 @@
long total = zipData.contentLength();
if (total == 0) {
this.eventBusPost(fileFullPath, driver, -102, HDLApp.getInstance().getString(R.string.exception_unable_to_pull_up_the_cloud_upgrade_file_data));
-// HdlLogLogic.print("鎷変笉鍒颁簯绔崌绾ф枃浠舵暟鎹�(-102)", true);
return false;
}
fos = new FileOutputStream(file);
@@ -563,7 +560,6 @@
while ((len = is.read(buf)) != -1) {
if (this.stopDownload) {
this.eventBusPost(fileFullPath, driver, -108, HDLApp.getInstance().getString(R.string.exception_the_user_cancels_downloading_the_upgrade_file));
-// HdlLogLogic.print("鐢ㄦ埛鍙栨秷涓嬭浇鍗囩骇鏂囦欢(-108)", true);
fos.flush();
fos.close();
is.close();
@@ -577,7 +573,6 @@
if (sum != total) {
//涓嶇瓑浜�100閮借鎶�,绛変簬100澶勭悊鏁村潡閫昏緫瀹屼箣鍚庡啀鎶�100;
this.eventBusPost(fileFullPath, driver, progress, "姝e父涓婃姤杩涘害鍊�--->" + progress);
-// HdlLogLogic.print("姝e父涓婃姤杩涘害鍊�--->" + progress, true);
}
}
fos.flush();
@@ -589,18 +584,15 @@
byte[] decrypt = AesUtils.decrypt(bytes);
if (decrypt == null) {
this.eventBusPost(fileFullPath, driver, -105, HDLApp.getInstance().getString(R.string.exception_failed_to_decrypt_the_upgrade_aes_file));
-// HdlLogLogic.print("鍗囩骇鏂囦欢aes瑙e瘑澶辫触(-105)", true);
return false;
}
String fileMD5 = Md5Utils.encodeMD5(decrypt);
if (TextUtils.isEmpty(fileMD5)) {
this.eventBusPost(fileFullPath, driver, -106, HDLApp.getInstance().getString(R.string.exception_failed_to_generate_md5_for_the_upgrade_file));
-// HdlLogLogic.print("鍗囩骇鏂囦欢鐢熸垚md5澶辫触澶辫触(-106)", true);
return false;
}
if (!md5.equals(fileMD5)) {
this.eventBusPost(fileFullPath, driver, -107, HDLApp.getInstance().getString(R.string.exception_description_failed_to_compare_the_md5_of_the_upgrade_file));
-// HdlLogLogic.print("鍗囩骇鏂囦欢md5姣斿澶辫触(-107)", true);
return false;
}
//todo 娉ㄦ剰:瑙e瘑涔嬪悗锛岃閲嶆柊鍐欐暟鎹�;
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
index 1975031..77eda60 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -43,6 +43,7 @@
import com.hdl.photovoltaic.ui.bean.Geolocation;
import com.hdl.photovoltaic.ui.bean.LinkBean;
import com.hdl.photovoltaic.ui.bean.OidBean;
+import com.hdl.photovoltaic.ui.bean.UnCountBean;
import com.hdl.photovoltaic.ui.me.AsRegardsActivity;
import com.hdl.photovoltaic.ui.me.PersonalDataActivity;
import com.hdl.photovoltaic.ui.me.SetActivity;
@@ -1265,9 +1266,9 @@
*/
private void uniGetMessageNumber(String type, Object data, DCUniMPJSCallback callback) {
String homeId = getKeyValue("homeId", getKeyValue("data", data));
- HdlMessageLogic.getInstance().getMessageUntreatedCount(homeId, new CloudCallBeak<String>() {
+ HdlMessageLogic.getInstance().getMessageUntreatedCount(homeId, new CloudCallBeak<UnCountBean>() {
@Override
- public void onSuccess(String data) {
+ public void onSuccess(UnCountBean data) {
uniCallbackData(type, data, callback);
}
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java
index dd855f2..936b0f0 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java
@@ -208,6 +208,9 @@
viewBinding.myPowerStationBottomIl0.clickTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ if (currentFragmentIndex == 0) {
+ return;
+ }
currentFragmentIndex = 0;
bottomViewChangeOfStyle();
postEventBus(HomepageTitleTabSwitch.homepage);
@@ -216,6 +219,9 @@
viewBinding.myPowerStationBottomIl1.clickTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ if (currentFragmentIndex == 1) {
+ return;
+ }
currentFragmentIndex = 1;
bottomViewChangeOfStyle();
postEventBus(HomepageTitleTabSwitch.powerstation);
@@ -224,6 +230,9 @@
viewBinding.myMessageBottomIl2.clickTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ if (currentFragmentIndex == 2) {
+ return;
+ }
currentFragmentIndex = 2;
bottomViewChangeOfStyle();
postEventBus(HomepageTitleTabSwitch.message);
@@ -232,6 +241,9 @@
viewBinding.myMeBottomIl3.clickTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ if (currentFragmentIndex == 3) {
+ return;
+ }
currentFragmentIndex = 3;
bottomViewChangeOfStyle();
postEventBus(HomepageTitleTabSwitch.me);
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/MessageAdapter.java b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/MessageAdapter.java
index 3dcd091..00515da 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/MessageAdapter.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/MessageAdapter.java
@@ -12,6 +12,7 @@
import androidx.recyclerview.widget.RecyclerView;
import com.hdl.photovoltaic.R;
+import com.hdl.photovoltaic.enums.DeviceType;
import com.hdl.photovoltaic.enums.MessageAlarmStateType;
import com.hdl.photovoltaic.ui.bean.MessageBean;
import com.hdl.photovoltaic.utils.TimeUtils;
@@ -24,10 +25,9 @@
private List<MessageBean> mList;
private final Context mContext;
- private MessageAdapter.OnclickListener noOnclickListener;//鐐瑰嚮浜嗙殑鐩戝惉鍣�
+ private OnClickListener mOnclickListener;//鐐瑰嚮浜嗙殑鐩戝惉鍣�
- public MessageAdapter(List<MessageBean> list, Context context) {
- mList = list;
+ public MessageAdapter(Context context) {
this.mContext = context;
}
@@ -41,11 +41,12 @@
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
MessageBean messageBean = this.mList.get(position);
+// String strName = getDeviceTypeStr(messageBean.getDeviceType()) + "(" + messageBean.getTitle() + ")";
holder.item_content_tv.setText(messageBean.getTitle());
holder.item_home_name_tv.setText(messageBean.getHomeName());
String date = TimeUtils.getTimeFromTimestamp(messageBean.getCreateTime());
holder.item_time_tv.setText(date);
- String type = "";//FAULT:鏁呴殰,WARN:鍛婅,EVENT:浜嬩欢
+ String type = "";//FAULT:鏁呴殰,WARN:鍛婅,EVENT:鎻愮ず
Drawable drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300);
if (messageBean.getType().equals(MessageAlarmStateType.fault)) {
type = mContext.getString(R.string.my_power_station_malfunction);
@@ -54,8 +55,8 @@
type = mContext.getString(R.string.message_alarm);
drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300);
} else if (messageBean.getType().equals(MessageAlarmStateType.event)) {
- type =mContext.getString(R.string.event);
- drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300);
+ type = mContext.getString(R.string.loading_title_tip);
+ drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_b9b9b9);
}
holder.item_estate_tv.setText(type);
holder.item_estate_tv.setBackground(drawable);
@@ -69,8 +70,8 @@
@Override
public void onClick(View v) {
try {
- if (noOnclickListener != null) {
- noOnclickListener.onClick((int) holder.itemView.getTag(), messageBean);
+ if (mOnclickListener != null) {
+ mOnclickListener.onClick((int) holder.itemView.getTag(), messageBean);
}
} catch (Exception ignored) {
}
@@ -85,12 +86,19 @@
}
- public void setList(List<MessageBean> list) {
- this.mList = list;
+ public void setList(List<MessageBean> newData) {
+ if (this.mList == null) {
+ this.mList = new ArrayList<>();
+ } else {
+ this.mList.clear();
+ }
+
+ this.mList.addAll(newData);
+ notifyDataSetChanged();
}
- public void setNoOnclickListener(MessageAdapter.OnclickListener onclickListener) {
- this.noOnclickListener = onclickListener;
+ public void setOnclickListener(OnClickListener onClickListener) {
+ this.mOnclickListener = onClickListener;
}
/**
@@ -113,8 +121,27 @@
}
}
- public interface OnclickListener {
+ public interface OnClickListener {
void onClick(int position, MessageBean messageBean);
}
+ /**
+ * 閫氳繃鏋氫妇杞崲璁惧绫诲瀷鐨勫瓧绗�
+ *
+ * @param deviceType //璁惧绫诲瀷(INV 锛� 閫嗗彉鍣�, BMS 锛� BMS鎺у埗鐩�, BATTERY 锛� 鐢垫睜鍗曞厓)
+ * @return 璁惧绫诲瀷
+ */
+ private String getDeviceTypeStr(String deviceType) {
+ switch (deviceType) {
+ case DeviceType.inv:
+ return mContext.getString(R.string.alarm_all_device_inverter);
+ case DeviceType.bms:
+ return mContext.getString(R.string.alarm_all_device_bms);
+ case DeviceType.battery:
+ return mContext.getString(R.string.alarm_all_device_battery_cell);
+ default:
+ return "";
+ }
+ }
+
}
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/bean/UnCountBean.java b/app/src/main/java/com/hdl/photovoltaic/ui/bean/UnCountBean.java
new file mode 100644
index 0000000..d591cd0
--- /dev/null
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/bean/UnCountBean.java
@@ -0,0 +1,36 @@
+package com.hdl.photovoltaic.ui.bean;
+
+import java.io.Serializable;
+
+public class UnCountBean implements Serializable {
+
+ private int untreatedCount;//鏈鐞嗘暟閲�
+ private int processedCount;//宸插鐞嗘暟
+ private int unreadCount;//鏈鏁伴噺
+
+ public int getUntreatedCount() {
+ return untreatedCount;
+ }
+
+ public void setUntreatedCount(int untreatedCount) {
+ this.untreatedCount = untreatedCount;
+ }
+
+ public int getProcessedCount() {
+ return processedCount;
+ }
+
+ public void setProcessedCount(int processedCount) {
+ this.processedCount = processedCount;
+ }
+
+ public int getUnreadCount() {
+ return unreadCount;
+ }
+
+ public void setUnreadCount(int unreadCount) {
+ this.unreadCount = unreadCount;
+ }
+
+
+}
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/message/AllMessageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/message/AllMessageFragment.java
deleted file mode 100644
index 8597c39..0000000
--- a/app/src/main/java/com/hdl/photovoltaic/ui/message/AllMessageFragment.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package com.hdl.photovoltaic.ui.message;
-
-import android.content.Intent;
-import android.os.Bundle;
-
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-
-import com.hdl.linkpm.sdk.core.exception.HDLException;
-import com.hdl.photovoltaic.R;
-import com.hdl.photovoltaic.base.CustomBaseFragment;
-import com.hdl.photovoltaic.config.ConstantManage;
-import com.hdl.photovoltaic.databinding.FragmentMessageAllBinding;
-import com.hdl.photovoltaic.enums.MessageFunctionTabSwitch;
-import com.hdl.photovoltaic.enums.MessageStateType;
-import com.hdl.photovoltaic.listener.CloudCallBeak;
-import com.hdl.photovoltaic.other.HdlCommonLogic;
-import com.hdl.photovoltaic.other.HdlLogLogic;
-import com.hdl.photovoltaic.other.HdlMessageLogic;
-import com.hdl.photovoltaic.other.HdlThreadLogic;
-import com.hdl.photovoltaic.ui.adapter.MessageAdapter;
-import com.hdl.photovoltaic.ui.bean.MessageBean;
-import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
-
-import org.greenrobot.eventbus.EventBus;
-import org.greenrobot.eventbus.Subscribe;
-import org.greenrobot.eventbus.ThreadMode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 娑堟伅-鍏ㄩ儴
- */
-public class AllMessageFragment extends CustomBaseFragment {
-
- private FragmentMessageAllBinding viewBinding;
-
- private MessageAdapter messageAllAdapter;
-
- private final List<MessageBean> mList = new ArrayList<>();
-
- @Override
- public Object getContentView() {
- viewBinding = FragmentMessageAllBinding.inflate(getLayoutInflater());
- return viewBinding.getRoot();
- }
-
- @Override
- public void onBindView(Bundle savedInstanceState) {
- //鍒濆鍖栨暟鎹�
- initData();
- //鍒濆鍖栫晫闈�
- initView();
- //鍒濆鍖栫洃鍚櫒
- initEvent();
- }
-
- private void initData() {
- mList.clear();
- mList.addAll(HdlMessageLogic.getInstance().getAllMessageList());
- }
-
-
- private void initEvent() {
-
- //璁剧疆涓嬫媺绠ご棰滆壊
- viewBinding.messageAllSrl.setColorSchemeResources(R.color.text_FF245EC3);
- viewBinding.messageAllSrl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
- @Override
- public void onRefresh() {
- mList.clear();//琛ㄧず寮哄埗閲嶆柊璇锋眰娑堟伅鍒楄〃
- updateListData();//娓呯┖涔嬪墠缂撳瓨,鍥犱负閬囧埌涓�涓棶棰樼寷鎷夌殑鏃跺�欐姤閿�;
- getAllMessageList(false);
- HdlLogLogic.print("AllMessageFragment涓嬫媺鍒锋柊", false);
- }
- });
- if (messageAllAdapter != null) {
- messageAllAdapter.setNoOnclickListener(new MessageAdapter.OnclickListener() {
- @Override
- public void onClick(int position, MessageBean item) {
- if (position < 0 || position > mList.size()) {
- return;
- }
- Intent intent = new Intent();
- intent.putExtra("msgId", item.getMsgId().toString());
- intent.setClass(_mActivity, MessageInfoActivity.class);
- startActivity(intent);
- }
- });
- }
-
-
- }
-
- private void initView() {
- viewBinding.messageAllRecyclerview.setLayoutManager(new LinearLayoutManager(_mActivity));
- messageAllAdapter = new MessageAdapter(this.mList, _mActivity);
- viewBinding.messageAllRecyclerview.setAdapter(messageAllAdapter);
- }
-
- /**
- * 鍒锋柊鍒楄〃鏁版嵁
- */
- private void updateListData() {
- if (this.messageAllAdapter != null) {
- this.messageAllAdapter.setList(mList);
- this.messageAllAdapter.notifyDataSetChanged();
- }
- }
-
- @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
- public void onEventMessage(BaseEventBus eventBus) {
- super.onEventMessage(eventBus);
- if (eventBus == null) {
- return;
- }
- //鎺ユ敹澶栭儴鐐瑰嚮浜嬩欢
- if (eventBus.getTopic().equals(ConstantManage.message_function_tab_switch)) {
- if (eventBus.getType().equals(MessageFunctionTabSwitch.all.toString())) {
- initData();
- getAllMessageList(true);
- // 鍙栨秷绮樻�т簨浠�
- EventBus.getDefault().removeStickyEvent(eventBus);
- }
- } else if (eventBus.getTopic().equals(ConstantManage.message_function_push_post)) {
- if (eventBus.getType().equals(MessageStateType.all)) {
- //娑堟伅璇︽儏鍥炶皟
-// initData();
-// updateListData();
- }
- }
- }
-
- /**
- * 鑾峰彇鍏ㄩ儴涓殑娑堟伅鍒楄〃
- *
- * @param isShowLoading 鏄惁鍚姩 true鍚姩
- */
- private void getAllMessageList(boolean isShowLoading) {
- if (mList.size() == 0) {
- if (isShowLoading) {
- showLoading();
- }
- HdlMessageLogic.getInstance().getAllMessageList(new CloudCallBeak<List<MessageBean>>() {
- @Override
- public void onSuccess(List<MessageBean> list) {
-
- HdlThreadLogic.runMainThread(new Runnable() {
- @Override
- public void run() {
- if (isShowLoading) {
- hideLoading();
- }
- if (!isShowLoading) {
- viewBinding.messageAllSrl.setRefreshing(false);
- }
-
- if (list != null && list.size() != 0) {
- mList.addAll(list);
- updateListData();
- }
- }
- });
- }
-
- @Override
- public void onFailure(HDLException e) {
- if (isShowLoading) {
- hideLoading();
- }
- if (!isShowLoading) {
- viewBinding.messageAllSrl.setRefreshing(false);
- }
- }
- });
- }
- }
-
-
-}
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 ea34e28..3c1e038 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
@@ -1,20 +1,34 @@
package com.hdl.photovoltaic.ui.message;
+import android.annotation.SuppressLint;
+import android.content.Intent;
import android.os.Bundle;
import android.view.View;
+import android.widget.TextView;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentTransaction;
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+import com.hdl.linkpm.sdk.core.exception.HDLException;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.base.CustomBaseFragment;
import com.hdl.photovoltaic.config.ConstantManage;
import com.hdl.photovoltaic.databinding.FragmentMessageBinding;
+import com.hdl.photovoltaic.enums.FilterType;
import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch;
-import com.hdl.photovoltaic.enums.MessageFunctionTabSwitch;
+import com.hdl.photovoltaic.enums.MessageStateType;
+import com.hdl.photovoltaic.listener.CloudCallBeak;
+import com.hdl.photovoltaic.other.HdlCommonLogic;
import com.hdl.photovoltaic.other.HdlLogLogic;
+import com.hdl.photovoltaic.other.HdlMessageLogic;
+import com.hdl.photovoltaic.other.HdlThreadLogic;
+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.sdk.link.core.bean.eventbus.BaseEventBus;
import org.greenrobot.eventbus.EventBus;
@@ -22,7 +36,9 @@
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* 娑堟伅
@@ -31,12 +47,23 @@
private FragmentMessageBinding viewBinding;
- //褰撳墠鏄剧ず鐨刦ragment
- private static final String CURRENT_FRAGMENT = "state_fragment_show";
- private FragmentManager mFragmentManager;
- private Fragment currentFragment = new Fragment();
- private final List<Fragment> fragmentList = new ArrayList<>();
- private int currentIndex = 0;
+ private MessageAdapter mMessageAdapter;
+ private boolean isAlarmDeviceClick = true;//true琛ㄧず鍛婅璁惧琚�変腑,鍒檉alse琛ㄧず鎶ヨ璁板綍琚�変腑
+
+ private final List<MessageBean> mList = new ArrayList<>();
+ private int mCurrentPage = 0; // 褰撳墠椤电爜
+ private int mCurrentTotal = 0; // 鎬婚〉鐮�
+ private String mDeviceTypeFilterKye = FilterType.deviceType;//杩囨护绫诲瀷 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澶╋級锛�
+
+
+ private boolean isLoadingMore = false; // 鏍囪姝e湪鍔犺浇鏇村鏁版嵁
@Override
public Object getContentView() {
@@ -46,165 +73,200 @@
@Override
public void onBindView(Bundle savedInstanceState) {
-
- //鍒濆鍖栫鐗�
- initFragment(savedInstanceState);
//鍒濆鍖栫晫闈�
initView();
//鍒濆鍖栫洃鍚櫒
initEvent();
//鍒濆鍖栨暟鎹�
initData();
+
}
private void initEvent() {
//鍙戠敓涓�
- viewBinding.messageTabNascentCl.setOnClickListener(new View.OnClickListener() {
+ viewBinding.messageTabNascentTitleTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- currentIndex = 0;
- initView();
- showFragment();
- postEventBus(MessageFunctionTabSwitch.nascent);
-
+ if (isAlarmDeviceClick) {
+ return;
+ }
+ isAlarmDeviceClick = true;
+ viewBinding.messageTabNascentTitleTv.setTextAppearance(R.style.Text20Style);
+ viewBinding.messageTabRecoverTitleTv.setTextAppearance(R.style.Text16Style);
+ viewBinding.allClearTv.setVisibility(View.VISIBLE);
+ loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
}
});
- //宸叉仮澶�
- viewBinding.messageTabRecoverCl.setOnClickListener(new View.OnClickListener() {
+ //鎶ヨ璁板綍
+ viewBinding.messageTabRecoverTitleTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- currentIndex = 1;
- initView();
- showFragment();
- postEventBus(MessageFunctionTabSwitch.recover);
-
+ if (!isAlarmDeviceClick) {
+ return;
+ }
+ isAlarmDeviceClick = false;
+ viewBinding.messageTabNascentTitleTv.setTextAppearance(R.style.Text16Style);
+ viewBinding.messageTabRecoverTitleTv.setTextAppearance(R.style.Text20Style);
+ viewBinding.allClearTv.setVisibility(View.GONE);
+ loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
}
});
- //鍏ㄩ儴
- viewBinding.messageTabAllCl.setOnClickListener(new View.OnClickListener() {
+ //娓呯┖鎵�鏈夋湭璇绘寜閽�
+ viewBinding.allClearTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- currentIndex = 2;
- initView();
- showFragment();
- postEventBus(MessageFunctionTabSwitch.all);
+ showLoading();
+ HdlMessageLogic.getInstance().messageAllRead("", new CloudCallBeak<Boolean>() {
+ @Override
+ public void onSuccess(Boolean obj) {
+ hideLoading();
+ loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+ hideLoading();
+ HdlThreadLogic.toast(_mActivity, e);
+ }
+ });
}
});
+
+ //鍏ㄩ儴璁惧(鍏ㄩ儴璁惧銆侀�嗗彉鍣ㄣ�丅MS鎺у埗鐩掋�佺數姹犲崟鍏�)鎸夐挳
+ viewBinding.messageTabAllDeviceCl.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ 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(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
+
+ }
+ });
+
+
+ }
+ });
+ //鍏ㄩ儴绛夌骇(鏁呴殰銆佽鍛娿�佹彁绀�)鎸夐挳
+ viewBinding.messageTabAllGradeCl.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ 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(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
+ }
+ });
+ }
+ });
+ //鍏ㄩ儴鏃堕棿(褰撳ぉ銆佽繎3澶┿�佽繎7澶┿�佽繎30澶�)鎸夐挳
+ viewBinding.messageTabAllTimeCl.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ 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(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
+ }
+ });
+ }
+ });
+
+ //涓嬫媺鎸夐挳
+ viewBinding.messageSrl.setColorSchemeResources(R.color.text_FF245EC3);
+ viewBinding.messageSrl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
+ @Override
+ public void onRefresh() {
+ viewBinding.messageSrl.setRefreshing(false);
+ loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
+ }
+ });
+ //涓婃媺鎸夐挳
+ viewBinding.messageRcv.addOnScrollListener(new RecyclerView.OnScrollListener() {
+ @Override
+ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
+// super.onScrolled(recyclerView, dx, dy);
+
+ LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
+ if (layoutManager == null) {
+ return;
+ }
+ int visibleItemCount = layoutManager.getChildCount();
+ int totalItemCount = layoutManager.getItemCount();
+ int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition();
+ if (visibleItemCount > 0 && visibleItemCount + firstVisibleItemPosition == totalItemCount) {
+ if (!isLoadingMore) {
+ // 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔
+ HdlLogLogic.print("--->婊戝姩鍒颁簡搴曢儴");
+ loadNextPageMessageList(++mCurrentPage, false, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, false);
+ }
+ }
+ }
+ });
+ if (mMessageAdapter != null) {
+ mMessageAdapter.setOnclickListener(new MessageAdapter.OnClickListener() {
+ @Override
+ public void onClick(int position, MessageBean messageBean) {
+ Intent intent = new Intent();
+ intent.putExtra("msgId", messageBean.getMsgId().toString());
+ intent.setClass(_mActivity, MessageInfoActivity.class);
+ startActivity(intent);
+ }
+ });
+
+ }
}
private void initView() {
- if (this.currentIndex == 0) {
- viewBinding.messageTabNascentTitleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
- viewBinding.messageTabRecoverTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
- viewBinding.messageTabAllTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
- viewBinding.line1V.setVisibility(View.VISIBLE);
- viewBinding.line2V.setVisibility(View.GONE);
- viewBinding.line3V.setVisibility(View.GONE);
- } else if (this.currentIndex == 1) {
- viewBinding.messageTabNascentTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
- viewBinding.messageTabRecoverTitleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
- viewBinding.messageTabAllTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
- viewBinding.line1V.setVisibility(View.GONE);
- viewBinding.line2V.setVisibility(View.VISIBLE);
- viewBinding.line3V.setVisibility(View.GONE);
- } else if (this.currentIndex == 2) {
- viewBinding.messageTabNascentTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
- viewBinding.messageTabRecoverTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
- viewBinding.messageTabAllTitleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
- viewBinding.line1V.setVisibility(View.GONE);
- viewBinding.line2V.setVisibility(View.GONE);
- viewBinding.line3V.setVisibility(View.VISIBLE);
+ if (isAlarmDeviceClick) {
+ viewBinding.messageTabNascentTitleTv.setTextAppearance(R.style.Text20Style);
+ viewBinding.messageTabRecoverTitleTv.setTextAppearance(R.style.Text16Style);
+ } else {
+ viewBinding.messageTabNascentTitleTv.setTextAppearance(R.style.Text16Style);
+ viewBinding.messageTabRecoverTitleTv.setTextAppearance(R.style.Text20Style);
}
+ mMessageAdapter = new MessageAdapter(_mActivity);
+ viewBinding.messageRcv.setLayoutManager(new LinearLayoutManager(_mActivity));
+ viewBinding.messageRcv.setAdapter(mMessageAdapter);
}
private void initData() {
+ //杩涙潵璇诲彇涓�娆℃暟鎹�(涓轰簡鏇存柊currentPage锛宑urrentTotal杩欎釜鍊�),app鍚姩鏃跺�欒鍙栵紝涓轰簡鍒锋柊娑堟伅妯″潡鐨勮鏍�
+ loadNextPageMessageList(1, true, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, true);
}
- /**
- * 鍙戝竷鐐瑰嚮浜嬩欢
- *
- * @param tabSwitch -
- */
- private void postEventBus(MessageFunctionTabSwitch tabSwitch) {
- BaseEventBus baseEventBus = new BaseEventBus();
- baseEventBus.setTopic(ConstantManage.message_function_tab_switch);
- baseEventBus.setType(tabSwitch.toString());
- //鍙戦�佺矘鎬т簨浠�(濡傛灉涓嶅彂绮樻�т簨浠朵細閬囧埌涓�涓病鏈夊姞杞藉嚭鏉ョ殑纰庣墖鎺ユ敹涓嶅埌淇℃伅)
- EventBus.getDefault().postSticky(baseEventBus);
- }
-
-
- /**
- * 鍒濆鍖朏ragment
- *
- * @param savedInstanceState -
- */
- private void initFragment(Bundle savedInstanceState) {
- mFragmentManager = _mActivity.getSupportFragmentManager();
- //纰庣墖鍒濆鍖�
- NascentMessageFragment mNascentMessageFragment = new NascentMessageFragment();
- RecoverMessageFragment mRecoverMessageFragment = new RecoverMessageFragment();
- AllMessageFragment mAllMessageFragment = new AllMessageFragment();
- if (savedInstanceState != null) {
- //鈥滃唴瀛橀噸鍚�濇椂璋冪敤 鑾峰彇鈥滃唴瀛橀噸鍚�濇椂淇濆瓨鐨勭储寮曚笅鏍�
- currentIndex = savedInstanceState.getInt(CURRENT_FRAGMENT, 0);
- if (fragmentList.size() != 0) {
- fragmentList.clear();
- }
- fragmentList.add(mFragmentManager.findFragmentByTag(0 + ""));
- fragmentList.add(mFragmentManager.findFragmentByTag(1 + ""));
- fragmentList.add(mFragmentManager.findFragmentByTag(2 + ""));
- restoreFragment();//鎭㈠fragment椤甸潰
- } else {
- //姝e父鍚姩鏃惰皟鐢�
- fragmentList.add(mNascentMessageFragment);
- fragmentList.add(mRecoverMessageFragment);
- fragmentList.add(mAllMessageFragment);
- showFragment();
- }
-
- }
-
- /**
- * 浣跨敤show() hide()鍒囨崲椤甸潰
- * 鏄剧ずfragment
- */
- private void showFragment() {
- FragmentTransaction ft = mFragmentManager.beginTransaction();
- //濡傛灉涔嬪墠娌℃湁娣诲姞杩�
- if (!fragmentList.get(currentIndex).isAdded()) {
- //绗笁涓弬鏁颁负娣诲姞褰撳墠鐨刦ragment鏃剁粦瀹氫竴涓猼ag
- ft.hide(currentFragment).add(R.id.message_fcv, fragmentList.get(currentIndex), currentIndex + "");
- } else {
- ft.hide(currentFragment).show(fragmentList.get(currentIndex));
- }
- currentFragment = fragmentList.get(currentIndex);
- ft.commit();
- //鎶婂綋鍓嶆樉绀虹殑fragment璁板綍涓嬫潵
- currentFragment = fragmentList.get(currentIndex);
-
-
- }
-
- /**
- * 鎭㈠fragment
- */
- private void restoreFragment() {
- FragmentTransaction ft = mFragmentManager.beginTransaction();
- for (int i = 0; i < fragmentList.size(); i++) {
- if (i == currentIndex) {
- ft.show(fragmentList.get(i));
- } else {
- ft.hide(fragmentList.get(i));
- }
- }
- ft.commit();
-
- }
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
public void onEventMessage(BaseEventBus eventBus) {
@@ -217,10 +279,297 @@
if (eventBus.getType().equals(HomepageTitleTabSwitch.message.toString())) {
// 鍙栨秷绮樻�т簨浠�
EventBus.getDefault().removeStickyEvent(eventBus);
- postEventBus(MessageFunctionTabSwitch.nascent);
+ //杩涙潵璇诲彇涓�娆℃暟鎹�(涓轰簡鏇存柊currentPage锛宑urrentTotal杩欎釜鍊�)
+ initData();
HdlLogLogic.print("姝e湪鐐瑰嚮銆愭秷鎭��");
}
}
}
+
+ /**
+ * 鍔犺浇涓�椤垫暟鎹�
+ *
+ * @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澶╋級锛�
+ * @param isClear true琛ㄧず娓呯┖缂撳瓨
+ */
+ 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,
+ boolean isClear) {
+ if (isClear) {
+ //琛ㄧず浠庣涓�椤靛彲浠ヨ鍙栵紝榛樿娓呯┖鎵�鏈夌紦瀛樻暟鎹�;
+ clearCacheData();
+ }
+ //绗竴椤佃鍙栨暟鎹己鍒惰
+ if (pageNo > 1 && mCurrentPage > mCurrentTotal) {
+ --mCurrentPage;
+ //褰撳墠椤典笉鑳藉ぇ浜庢�婚〉鏁�
+ return;
+ }
+ isLoadingMore = true;//鏍囪璇诲彇鐘舵��
+ if (isShowLoading) {
+ showLoading();
+ }
+ String messageStateType;
+ if (isAlarmDeviceClick) {
+ messageStateType = MessageStateType.untreated;
+ } else {
+ messageStateType = MessageStateType.processed;
+ }
+ HdlMessageLogic.getInstance().getPageNoMessageList("", 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();
+ updateListData();
+ }
+ isLoadingMore = false;
+ if (isShowLoading) {
+ hideLoading();
+ }
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+ if (mCurrentPage > 1) {
+ --mCurrentPage;
+ }
+ isLoadingMore = false;
+ if (isShowLoading) {
+ hideLoading();
+ }
+ }
+ });
+
+
+ }
+
+ /**
+ * 鍒锋柊鍒楄〃鏁版嵁
+ */
+ private void updateListData() {
+ HdlThreadLogic.runMainThread(new Runnable() {
+ @Override
+ public void run() {
+ //璇诲彇缂撳瓨鏁版嵁
+ updateCacheData();
+ //鍒锋柊鍒楄〃
+ updateRecyclerViewList();
+ //鏄剧ず鏈淇℃伅鎬绘暟閲�
+ getUnreadCount();
+ //鏄剧ず娌℃暟鎹甎i鏍峰紡
+ nullDataUpdateUi();
+
+ }
+ });
+ }
+
+ /**
+ * 鍒锋柊淇℃伅鏁伴噺鎬绘暟
+ *
+ * @param nascentTotalCount 鍙戦�佷腑娑堟伅鎬绘暟閲�
+ * @param recoverTotalCount 鎶ヨ璁板綍娑堟伅鎬绘暟閲�
+ */
+ private void refreshAascentAndRecoverTotalCount(int nascentTotalCount, int recoverTotalCount) {
+ HdlThreadLogic.runMainThread(new Runnable() {
+ @Override
+ public void run() {
+ //璁惧鎶ヨ鎬绘暟閲�
+ TextView nascentTv = _mActivity.findViewById(R.id.message_tab_nascent_title_tv);
+ if (nascentTv != null) {
+ nascentTv.setText(getText(R.string.message_nascent));
+ if (nascentTotalCount > 0) {
+ String s = getText(R.string.message_nascent) + "(" + nascentTotalCount + ")";
+ nascentTv.setText(s);
+ }
+ }
+ //鎶ヨ璁板綍鎬绘暟閲�
+ TextView recoverTV = _mActivity.findViewById(R.id.message_tab_recover_title_tv);
+ if (recoverTV != null) {
+ recoverTV.setText(getText(R.string.alarm_record));
+ if (recoverTotalCount > 0) {
+ String s = getText(R.string.alarm_record) + "(" + recoverTotalCount + ")";
+ recoverTV.setText(s);
+ }
+ }
+ }
+ });
+
+ }
+
+ /**
+ * 鍒锋柊銆愭秷鎭ā鍧椼�戜笅瑙掓爣鏁板��
+ *
+ * @param unreadCount 鏈淇℃伅鏁伴噺鎬绘暟
+ */
+ private void refreshUnreadCount(int unreadCount) {
+ HdlThreadLogic.runMainThread(new Runnable() {
+ @SuppressLint("SetTextI18n")
+ @Override
+ public void run() {
+ TextView textView = _mActivity.findViewById(R.id.my_message_bottom_il2).findViewById(R.id.red_count_tv);
+ if (textView != null) {
+ if (unreadCount == 0) {
+ textView.setVisibility(View.GONE);
+ } else {
+ textView.setVisibility(View.VISIBLE);
+ if (unreadCount > 99) {
+ textView.setText("99+");
+ } else {
+ textView.setText(unreadCount + "");
+ }
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * 閲嶆柊鏇存柊鍒楄〃鏁版嵁
+ */
+ private void updateRecyclerViewList() {
+ if (mMessageAdapter == null) {
+ return;
+ }
+ mMessageAdapter.setList(mList);
+ }
+
+ /**
+ * 娓呯┖鎵�鏈夌紦瀛樻暟鎹�(鑾峰彇绗竴椤典箣鍓嶈娓呯┖鎵�鏈夌紦瀛樻暟鎹�)
+ */
+ private void clearCacheData() {
+ mList.clear();
+ HdlMessageLogic.getInstance().clearListMessage();//琛ㄧず寮哄埗娓呯┖鎵�鏈夌紦瀛樹俊鎭�
+ }
+
+ /**
+ * 鏇存柊缂撳瓨鏁版嵁
+ */
+ private void updateCacheData() {
+ mList.clear();
+ if (isAlarmDeviceClick) {
+ //璁惧鎶ヨ
+ mList.addAll(HdlMessageLogic.getInstance().getNascentMessageMemoryList());
+ } else {
+ //鎶ヨ璁板綍
+ mList.addAll(HdlMessageLogic.getInstance().getRecoverMessageMemoryList());
+ }
+ }
+
+ /**
+ * 璇诲彇娑堟伅銆愭湭璇绘暟閲�,鏈鐞嗘�绘暟閲忥紝宸插鐞嗘�绘暟閲忋��
+ */
+ private void getUnreadCount() {
+ HdlMessageLogic.getInstance().getMessageUntreatedCount("", new CloudCallBeak<UnCountBean>() {
+ @Override
+ public void onSuccess(UnCountBean unCountBean) {
+
+ HdlThreadLogic.runMainThread(new Runnable() {
+ @Override
+ public void run() {
+ if (unCountBean == null) {
+ return;
+ }
+ refreshAascentAndRecoverTotalCount(unCountBean.getUntreatedCount(), unCountBean.getProcessedCount());
+ refreshUnreadCount(unCountBean.getUnreadCount());
+ }
+
+ });
+ }
+
+ @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);
+ }
+ }
+ });
+ }
+
+
+ /**
+ * 娌℃湁娑堟伅鍒楄〃鐨勬牱寮�
+ */
+ private void nullDataUpdateUi() {
+ HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.nullDataIc.getRoot(), viewBinding.nullDataIc.nullDataGifAnimationIv, viewBinding.nullDataIc.nullDataTv, getString(R.string.message_alarm_data_null), mList.size() > 0);
+ }
+
+ /**
+ * 鏌ユ壘杩囨护鍊�
+ *
+ * @param title 鏍囬
+ * @return 杩囨护鍊�
+ */
+ public String findFilterValueString(String title) {
+ Map<String, String> map = new HashMap<>();
+ map.put(getString(R.string.alarm_all_device), "");//璁惧鍏ㄩ儴
+ 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_grade), "");//璁剧瓑绾у叏閮�
+ map.put(getString(R.string.alarm_all_grade_malfunction), "FAULT");
+ map.put(getString(R.string.alarm_all_grade_warning), "WARN");
+ map.put(getString(R.string.alarm_all_grade_tip), "EVENT");
+ map.put(getString(R.string.alarm_all_time), "");//鏃堕棿鍏ㄩ儴
+ map.put(getString(R.string.alarm_all_time_same_day), "TODAY");
+ map.put(getString(R.string.alarm_all_time_3), "LAST_3_DAYS");
+ map.put(getString(R.string.alarm_all_time_7), "LAST_7_DAYS");
+ map.put(getString(R.string.alarm_all_time_30), "LAST_30_DAYS");
+
+ for (Map.Entry<String, String> entry : map.entrySet()) {
+ if (title.equals(entry.getKey())) {
+ return entry.getValue();
+ }
+ }
+ return "";
+ }
+
+ /**
+ * 鑾峰彇绫诲瀷鍒楄〃
+ *
+ * @param filterType 杩囨护绫诲瀷
+ * @return 杩斿洖绫诲瀷鍒楄〃
+ */
+ private List<String> getTypeList(String filterType) {
+ List<String> stringList = new ArrayList<>();
+ switch (filterType) {
+ case FilterType.deviceType: {
+ stringList.add(getString(R.string.alarm_all_device));
+ 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));
+ }
+ break;
+ case FilterType.type: {
+ stringList.add(getString(R.string.alarm_all_grade));
+ stringList.add(getString(R.string.alarm_all_grade_malfunction));
+ stringList.add(getString(R.string.alarm_all_grade_warning));
+ stringList.add(getString(R.string.alarm_all_grade_tip));
+ }
+ break;
+ case FilterType.timeType: {
+ stringList.add(getString(R.string.alarm_all_time));
+ stringList.add(getString(R.string.alarm_all_time_same_day));
+ stringList.add(getString(R.string.alarm_all_time_3));
+ stringList.add(getString(R.string.alarm_all_time_7));
+ stringList.add(getString(R.string.alarm_all_time_30));
+ }
+ break;
+ }
+ return stringList;
+ }
}
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/message/NascentMessageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/message/NascentMessageFragment.java
deleted file mode 100644
index 1417088..0000000
--- a/app/src/main/java/com/hdl/photovoltaic/ui/message/NascentMessageFragment.java
+++ /dev/null
@@ -1,317 +0,0 @@
-package com.hdl.photovoltaic.ui.message;
-
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.os.Bundle;
-import android.text.TextUtils;
-import android.view.View;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.hdl.linkpm.sdk.core.exception.HDLException;
-import com.hdl.photovoltaic.R;
-import com.hdl.photovoltaic.base.CustomBaseFragment;
-import com.hdl.photovoltaic.config.ConstantManage;
-import com.hdl.photovoltaic.databinding.FragmentNascentMessageBinding;
-import com.hdl.photovoltaic.enums.MessageFunctionTabSwitch;
-import com.hdl.photovoltaic.enums.MessageStateType;
-import com.hdl.photovoltaic.listener.CloudCallBeak;
-import com.hdl.photovoltaic.other.HdlCommonLogic;
-import com.hdl.photovoltaic.other.HdlLogLogic;
-import com.hdl.photovoltaic.other.HdlMessageLogic;
-import com.hdl.photovoltaic.other.HdlThreadLogic;
-import com.hdl.photovoltaic.ui.adapter.MessageAdapter;
-import com.hdl.photovoltaic.ui.bean.MessageBean;
-import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
-
-import org.greenrobot.eventbus.EventBus;
-import org.greenrobot.eventbus.Subscribe;
-import org.greenrobot.eventbus.ThreadMode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 娑堟伅-鍙戠敓涓�
- */
-public class NascentMessageFragment extends CustomBaseFragment {
- private FragmentNascentMessageBinding viewBinding;
-
- private MessageAdapter messageNascentAdapter;
-
- private final List<MessageBean> mList = new ArrayList<>();
- private int currentPage = 0; // 褰撳墠椤电爜
- private int currentTotal = 0; // 鎬婚〉鐮�
-
-
- private boolean isLoadingMore = false; // 鏍囪姝e湪鍔犺浇鏇村鏁版嵁
-
- LinearLayoutManager layoutManager;
-
- @Override
- public Object getContentView() {
- viewBinding = FragmentNascentMessageBinding.inflate(getLayoutInflater());
- return viewBinding.getRoot();
- }
-
- @Override
- public void onBindView(Bundle savedInstanceState) {
- //鍒濆鍖栫晫闈�
- initView();
- //鍒濆鍖栫洃鍚櫒
- initEvent();
- //杩涙潵璇诲彇涓�娆℃暟鎹�(涓轰簡鏇存柊currentPage锛宑urrentTotal杩欎釜鍊�)
- loadNextPageNascentMessageList(1, true);
- }
-
-
- private void initEvent() {
- //璁剧疆涓嬫媺绠ご棰滆壊
- viewBinding.messageNascentSrl.setColorSchemeResources(R.color.text_FF245EC3);
- viewBinding.messageNascentSrl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
- @Override
- public void onRefresh() {
- viewBinding.messageNascentSrl.setRefreshing(false);
- mList.clear();//琛ㄧず寮哄埗閲嶆柊璇锋眰绗竴椤垫秷鎭垪琛�
- HdlMessageLogic.getInstance().clearListMessage();//琛ㄧず寮哄埗娓呯┖鎵�鏈夌紦瀛樹俊鎭�
- loadNextPageNascentMessageList(1, true);
- }
- });
- messageNascentAdapter.setNoOnclickListener(new MessageAdapter.OnclickListener() {
- @Override
- public void onClick(int position, MessageBean item) {
- if (position < 0 || position > mList.size()) {
- return;
- }
- Intent intent = new Intent();
- intent.putExtra("msgId", item.getMsgId().toString());
- intent.setClass(_mActivity, MessageInfoActivity.class);
- startActivity(intent);
-
- }
- });
-
- viewBinding.messageNascentRecyclerview.addOnScrollListener(new RecyclerView.OnScrollListener() {
- @Override
- public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
-// super.onScrolled(recyclerView, dx, dy);
-
- LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
- if (layoutManager == null) {
- return;
- }
- int visibleItemCount = layoutManager.getChildCount();
- int totalItemCount = layoutManager.getItemCount();
- int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition();
- if (visibleItemCount > 0 && visibleItemCount + firstVisibleItemPosition == totalItemCount) {
- if (!isLoadingMore) {
- // 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔
- HdlLogLogic.print("--->婊戝姩鍒颁簡搴曢儴");
- loadNextPageNascentMessageList(++currentPage, false);
- }
- }
- }
- });
- }
-
- private void initView() {
- layoutManager = new LinearLayoutManager(_mActivity);
- viewBinding.messageNascentRecyclerview.setLayoutManager(layoutManager);
- messageNascentAdapter = new MessageAdapter(this.mList, _mActivity);
- viewBinding.messageNascentRecyclerview.setAdapter(messageNascentAdapter);
- }
-
- /**
- * 鍒锋柊鍒楄〃鏁版嵁
- */
- private void updateListData() {
- HdlThreadLogic.runMainThread(new Runnable() {
- @Override
- public void run() {
- //鏇存柊鏈湴缂撳瓨鏁版嵁
- updatelocalityCacheData();
- //鍒锋柊鍒楄〃
- if (messageNascentAdapter != null) {
- messageNascentAdapter.setList(mList);
- messageNascentAdapter.notifyDataSetChanged();
- }
- //鏄剧ず鏈淇℃伅鎬绘暟閲�
- getUnreadCount();
- //鏄剧ず娌℃暟鎹甎i鏍峰紡
- nullDataUpdateUi();
-
- }
- });
- }
-
- /**
- * 鍒锋柊銆愬彂鐢熶腑銆戜俊鎭暟閲忔�绘暟
- */
- private void refreshNascentCount(String totalCount) {
- HdlThreadLogic.runMainThread(new Runnable() {
- @Override
- public void run() {
- TextView textView = _mActivity.findViewById(R.id.message_tab_nascent_title_tv);
- if (textView != null) {
- textView.setText(getText(R.string.message_nascent));
- if (!TextUtils.isEmpty(totalCount) && !totalCount.equals("0")) {
- String s = getText(R.string.message_nascent) + "(" + totalCount + ")";
- textView.setText(s);
- }
- }
- }
- });
- }
-
- /**
- * 鍒锋柊瑙掓爣銆愭湭璇汇�戜俊鎭暟閲忔�绘暟
- */
- private void refreshUnreadNascentCount(String unreadCount) {
- HdlThreadLogic.runMainThread(new Runnable() {
- @SuppressLint("SetTextI18n")
- @Override
- public void run() {
- TextView textView = _mActivity.findViewById(R.id.my_message_bottom_il2).findViewById(R.id.red_count_tv);
- if (textView != null) {
- if (TextUtils.isEmpty(unreadCount) || unreadCount.equals("0")) {
- textView.setVisibility(View.GONE);
- } else {
- textView.setVisibility(View.VISIBLE);
- if (unreadCount.length() > 2) {
- textView.setText("99+");
- } else {
- textView.setText(unreadCount);
- }
- }
- }
- }
- });
- }
-
- @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
- public void onEventMessage(BaseEventBus eventBus) {
- super.onEventMessage(eventBus);
- if (eventBus == null) {
- return;
- }
- //鎺ユ敹澶栭儴鐐瑰嚮浜嬩欢
- if (eventBus.getTopic().equals(ConstantManage.message_function_tab_switch)) {
- if (eventBus.getType().equals(MessageFunctionTabSwitch.nascent.toString())) {
- // 鍙栨秷绮樻�т簨浠�
- EventBus.getDefault().removeStickyEvent(eventBus);
-
- }
-
- } else if (eventBus.getTopic().equals(ConstantManage.message_function_push_post)) {
- if (eventBus.getType().equals(MessageStateType.untreated)) {
- //娑堟伅璇︽儏鍥炶皟
- updatelocalityCacheData();
- updateListData();
- }
- }
- }
-
- /**
- * 鏇存柊鏈湴缂撳瓨鏁版嵁
- */
- private void updatelocalityCacheData() {
- mList.clear();
- mList.addAll(HdlMessageLogic.getInstance().getNascentMessageMemoryList());
- }
-
- /**
- * 鍔犺浇涓�椤垫暟鎹�
- *
- * @param pageNo 椤垫暟
- * @param isShowLoading 鏄惁鍚姩鍔犺浇妗� true鍚姩
- */
- private void loadNextPageNascentMessageList(int pageNo, boolean isShowLoading) {
- //绗竴椤佃鍙栨暟鎹己鍒惰
- if (pageNo > 1 && currentPage > currentTotal) {
- --currentPage;
- //褰撳墠椤典笉鑳藉ぇ浜庢�婚〉鏁�
- return;
- }
- isLoadingMore = true;//鏍囪璇诲彇鐘舵��
- if (isShowLoading) {
- showLoading();
- }
- HdlMessageLogic.getInstance().getPageNoMessageList(pageNo, MessageStateType.untreated, new CloudCallBeak<HdlMessageLogic.MessageListClass>() {
- @Override
- public void onSuccess(HdlMessageLogic.MessageListClass messageListClass) {
- if (messageListClass != null) {
- currentTotal = (int) messageListClass.getTotalPage();
- currentPage = (int) messageListClass.getPageNo();
- updateListData();
- }
- isLoadingMore = false;
- if (isShowLoading) {
- hideLoading();
- }
- }
-
- @Override
- public void onFailure(HDLException e) {
- if (currentPage > 1) {
- --currentPage;
- }
- isLoadingMore = false;
- if (isShowLoading) {
- hideLoading();
- }
- }
- });
- }
-
- /**
- * 璇诲彇娑堟伅銆愭湭璇绘暟閲忋��
- */
- private void getUnreadCount() {
- HdlMessageLogic.getInstance().getMessageUntreatedCount("",new CloudCallBeak<String>() {
- @Override
- public void onSuccess(String data) {
-
- HdlThreadLogic.runMainThread(new Runnable() {
- @Override
- public void run() {
- JSONObject jsonObject = JSON.parseObject(data);
- if (jsonObject.containsKey("untreatedCount")) {
- //鏈鐞嗘暟閲�
- String untreatedCount = jsonObject.getString("untreatedCount");
- refreshNascentCount(untreatedCount);
- }
- if (jsonObject.containsKey("unreadCount")) {
- //鏈鏁伴噺
- String unreadCount = jsonObject.getString("unreadCount");
- refreshUnreadNascentCount(unreadCount);
- }
- }
- });
-
- }
-
- @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);
- }
- }
- });
- }
-
-
- /**
- * 娌℃湁鐢电珯鍒楄〃鐨勬牱寮�
- */
- private void nullDataUpdateUi() {
- HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.nullDataIc.getRoot(), viewBinding.nullDataIc.nullDataGifAnimationIv, viewBinding.nullDataIc.nullDataTv, getString(R.string.message_alarm_data_null), mList.size() > 0);
- }
-}
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/message/RecoverMessageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/message/RecoverMessageFragment.java
index e42864b..0c39ece 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/message/RecoverMessageFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/message/RecoverMessageFragment.java
@@ -88,18 +88,18 @@
loadNextPageRecoverMessageList(1, true);
}
});
- messageRecoverAdapter.setNoOnclickListener(new MessageAdapter.OnclickListener() {
- @Override
- public void onClick(int position, MessageBean item) {
- if (position < 0 || position > mList.size()) {
- return;
- }
- Intent intent = new Intent();
- intent.putExtra("msgId", item.getMsgId().toString());
- intent.setClass(_mActivity, MessageInfoActivity.class);
- startActivity(intent);
- }
- });
+// messageRecoverAdapter.setNoOnclickListener(new MessageAdapter.OnclickListener() {
+// @Override
+// public void onClick(int position, MessageBean item) {
+// if (position < 0 || position > mList.size()) {
+// return;
+// }
+// Intent intent = new Intent();
+// intent.putExtra("msgId", item.getMsgId().toString());
+// intent.setClass(_mActivity, MessageInfoActivity.class);
+// startActivity(intent);
+// }
+// });
viewBinding.messageRecoverRecyclerview.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
@@ -127,7 +127,7 @@
private void initView() {
viewBinding.messageRecoverRecyclerview.setLayoutManager(new LinearLayoutManager(_mActivity));
- messageRecoverAdapter = new MessageAdapter(this.mList, _mActivity);
+ messageRecoverAdapter = new MessageAdapter(_mActivity);
viewBinding.messageRecoverRecyclerview.setAdapter(messageRecoverAdapter);
}
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 bb187e1..d04d85f 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
@@ -336,7 +336,7 @@
} else {
messageStateType = MessageStateType.processed;
}
- HdlMessageLogic.getInstance().getPageNoMessageList_C(UserConfigManage.getInstance().getHomeId(), pageNo, messageStateType,
+ 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,
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
index f32beb7..64e341f 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
@@ -106,8 +106,8 @@
isClickPowerStationLabel = true;
viewBinding.powerStationLabel.setTextAppearance(R.style.Text20Style);
viewBinding.deviceLabel.setTextAppearance(R.style.Text16Style);
- viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);
- viewBinding.deviceLabelParent.setVisibility(View.GONE);//璁惧鏍囩闅愯棌
+ viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//鐢电珯鏍囩銆愮埗瀹瑰櫒銆戞樉绀�
+ viewBinding.deviceLabelParent.setVisibility(View.GONE);//璁惧鏍囩銆愮埗瀹瑰櫒銆戦殣钘�
loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
}
});
@@ -123,8 +123,8 @@
viewBinding.powerStationLabel.setTextAppearance(R.style.Text16Style);
viewBinding.editIv.setVisibility(View.GONE);//缂栬緫鍥炬爣闅愯棌
viewBinding.addIv.setVisibility(View.GONE);//娣诲姞鍥炬爣闅愯棌
- viewBinding.powerStationLabelParent.setVisibility(View.GONE);//鐢电珯鏍囩闅愯棌
- viewBinding.deviceLabelParent.setVisibility(View.VISIBLE);
+ viewBinding.powerStationLabelParent.setVisibility(View.GONE);//鐢电珯鏍囩銆愮埗瀹瑰櫒銆戦殣钘�
+ viewBinding.deviceLabelParent.setVisibility(View.VISIBLE);//璁惧鏍囩銆愮埗瀹瑰櫒銆戞樉绀�
loadNextPageDeviceList(true, 1, true);
}
});
diff --git a/app/src/main/res/drawable/house_list_line_parent_bg.xml b/app/src/main/res/drawable/house_list_line_parent_bg.xml
index 7a5233d..8e4af38 100644
--- a/app/src/main/res/drawable/house_list_line_parent_bg.xml
+++ b/app/src/main/res/drawable/house_list_line_parent_bg.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/text_FFFFFFFF" />
- <corners android:radius="@dimen/dp_4" />
+ <corners android:radius="@dimen/dp_13" />
</shape>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_message.xml b/app/src/main/res/layout/fragment_message.xml
index 8e346f6..d22ba4f 100644
--- a/app/src/main/res/layout/fragment_message.xml
+++ b/app/src/main/res/layout/fragment_message.xml
@@ -3,134 +3,266 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/message_parent"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/text_F5F7FA">
-
+ android:layout_height="match_parent">
+ <!--澶撮儴鏍囩-->
<RelativeLayout
android:id="@+id/message_rl"
- android:layout_width="0dp"
- android:layout_height="@dimen/dp_52"
- android:background="@color/text_245EC3"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_31"
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_marginTop="@dimen/dp_44"
+ android:layout_marginEnd="@dimen/dp_16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
- <LinearLayout
- android:id="@+id/message_tab_ll"
- android:layout_width="match_parent"
+ <TextView
+ android:id="@+id/message_tab_nascent_title_tv"
+ android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:layout_marginStart="@dimen/dp_17"
- android:layout_marginEnd="@dimen/dp_16"
- android:orientation="horizontal">
- <!--鍙戠敓涓�-->
- <androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/message_tab_nascent_cl"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1">
+ android:layout_centerVertical="true"
+ android:gravity="center_vertical"
+ android:text="@string/message_nascent"
+ android:textColor="@color/text_90000000"
+ android:textSize="@dimen/text_20"
+ android:textStyle="bold" />
- <TextView
- android:id="@+id/message_tab_nascent_title_tv"
- android:layout_width="wrap_content"
- android:layout_height="@dimen/dp_23"
- android:layout_marginTop="@dimen/dp_16"
- android:gravity="center"
- android:text="@string/message_nascent"
- android:textColor="@color/text_FFFFFFFF"
- android:textSize="@dimen/text_16"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ <TextView
+ android:id="@+id/message_tab_recover_title_tv"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_centerVertical="true"
+ android:layout_marginStart="@dimen/dp_21"
+ android:layout_marginEnd="@dimen/dp_4"
+ android:layout_toStartOf="@+id/all_clear_tv"
+ android:layout_toEndOf="@+id/message_tab_nascent_title_tv"
+ android:gravity="start|center_vertical"
+ android:text="@string/alarm_record"
+ android:textColor="@color/text_40000000"
+ android:textSize="@dimen/text_16"
- <View
- android:id="@+id/line1_v"
- android:layout_width="0dp"
- android:layout_height="3dp"
- android:layout_marginTop="@dimen/dp_11"
- android:background="@color/text_FFFFFFFF"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="@+id/message_tab_nascent_title_tv"
- app:layout_constraintStart_toStartOf="@+id/message_tab_nascent_title_tv" />
+ />
+
+ <TextView
+ android:id="@+id/all_clear_tv"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dp_31"
+ android:layout_alignParentEnd="true"
+ android:gravity="center"
+ android:text="@string/all_read"
+ android:textColor="@color/text_38C494"
+ android:textSize="@dimen/dp_16"
+
+ />
- </androidx.constraintlayout.widget.ConstraintLayout>
- <!--宸叉仮澶�-->
- <androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/message_tab_recover_cl"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1">
-
- <TextView
- android:id="@+id/message_tab_recover_title_tv"
- android:layout_width="wrap_content"
- android:layout_height="@dimen/dp_23"
- android:layout_marginTop="@dimen/dp_16"
- android:gravity="center"
- android:text="@string/message_recover"
- android:textColor="@color/text_FFFFFFFF"
- android:textSize="@dimen/text_16"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
- <View
- android:id="@+id/line2_v"
- android:layout_width="0dp"
- android:layout_height="3dp"
- android:layout_marginTop="@dimen/dp_11"
- android:background="@color/text_FFFFFFFF"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="@+id/message_tab_recover_title_tv"
- app:layout_constraintStart_toStartOf="@+id/message_tab_recover_title_tv" />
-
-
- </androidx.constraintlayout.widget.ConstraintLayout>
- <!--鍏ㄩ儴 2023骞�12鏈�29鏃�09:49:59闃垮粬瑕佹眰鍏堥殣钘�-->
- <androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/message_tab_all_cl"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:visibility="gone">
-
- <TextView
- android:id="@+id/message_tab_all_title_tv"
- android:layout_width="wrap_content"
- android:layout_height="@dimen/dp_23"
- android:layout_marginTop="@dimen/dp_16"
- android:gravity="center"
- android:text="@string/message_all"
- android:textColor="@color/text_FFFFFFFF"
- android:textSize="@dimen/text_16"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
- <View
- android:id="@+id/line3_v"
- android:layout_width="0dp"
- android:layout_height="3dp"
- android:layout_marginTop="@dimen/dp_11"
- android:background="@color/text_FFFFFFFF"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="@+id/message_tab_all_title_tv"
- app:layout_constraintStart_toStartOf="@+id/message_tab_all_title_tv" />
-
-
- </androidx.constraintlayout.widget.ConstraintLayout>
- </LinearLayout>
</RelativeLayout>
- <!--Fragment-->
- <androidx.fragment.app.FragmentContainerView
- android:id="@+id/message_fcv"
- android:layout_width="0dp"
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/message_cl"
+ android:layout_width="match_parent"
+ android:layout_height="98dp"
+ android:layout_marginTop="@dimen/dp_21"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/message_rl">
+ <!--鎼滅储-->
+ <RelativeLayout
+ android:id="@+id/message_search_cl"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_35"
+ android:layout_marginStart="@dimen/dp_13"
+ android:layout_marginEnd="@dimen/dp_16"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <RelativeLayout
+ android:id="@+id/message_search_click_cl"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_alignParentEnd="true"
+ android:layout_marginEnd="@dimen/dp_17"
+ android:background="@drawable/search_bj_ff05000000">
+
+ <ImageView
+ android:id="@+id/power_station_search_iv"
+ android:layout_width="@dimen/dp_18"
+ android:layout_height="@dimen/dp_18"
+ android:layout_alignParentStart="true"
+ android:layout_centerVertical="true"
+ android:layout_marginStart="@dimen/dp_13"
+ android:src="@drawable/search_path" />
+
+ <TextView
+ android:id="@+id/power_station_search_tv"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dp_17"
+ android:layout_centerVertical="true"
+ android:layout_marginStart="@dimen/dp_11"
+ android:layout_toEndOf="@+id/power_station_search_iv"
+ android:text="Search the message"
+ android:textColor="@color/text_40000000"
+ android:textSize="@dimen/text_14" />
+ </RelativeLayout>
+
+
+ </RelativeLayout>
+ <!--鏉′欢绛涢��-->
+ <RelativeLayout
+ android:id="@+id/message_condition_screening_rl"
+ android:layout_width="0dp"
+ android:layout_height="@dimen/dp_62"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/message_search_cl">
+
+ <LinearLayout
+ android:id="@+id/message_tab_ll"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_marginEnd="@dimen/dp_16"
+ android:orientation="horizontal">
+ <!--鍏ㄩ儴璁惧-->
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/message_tab_all_device_cl"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/all_device_title_tv"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dp_20"
+ android:text="@string/alarm_all_device"
+ android:textColor="@color/text_90000000"
+ android:textSize="@dimen/text_14" />
+
+ <View
+ android:layout_width="@dimen/dp_7"
+ android:layout_height="match_parent" />
+
+ <ImageView
+ android:id="@+id/all_device_title_iv"
+ android:layout_width="@dimen/dp_10"
+ android:layout_height="@dimen/dp_10"
+ android:layout_marginStart="@dimen/dp_7"
+ android:background="@drawable/up" />
+
+ </LinearLayout>
+
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+ <!--鍏ㄩ儴绛夌骇-->
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/message_tab_all_grade_cl"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/all_grade_title_tv"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dp_20"
+ android:text="@string/alarm_all_grade"
+ android:textColor="@color/text_90000000"
+ android:textSize="@dimen/text_14" />
+
+ <View
+ android:layout_width="7dp"
+ android:layout_height="match_parent" />
+
+ <ImageView
+ android:id="@+id/all_grade_title_iv"
+ android:layout_width="@dimen/dp_10"
+ android:layout_height="@dimen/dp_10"
+ android:layout_marginStart="@dimen/dp_7"
+ android:background="@drawable/up" />
+ </LinearLayout>
+
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+ <!--鍏ㄩ儴鏃堕棿-->
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/message_tab_all_time_cl"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical|end"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/all_time_title_tv"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dp_20"
+ android:layout_marginEnd="@dimen/dp_7"
+ android:text="@string/alarm_all_time"
+ android:textColor="@color/text_90000000"
+ android:textSize="@dimen/text_14" />
+
+ <View
+ android:layout_width="@dimen/dp_7"
+ android:layout_height="match_parent" />
+
+ <ImageView
+ android:id="@+id/all_time_title_iv"
+ android:layout_width="@dimen/dp_10"
+ android:layout_height="@dimen/dp_10"
+ android:background="@drawable/up" />
+ </LinearLayout>
+
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+ </LinearLayout>
+ </RelativeLayout>
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+
+ <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
+ android:id="@+id/message_srl"
+ android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/message_rl" />
+ app:layout_constraintTop_toBottomOf="@+id/message_cl">
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/message_rcv"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clipToPadding="false"
+ android:paddingBottom="@dimen/dp_16" />
+ </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+
+ <!--娌℃湁鏁版嵁鏄剧ず鏍峰紡-->
+ <include
+ android:id="@+id/null_data_ic"
+ layout="@layout/null_data_view"
+ android:layout_width="match_parent"
+ android:layout_height="224dp"
+ android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/message_cl" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_message.xml b/app/src/main/res/layout/item_message.xml
index da1f0a5..bf087ba 100644
--- a/app/src/main/res/layout/item_message.xml
+++ b/app/src/main/res/layout/item_message.xml
@@ -2,8 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
- android:layout_height="@dimen/dp_150"
- android:background="@color/text_F5F7FA">
+ android:layout_height="@dimen/dp_115">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@@ -26,14 +25,15 @@
android:id="@+id/item_content_tv"
android:layout_width="0dp"
android:layout_height="@dimen/dp_23"
- android:layout_marginStart="20dp"
- android:layout_marginTop="16dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginTop="19dp"
android:layout_marginEnd="@dimen/dp_5"
+ android:ellipsize="end"
android:gravity="center_vertical"
+ android:singleLine="true"
+ android:textStyle="bold"
android:textColor="@color/text_90000000"
android:textSize="@dimen/text_16"
- android:ellipsize="end"
- android:singleLine="true"
app:layout_constraintEnd_toStartOf="@+id/item_estate_tv"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -42,7 +42,7 @@
android:id="@+id/item_home_name_tv"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_17"
- android:layout_marginTop="@dimen/dp_24"
+ android:layout_marginTop="@dimen/dp_6"
android:textColor="@color/text_40000000"
android:textSize="@dimen/text_12"
app:layout_constraintStart_toStartOf="@+id/item_content_tv"
@@ -52,7 +52,7 @@
android:id="@+id/item_time_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/dp_14"
+ android:layout_marginTop="@dimen/dp_6"
android:gravity="center_vertical"
android:textColor="@color/text_40000000"
android:textSize="@dimen/text_12"
diff --git a/app/src/main/res/layout/item_type_title.xml b/app/src/main/res/layout/item_type_title.xml
index 8e61c18..c767cf7 100644
--- a/app/src/main/res/layout/item_type_title.xml
+++ b/app/src/main/res/layout/item_type_title.xml
@@ -19,6 +19,7 @@
android:id="@+id/type_title_tv"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_20"
+ android:gravity="center"
android:textColor="@color/text_90000000"
android:textSize="@dimen/text_14"
app:layout_constraintBottom_toBottomOf="parent"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 02a7e84..30b880f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,5 +1,4 @@
<resources>
- <!-- <string name="app_name">PhotovoltaicDebug</string>-->
<string name="app_name">鏅烘収鑳芥簮</string>
<string name="title_activity_home_login">HomeLoginActivity</string>
<!-- Strings used for fragments for navigation -->
@@ -10,6 +9,7 @@
<string name="hello_first_fragment">Hello first fragment</string>
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
+
<!--鐧诲綍妯″潡-->
<string name="home_login_chinese">绠�浣撲腑鏂�</string>
@@ -287,6 +287,5 @@
<string name="grid_connected">骞剁綉</string>
<string name="off_network">绂荤綉</string>
<string name="the_input_value_has_been_exceeded">杈撳叆鍊煎凡缁忚秴杩�</string>
-
-
+ <string name="all_read">涓�閿竻闄�</string>
</resources>
\ No newline at end of file
--
Gitblit v1.8.0