From d0dc2a8ce665ddcc5436270550602a1b672d248f Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期六, 11 五月 2024 11:03:35 +0800
Subject: [PATCH] 2024年05月11日11:03:33
---
app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java | 172 +++++++++++++-----------
app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java | 23 +-
app/src/main/res/layout/item_search_house.xml | 6
app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchDeviceAdapter.java | 2
app/src/main/res/drawable/bj_13fffffff.xml | 6
app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchHouseAdapter.java | 2
app/src/main/res/layout/item_search_message.xml | 76 ++++++++++
app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java | 17 ++
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java | 6
app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchMessageAdapter.java | 67 +++++---
app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java | 1
11 files changed, 250 insertions(+), 128 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 76837f2..25163ba 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
@@ -499,6 +499,7 @@
}
+
/**
* 鑾峰彇鎸囧畾椤电殑鑾峰彇娑堟伅鍒楄〃
*
@@ -509,9 +510,20 @@
* @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 search_title 鎶ヨ鍚嶇О
* @param 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) {
+ 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,
+ String search_title, CloudCallBeak<MessageListClass> cloudCallBeak) {
String requestUrl = HttpApi.POST_Message_List;
JsonObject json = new JsonObject();
if (!TextUtils.isEmpty(homeId)) {
@@ -529,6 +541,9 @@
if (!TextUtils.isEmpty(timeType_filter_key) && !TextUtils.isEmpty(timeType_filter_value)) {
json.addProperty(timeType_filter_key, timeType_filter_value);
}
+ if (!TextUtils.isEmpty(search_title)) {
+ json.addProperty("title", search_title);
+ }
json.addProperty("pageNo", pageNo);//椤电爜
json.addProperty("pageSize", pageSize);//椤垫暟
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchDeviceAdapter.java b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchDeviceAdapter.java
index 3c3e62c..1eda829 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchDeviceAdapter.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchDeviceAdapter.java
@@ -92,7 +92,7 @@
public MyViewHolder(@NonNull View itemView) {
super(itemView);
- power_station_name_tv = itemView.findViewById(R.id.power_station_name_tv);
+ power_station_name_tv = itemView.findViewById(R.id.message_name_tv);
power_station_location_tv = itemView.findViewById(R.id.power_station_location_tv);
}
}
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchHouseAdapter.java b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchHouseAdapter.java
index bc858f1..3a0c369 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchHouseAdapter.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchHouseAdapter.java
@@ -95,7 +95,7 @@
public MyViewHolder(@NonNull View itemView) {
super(itemView);
- power_station_name_tv = itemView.findViewById(R.id.power_station_name_tv);
+ power_station_name_tv = itemView.findViewById(R.id.message_name_tv);
power_station_location_tv = itemView.findViewById(R.id.power_station_location_tv);
}
}
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchMessageAdapter.java b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchMessageAdapter.java
index da3d0b1..031a437 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchMessageAdapter.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchMessageAdapter.java
@@ -1,6 +1,7 @@
package com.hdl.photovoltaic.ui.adapter;
import android.content.Context;
+import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -9,10 +10,14 @@
import android.widget.TextView;
import androidx.annotation.NonNull;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.recyclerview.widget.RecyclerView;
import com.hdl.photovoltaic.R;
+import com.hdl.photovoltaic.enums.MessageAlarmStateType;
import com.hdl.photovoltaic.ui.bean.DeviceBean;
+import com.hdl.photovoltaic.ui.bean.MessageBean;
+import com.hdl.photovoltaic.utils.TimeUtils;
import com.hdl.photovoltaic.widget.SwipeLayout;
import java.util.ArrayList;
@@ -23,7 +28,7 @@
*/
public class SearchMessageAdapter extends RecyclerView.Adapter<SearchMessageAdapter.MyViewHolder> {
- List<DeviceBean> mList;
+ List<MessageBean> mList;
Context mContext;
@@ -37,20 +42,38 @@
@NonNull
@Override
public SearchMessageAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View contentItem = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_device_details, parent, false);
+ View contentItem = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_search_message, parent, false);
return new SearchMessageAdapter.MyViewHolder(contentItem);
}
@Override
- public void onBindViewHolder(@NonNull SearchMessageAdapter.MyViewHolder holder, int position) {
- DeviceBean deviceBean = this.mList.get(position);
- holder.itemView.setTag(position);
- holder.itemView.setOnClickListener(new View.OnClickListener() {
+ public void onBindViewHolder(@NonNull SearchMessageAdapter.MyViewHolder itemHolder, int position) {
+ MessageBean messageBean = this.mList.get(position);
+ itemHolder.message_name_tv.setText(messageBean.getTitle());
+ itemHolder.message_content_tv.setText(messageBean.getHomeName());
+ String date = TimeUtils.getTimeFromTimestamp(messageBean.getCreateTime());
+ itemHolder.message_time_tv.setText(date);
+ 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);
+ drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_e34343);
+ } else if (messageBean.getType().equals(MessageAlarmStateType.warn)) {
+ 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.loading_title_tip);
+ drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_b9b9b9);
+ }
+ itemHolder.message_state_tv.setText(type);
+ itemHolder.message_state_tv.setBackground(drawable);
+ itemHolder.itemView.setTag(position);
+ itemHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
if (mOnclickListener != null) {
- mOnclickListener.onClick((int) holder.itemView.getTag(), deviceBean);
+ mOnclickListener.onClick((int) itemHolder.itemView.getTag(), messageBean);
}
} catch (Exception ignored) {
}
@@ -68,7 +91,7 @@
this.mOnclickListener = onClickListener;
}
- public void setList(List<DeviceBean> newData) {
+ public void setList(List<MessageBean> newData) {
if (this.mList == null) {
this.mList = new ArrayList<>();
} else {
@@ -83,33 +106,23 @@
* 涓�琛屽竷灞�瀹瑰櫒
*/
static class MyViewHolder extends RecyclerView.ViewHolder {
+ public TextView message_name_tv;
- public ImageView homeIconIv;//浣忓畢鍥剧墖
- public TextView homeNameTv;//浣忓畢鍚嶇О
- public TextView capacityTv;//瑁呮満瀹归噺
- public TextView powerTv;//鍙戠數鍔熺巼
- public TextView stateTv;//鐢电珯鐘舵��(杩炴帴涓�,杩愯,绂荤嚎,鏁呴殰);
- public RelativeLayout item_parent_rl;//鏉$洰鐖跺鍣�
- public ImageView move_home_iv;//绉诲姩鐢电珯浣嶇疆
- public ImageView del_home_iv;//鍒犻櫎鐢电珯
- public SwipeLayout item_parent_swipeLayout;//鐖跺鍣�
+ public TextView message_content_tv;
+ public TextView message_time_tv;
+ public TextView message_state_tv;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
- homeIconIv = itemView.findViewById(R.id.device_details_image_iv);
- homeNameTv = itemView.findViewById(R.id.device_details_name_tv);
- capacityTv = itemView.findViewById(R.id.device_details_sn_tv);
- powerTv = itemView.findViewById(R.id.power_type_tv);
- stateTv = itemView.findViewById(R.id.fragment_house_list_line_state_tv);
- item_parent_rl = itemView.findViewById(R.id.item_parent_rl);
- move_home_iv = itemView.findViewById(R.id.move_home_iv);
- del_home_iv = itemView.findViewById(R.id.del_home_iv);
- item_parent_swipeLayout = itemView.findViewById(R.id.item_parent_swipeLayout);
+ message_name_tv = itemView.findViewById(R.id.message_name_tv);
+ message_content_tv = itemView.findViewById(R.id.message_content_tv);
+ message_time_tv = itemView.findViewById(R.id.message_time_tv);
+ message_state_tv = itemView.findViewById(R.id.message_state_tv);
}
}
public interface OnClickListener {
- void onClick(int position, DeviceBean deviceBean);
+ void onClick(int position, MessageBean messageBean);
}
}
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 7d4221d..a9457f6 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
@@ -96,7 +96,7 @@
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);
+ loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
}
});
//鎶ヨ璁板綍
@@ -110,7 +110,7 @@
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);
+ loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
}
});
//鎼滅储娑堟伅
@@ -132,7 +132,7 @@
@Override
public void onSuccess(Boolean obj) {
hideLoading();
- loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
+ loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
}
@Override
@@ -161,7 +161,7 @@
viewBinding.allDeviceTitleTv.setText(title);
mDeviceTypeFilterKye = FilterType.deviceType;
mDeviceTypeFilterValue = findFilterValueString(title);
- loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
+ loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
}
});
@@ -185,7 +185,7 @@
viewBinding.allGradeTitleTv.setText(title);
mTypeFilterKye = FilterType.type;
mTypeFilterValue = findFilterValueString(title);
- loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
+ loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
}
});
}
@@ -206,7 +206,7 @@
viewBinding.allTimeTitleTv.setText(title);
mTimeTypeFilterKye = FilterType.timeType;
mTimeTypeFilterValue = findFilterValueString(title);
- loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
+ loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
}
});
}
@@ -218,7 +218,7 @@
@Override
public void onRefresh() {
viewBinding.messageSrl.setRefreshing(false);
- loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
+ loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true);
}
});
//涓婃媺鎸夐挳
@@ -238,7 +238,7 @@
if (!isLoadingMore) {
// 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔
HdlLogLogic.print("--->婊戝姩鍒颁簡搴曢儴");
- loadNextPageMessageList(++mCurrentPage, false, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, false);
+ loadNextPageMessageList(false, ++mCurrentPage, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, false);
}
}
}
@@ -274,7 +274,7 @@
private void initData() {
//杩涙潵璇诲彇涓�娆℃暟鎹�(涓轰簡鏇存柊currentPage锛宑urrentTotal杩欎釜鍊�),app鍚姩鏃跺�欒鍙栵紝涓轰簡鍒锋柊娑堟伅妯″潡鐨勮鏍�
- loadNextPageMessageList(1, true, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, true);
+ loadNextPageMessageList(true, 1, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, true);
}
@@ -315,8 +315,9 @@
* @param isClear true琛ㄧず娓呯┖缂撳瓨
*/
private void loadNextPageMessageList(
- int pageNo,
+
boolean isShowLoading,
+ int pageNo,
String deviceType_filter_key,
String deviceType_filter_value,
String type_filter_key,
@@ -344,7 +345,7 @@
} 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>() {
+ 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) {
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java
index aecfe33..62986e6 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/message/SearchMessageActivity.java
@@ -1,6 +1,7 @@
package com.hdl.photovoltaic.ui.message;
+import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
@@ -19,15 +20,18 @@
import com.hdl.photovoltaic.base.CustomBaseActivity;
import com.hdl.photovoltaic.bean.PageNumberObject;
import com.hdl.photovoltaic.databinding.ActivitySearchMessgeBinding;
+import com.hdl.photovoltaic.enums.MessageStateType;
import com.hdl.photovoltaic.enums.ShowErrorMode;
import com.hdl.photovoltaic.listener.CloudCallBeak;
import com.hdl.photovoltaic.other.HdlDeviceLogic;
import com.hdl.photovoltaic.other.HdlFileLogic;
import com.hdl.photovoltaic.other.HdlLogLogic;
+import com.hdl.photovoltaic.other.HdlMessageLogic;
import com.hdl.photovoltaic.other.HdlThreadLogic;
import com.hdl.photovoltaic.ui.adapter.SearchHistoryAdapter;
import com.hdl.photovoltaic.ui.adapter.SearchMessageAdapter;
import com.hdl.photovoltaic.ui.bean.DeviceBean;
+import com.hdl.photovoltaic.ui.bean.MessageBean;
import java.util.ArrayList;
import java.util.Collections;
@@ -43,11 +47,10 @@
SearchMessageAdapter searchMessageAdapter;//璁惧閫傞厤鍣�
SearchHistoryAdapter searchHistoryAdapter;//鍘嗗彶璁板綍閫傞厤鍣�
- private List<DeviceBean> deviceList = new ArrayList<>();
-
- private int currentHouseListPage = 0; // 褰撳墠鐢电珯鍒楄〃椤电爜
- private int currentHouseListTotal = 0; // 鐢电珯鍒楄〃鎬婚〉鐮�
- private boolean isHouseLoadingMore = false; // 鏍囪鐢电珯鍒楄〃姝e湪鍔犺浇鏇村鏁版嵁
+ private final List<MessageBean> mList = new ArrayList<>();
+ private int mCurrentPage = 0; // 褰撳墠椤电爜
+ private int mCurrentTotal = 0; // 鎬婚〉鐮�
+ private boolean isLoadingMore = false; // 鏍囪姝e湪鍔犺浇鏇村鏁版嵁
private String currSearchText;
@@ -95,8 +98,6 @@
}
});
viewBinding.messageSearchEt.addTextChangedListener(textWatcher);
-
-
//鎼滅储
viewBinding.powerStationSearchTv.setOnClickListener(new View.OnClickListener() {
@Override
@@ -110,7 +111,7 @@
viewBinding.historyListParent.setVisibility(View.GONE);
viewBinding.listParent.setVisibility(View.VISIBLE);
addSearchTextToList();
- loadNextPageHouseList(true, 1, true);
+ loadNextPageMessageList(true, 1, viewBinding.messageSearchEt.getText().toString(), true);
}
});
@@ -122,7 +123,7 @@
@Override
public void onRefresh() {
viewBinding.listSrl.setRefreshing(false);
- loadNextPageHouseList(true, 1, true);
+ loadNextPageMessageList(true, 1, viewBinding.messageSearchEt.getText().toString(), true);
}
});
//涓婃媺璇诲彇
@@ -137,10 +138,10 @@
int totalItemCount = layoutManager.getItemCount();
int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition();
if (visibleItemCount > 0 && visibleItemCount + firstVisibleItemPosition == totalItemCount) {
- if (!isHouseLoadingMore) {
+ if (!isLoadingMore) {
// 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔
HdlLogLogic.print("--->婊戝姩鍒颁簡搴曢儴");
- loadNextPageHouseList(false, ++currentHouseListPage, false);
+ loadNextPageMessageList(false, ++mCurrentPage, viewBinding.messageSearchEt.getText().toString(), false);
}
}
}
@@ -154,7 +155,7 @@
viewBinding.historyListParent.setVisibility(View.VISIBLE);
viewBinding.listParent.setVisibility(View.GONE);
searchHistoryAdapter.setList(searchHistoryTitleList);
- clearData();
+ clearCacheData();
}
});
//鍒犻櫎
@@ -173,11 +174,14 @@
viewBinding.messageSearchEt.setText(title);
}
});
- //鐢电珯鐐瑰嚮鏄簨浠�
+ //娑堟伅鐐瑰嚮鏄簨浠�
searchMessageAdapter.setOnclickListener(new SearchMessageAdapter.OnClickListener() {
@Override
- public void onClick(int position, DeviceBean deviceBean) {
-
+ public void onClick(int position, MessageBean messageBean) {
+ Intent intent = new Intent();
+ intent.putExtra("msgId", messageBean.getMsgId().toString());
+ intent.setClass(_mActivity, MessageInfoActivity.class);
+ startActivity(intent);
}
});
@@ -192,7 +196,7 @@
viewBinding.historyListRcv.setLayoutManager(new LinearLayoutManager(_mActivity));
viewBinding.historyListRcv.setAdapter(searchHistoryAdapter);
searchHistoryAdapter.setList(searchHistoryTitleList);
- //鍒濆鍖栫數绔欓�傞厤鍣�
+ //鍒濆鍖栨秷鎭�傞厤鍣�
searchMessageAdapter = new SearchMessageAdapter(_mActivity);
viewBinding.listRcv.setLayoutManager(new LinearLayoutManager(_mActivity));
viewBinding.listRcv.setAdapter(searchMessageAdapter);
@@ -226,6 +230,20 @@
};
/**
+ * 鍒锋柊鍒楄〃鏁版嵁
+ */
+ private void updateListData() {
+ HdlThreadLogic.runMainThread(new Runnable() {
+ @Override
+ public void run() {
+ if (searchMessageAdapter != null) {
+ searchMessageAdapter.setList(mList);
+ }
+ }
+ });
+ }
+
+ /**
* 鐗╃悊鎸夐敭杩斿洖浜嬩欢
*/
@Override
@@ -243,90 +261,84 @@
super.onDestroy();
}
+
/**
- * 鍒锋柊UI锛堣澶囷級
+ * 鍔犺浇涓�椤垫暟鎹�
*
- * @param isRefreshing 琛ㄧず鏄笅鎷夊埛鏂扮殑
+ * @param isShowLoading 鏄惁鍚姩鍔犺浇妗� true鍚姩
+ * @param pageNo 椤垫暟
+ * @param search_title 鎼滅储鏂囨湰
+ * @param isClear true琛ㄧず娓呯┖缂撳瓨
*/
- private void loadNextPageHouseList(boolean isRefreshing, long pageNo, boolean isClear) {
-
- //鎼滅储鍏抽敭瀛�
- if (TextUtils.isEmpty(currSearchText)) {
- return;
- }
-
+ private void loadNextPageMessageList(boolean isShowLoading, int pageNo, String search_title, boolean isClear) {
if (isClear) {
- clearData();
+ //琛ㄧず浠庣涓�椤靛彲浠ヨ鍙栵紝榛樿娓呯┖鎵�鏈夌紦瀛樻暟鎹�;
+ clearCacheData();
}
- //绗竴椤佃鍙栨暟鎹己鍒惰鍙�
- if (pageNo > 1 && currentHouseListPage > currentHouseListTotal) {
- --currentHouseListPage;
+ //绗竴椤佃鍙栨暟鎹己鍒惰
+ if (pageNo > 1 && mCurrentPage > mCurrentTotal) {
+ --mCurrentPage;
//褰撳墠椤典笉鑳藉ぇ浜庢�婚〉鏁�
return;
}
- isHouseLoadingMore = true;//鏍囪璇诲彇鐘舵��
- if (isRefreshing) {
+ isLoadingMore = true;//鏍囪璇诲彇鐘舵��
+ if (isShowLoading) {
showLoading();
}
-
- //鑾峰彇浜戠涓婅澶囧垪琛�
- HdlDeviceLogic.getInstance().getPowerStationDeviceList(currSearchText, pageNo, 20, new CloudCallBeak<PageNumberObject<DeviceBean>>() {
- @Override
- public void onSuccess(PageNumberObject<DeviceBean> deviceClass) {
- HdlThreadLogic.runMainThread(new Runnable() {
+ HdlMessageLogic.getInstance().getPageNoMessageList(
+ "",
+ pageNo,
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ search_title,
+ new CloudCallBeak<HdlMessageLogic.MessageListClass>() {
@Override
- public void run() {
- if (isRefreshing) {
+ public void onSuccess(HdlMessageLogic.MessageListClass messageListClass) {
+ if (messageListClass != null) {
+ mCurrentTotal = (int) messageListClass.getTotalPage();
+ mCurrentPage = (int) messageListClass.getPageNo();
+ setMessageList(messageListClass.getList());
+ updateListData();
+ }
+ isLoadingMore = false;
+ if (isShowLoading) {
hideLoading();
}
- isHouseLoadingMore = false;
- if (deviceClass != null) {
- currentHouseListTotal = (int) deviceClass.getTotalPage();
- currentHouseListPage = (int) deviceClass.getPageNo();
- //鏇存柊缂撳瓨
- setDeviceList(deviceClass.getList());
- if (searchMessageAdapter != null) {
- initData();
- //鏇存柊UI
- searchMessageAdapter.setList(deviceList);
- }
- }
}
- }, _mActivity, ShowErrorMode.YES);
- }
-
- @Override
- public void onFailure(HDLException e) {
- HdlThreadLogic.runMainThread(new Runnable() {
@Override
- public void run() {
- if (currentHouseListPage > 1) {
- --currentHouseListPage;
+ public void onFailure(HDLException e) {
+ if (mCurrentPage > 1) {
+ --mCurrentPage;
}
- isHouseLoadingMore = false;
- if (isRefreshing) {
+ isLoadingMore = false;
+ if (isShowLoading) {
hideLoading();
}
-
}
- }, _mActivity, ShowErrorMode.YES);
- }
- });
+ });
+
+
}
- private void clearData() {
- if (deviceList != null && deviceList.size() > 0) {
- deviceList.clear();
+
+ private void clearCacheData() {
+ if (mList != null && mList.size() > 0) {
+ mList.clear();
}
}
- public void setDeviceList(List<DeviceBean> list) {
+ public void setMessageList(List<MessageBean> list) {
if (list == null || list.size() == 0) {
return;
}
- if (this.deviceList.size() == 0) {
- this.deviceList.addAll(list);
+ if (this.mList.size() == 0) {
+ this.mList.addAll(list);
return;
}
for (int i = 0; i < list.size(); i++) {
@@ -337,26 +349,26 @@
/**
* 娣诲姞璁惧鍒板垪琛ㄩ噷闈�
*
- * @param deviceBean -璁惧瀵硅薄
+ * @param messageBean -璁惧瀵硅薄
*/
- public void setSingleDevice(DeviceBean deviceBean) {
+ public void setSingleDevice(MessageBean messageBean) {
try {
- if (deviceBean == null) {
+ if (messageBean == null) {
return;
}
boolean if_boolean = false;
- for (int i = 0; i < deviceList.size(); i++) {
- if (deviceList.get(i).getHomeId().equals(deviceBean.getHomeId())) {
+ for (int i = 0; i < mList.size(); i++) {
+ if (mList.get(i).getHomeId().equals(messageBean.getHomeId())) {
//瀛樺湪鏇挎崲
- deviceList.remove(i);
- deviceList.add(i, deviceBean);
+ mList.remove(i);
+ mList.add(i, messageBean);
if_boolean = true;
break;
}
}
if (!if_boolean) {
//娌℃湁娣诲姞
- this.deviceList.add(deviceBean);
+ this.mList.add(messageBean);
}
} catch (Exception e) {
String mes = e.getMessage();
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 d04d85f..1d5e8b3 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
@@ -340,6 +340,7 @@
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) {
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 64e341f..c88b871 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
@@ -734,9 +734,8 @@
@Override
public void onSuccess(Boolean obj) {
hideLoading();
- //鍙戣捣鍒濆鍖栨寚浠ょ粰閫嗗彉鍣�;
- initializeInverter(list);
- HdlResidenceLogic.getInstance().delHouseId(homeId);
+ initializeInverter(list); //鍙戣捣鍒濆鍖栨寚浠ょ粰閫嗗彉鍣�;锛堟敞鎰�:鍙兘鏄湰鍦板彂閫佷簡(瑕佹悳绱㈠眬鍩熺綉閫嗗彉鍣ㄥ垪琛紝寤虹珛鏈湴閫氳閫氶亾),鍒犻櫎鐢电珯鎴愬姛鍚�,浜戠瑙g粦閫嗗彉鍣ㄧ殑鍏崇郴锛�
+ HdlResidenceLogic.getInstance().delHouseId(homeId);//鍒犻櫎鐢电珯缂撳瓨
initData();//鍒濆鍖栫紦瀛樻暟鎹�
houseInfoAdapter.setList(houseListBeanIDList);//閲嶆柊鍒锋柊鍒楄〃
nullDataUpdateUi();//妫�娴嬫暟鎹槸鍚︿负绌�
@@ -745,7 +744,6 @@
@Override
public void onFailure(HDLException e) {
hideLoading();
-
HdlThreadLogic.toast(_mActivity, e);
}
});
diff --git a/app/src/main/res/drawable/bj_13fffffff.xml b/app/src/main/res/drawable/bj_13fffffff.xml
new file mode 100644
index 0000000..7b0d815
--- /dev/null
+++ b/app/src/main/res/drawable/bj_13fffffff.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <corners android:radius="@dimen/dp_13" />
+ <solid android:color="@color/text_FFFFFFFF" />
+
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_search_house.xml b/app/src/main/res/layout/item_search_house.xml
index 327170e..0b1b47b 100644
--- a/app/src/main/res/layout/item_search_house.xml
+++ b/app/src/main/res/layout/item_search_house.xml
@@ -14,7 +14,7 @@
app:layout_constraintTop_toTopOf="parent" />
<TextView
- android:id="@+id/power_station_name_tv"
+ android:id="@+id/message_name_tv"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_23"
android:layout_marginStart="@dimen/dp_23"
@@ -32,8 +32,8 @@
android:layout_marginTop="@dimen/dp_7"
android:textColor="@color/text_40000000"
android:textSize="@dimen/text_12"
- app:layout_constraintStart_toStartOf="@+id/power_station_name_tv"
- app:layout_constraintTop_toBottomOf="@+id/power_station_name_tv" />
+ app:layout_constraintStart_toStartOf="@+id/message_name_tv"
+ app:layout_constraintTop_toBottomOf="@+id/message_name_tv" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_search_message.xml b/app/src/main/res/layout/item_search_message.xml
new file mode 100644
index 0000000..3a55505
--- /dev/null
+++ b/app/src/main/res/layout/item_search_message.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<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_127">
+
+ <ImageView
+ android:id="@+id/message_search_iv"
+ android:layout_width="@dimen/dp_18"
+ android:layout_height="@dimen/dp_18"
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_marginTop="@dimen/dp_28"
+ android:src="@drawable/search_path"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginStart="@dimen/dp_57"
+ android:layout_marginTop="@dimen/dp_28"
+ android:layout_marginEnd="@dimen/dp_21"
+ android:background="@drawable/bj_13fffffff"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <TextView
+ android:id="@+id/message_name_tv"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dp_23"
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_marginTop="@dimen/dp_19"
+ android:ellipsize="end"
+ android:singleLine="true"
+ android:textColor="@color/text_90000000"
+ android:textSize="@dimen/text_16"
+ android:textStyle="bold"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/message_content_tv"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dp_17"
+ android:layout_marginTop="@dimen/dp_6"
+ android:textColor="@color/text_40000000"
+ android:textSize="@dimen/text_12"
+ app:layout_constraintStart_toStartOf="@+id/message_name_tv"
+ app:layout_constraintTop_toBottomOf="@+id/message_name_tv" />
+
+ <TextView
+ android:id="@+id/message_time_tv"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dp_17"
+ android:layout_marginTop="@dimen/dp_6"
+ android:textColor="@color/text_40000000"
+ android:textSize="@dimen/text_12"
+ app:layout_constraintStart_toStartOf="@+id/message_content_tv"
+ app:layout_constraintTop_toBottomOf="@+id/message_content_tv" />
+
+ <TextView
+ android:id="@+id/message_state_tv"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/dp_33"
+ android:background="@drawable/state_ffb300"
+ android:gravity="center"
+ android:paddingStart="@dimen/dp_12"
+ android:paddingEnd="@dimen/dp_12"
+ android:textColor="@color/text_FFFFFFFF"
+ android:textSize="@dimen/text_12"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
--
Gitblit v1.8.0