From 46f45f42abf00acf70e8160e73faa71aec3df13d Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 01 七月 2024 13:46:30 +0800
Subject: [PATCH] 2024年07月01日13:46:18
---
app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java | 71 ++++++++++++++++++++++-------------
1 files changed, 44 insertions(+), 27 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java
index ec4bed3..f99edb8 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java
@@ -15,6 +15,7 @@
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.hdl.photovoltaic.R;
+import com.hdl.photovoltaic.enums.PowerStationStatus;
import com.hdl.photovoltaic.enums.UnitType;
import com.hdl.photovoltaic.other.HdlCommonLogic;
import com.hdl.photovoltaic.other.HdlDeviceLogic;
@@ -32,6 +33,8 @@
private List<HouseIdBean> mList;
private final Context mContext;
private OnclickListener noOnclickListener;//鐐瑰嚮浜嗙殑鐩戝惉鍣�
+
+ String mPowerStationStatus;
/**
* 鏀堕泦SwipeLayout鏁扮粍,瑕佷竴閿叏閮ㄦ墦寮�;
@@ -57,7 +60,7 @@
HouseIdBean houseIdBean = this.mList.get(position);
holder.homeNameTv.setText(houseIdBean.getHomeName().trim());
//瑁呮満瀹归噺
- String capacity = mContext.getString(R.string.my_power_station_installed_capacity) + ":" + HdlCommonLogic.getConvertDoubleUnit(houseIdBean.getInstalledCapacity(), UnitType.kWp);
+ String capacity = mContext.getString(R.string.string_capacity) + ":" + HdlCommonLogic.getConvertDoubleUnit(houseIdBean.getInstalledCapacity(), UnitType.kWp);
holder.capacityTv.setText(capacity);
//鍙戠數鍔熺巼
holder.power_value_tv.setText(HdlCommonLogic.getConvertDoubleUnit(houseIdBean.getPower(), UnitType.kW));
@@ -114,7 +117,8 @@
}
- public void setList(List<HouseIdBean> newData) {
+ public void setList(List<HouseIdBean> newData, String powerStationStatus) {
+ mPowerStationStatus = powerStationStatus;
if (this.mList == null) {
this.mList = new ArrayList<>();
} else {
@@ -148,35 +152,48 @@
* @param state_value 鐢电珯鐘舵��(1:姝e父(杩愯),2:绂荤嚎,3:杩炴帴涓�,4:鏁呴殰,5:绂荤嚎鏈夋晠闅�)
*/
private void setTextViewStyle(TextView textView, int state_value) {
+
String text = mContext.getString(R.string.my_power_station_operation);
Drawable drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_06b92a);
- switch (state_value) {
- case 1: {
- text = mContext.getString(R.string.my_power_station_operation);
+ if (mPowerStationStatus.equals(PowerStationStatus.All)) {
+ switch (state_value) {
+ case 1: {
+ text = mContext.getString(R.string.my_power_station_operation);
+ }
+ break;
+ case 2: {
+ text = mContext.getString(R.string.my_power_station_off_line);
+ drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_b9b9b9);
+ }
+ break;
+ case 3: {
+ text = mContext.getString(R.string.my_power_station_connecting);
+ drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300);
+ }
+ break;
+ case 4:
+ case 5: {
+ text = mContext.getString(R.string.my_power_station_malfunction);
+ drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_e34343);
+ }
+ //5:绂荤嚎鏈夋晠闅淥ffline_fault
+ break;
+// case 5: {
+// text = mContext.getString(R.string.Offline_fault);
+// drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_e34343);
+// }
+// break;
}
- break;
- case 2: {
- text = mContext.getString(R.string.my_power_station_off_line);
- drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_b9b9b9);
- }
- break;
- case 3: {
- text = mContext.getString(R.string.my_power_station_connecting);
- drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300);
- }
- break;
- case 4: {
- text = mContext.getString(R.string.my_power_station_malfunction);
- drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_e34343);
- }
- //5:绂荤嚎鏈夋晠闅淥ffline_fault
- break;
- case 5: {
- text = mContext.getString(R.string.Offline_fault);
- drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_e34343);
- }
- break;
+ } else if (mPowerStationStatus.equals(PowerStationStatus.malfunction)) {
+ text = mContext.getString(R.string.my_power_station_malfunction);
+ drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_e34343);
+ } else if (mPowerStationStatus.equals(PowerStationStatus.off)) {
+ text = mContext.getString(R.string.my_power_station_off_line);
+ drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_b9b9b9);
+ } else if (mPowerStationStatus.equals(PowerStationStatus.connecting)) {
+ text = mContext.getString(R.string.my_power_station_connecting);
+ drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300);
}
textView.setText(text);
textView.setBackground(drawable);
--
Gitblit v1.8.0