From 9d50ebeec9b481d3a32960165d64fb73f5b9adc8 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 02 四月 2025 18:30:21 +0800 Subject: [PATCH] 2025年04月02日18:24:17 --- app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java | 90 ++++++++++++++++++++++++++++++++++++++------- 1 files changed, 76 insertions(+), 14 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 c2e619e..e73d49b 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,8 @@ import androidx.recyclerview.widget.RecyclerView; import com.hdl.photovoltaic.R; +import com.hdl.photovoltaic.enums.DebugStatus; +import com.hdl.photovoltaic.enums.DeliverStatus; import com.hdl.photovoltaic.enums.PowerStationStatus; import com.hdl.photovoltaic.enums.UnitType; import com.hdl.photovoltaic.other.HdlCommonLogic; @@ -73,7 +75,7 @@ holder.home_location_tv.setText(houseIdBean.getHomeAddress()); holder.item_parent_rl.setTag(position); - setTextViewStyle(holder.stateTv, houseIdBean.getPowerStationStatus()); + setHomeStateTextViewStyle(holder.home_state_tv, houseIdBean.getPowerStationStatus()); GlideUtils.getRoundedCornersImage(mContext, houseIdBean.getPowerStationImage(), holder.homeIconIv, 6); // HdlLogLogic.print("---鐢电珯鍚嶇О:" + houseIdBean.getHomeName() + "---鍥剧墖url:" + houseIdBean.getPowerStationImage(), false); holder.item_parent_rl.setOnClickListener(new View.OnClickListener() { @@ -88,7 +90,7 @@ } }); //绉诲姩鐢电珯浣嶇疆 - holder.move_home_ll.setOnClickListener(new View.OnClickListener() { + holder.home_move_ll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { @@ -99,13 +101,13 @@ } } }); - holder.del_home_ll.setVisibility(View.GONE); - if (houseIdBean.getDeliverStatus().equals("UNDELIVERED")) { + holder.home_del_ll.setVisibility(View.GONE); + if (houseIdBean.getDeliverStatus().equals(DeliverStatus.UNDELIVERED)) { //鏈氦浠樺畬瑕佹樉绀哄垹闄ゆ寜閽� - holder.del_home_ll.setVisibility(View.VISIBLE); + holder.home_del_ll.setVisibility(View.VISIBLE); } //鍒犻櫎鐢电珯 - holder.del_home_ll.setOnClickListener(new View.OnClickListener() { + holder.home_del_ll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { @@ -150,7 +152,7 @@ } /** - * 鏀瑰彉缁勪欢鏍峰紡 + * 璁剧疆銆愮數绔欒皟璇曠姸鎬併�戠粍浠舵牱寮� * * @param textView 鏄剧ず缁勪欢 * 濡傛灉璁惧浠庢潵娌′笂鎶ヨ繃鏁版嵁鏁版嵁 鐘舵�侊細杩炴帴涓� @@ -159,7 +161,67 @@ * 璁惧绂荤嚎 鐘舵�侊細绂荤嚎 * @param state_value 鐢电珯鐘舵��(1:姝e父(杩愯),2:绂荤嚎,3:杩炴帴涓�,4:鏁呴殰,5:绂荤嚎鏈夋晠闅�) */ - private void setTextViewStyle(TextView textView, int state_value) { + private void setHomeDebugStateTextViewStyle(TextView textView, int state_value) { + + String text = mContext.getString(R.string.my_power_station_operation); + Drawable drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_state_ff38c494); + if (mPowerStationStatus.equals(DebugStatus.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.device_state_ffb9b9b9); + } + break; + case 3: { + text = mContext.getString(R.string.my_power_station_connecting); + drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_satte_ffb300); + } + break; + case 4: + case 5: { + text = mContext.getString(R.string.my_power_station_malfunction); + drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_state_fff55252); + } + //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.device_state_fff55252); + } else if (mPowerStationStatus.equals(PowerStationStatus.off)) { + text = mContext.getString(R.string.my_power_station_off_line); + drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_state_ffb9b9b9); + } else if (mPowerStationStatus.equals(PowerStationStatus.connecting)) { + text = mContext.getString(R.string.my_power_station_connecting); + drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_satte_ffb300); + } +// textView.setText(text); + textView.setBackground(drawable); + + + } + + /** + * 璁剧疆銆愮數绔欑姸鎬併�戠粍浠舵牱寮� + * + * @param textView 鏄剧ず缁勪欢 + * 濡傛灉璁惧浠庢潵娌′笂鎶ヨ繃鏁版嵁鏁版嵁 鐘舵�侊細杩炴帴涓� + * 璁惧鍦ㄧ嚎 浣嗘槸褰撳墠澶勪簬鏁呴殰 鐘舵�侊細鏁呴殰 + * 璁惧鍦ㄧ嚎锛堟湁涓婃姤杩囨暟鎹紝娌℃湁鏁呴殰锛� 鐘舵�侊細鍦ㄧ嚎 + * 璁惧绂荤嚎 鐘舵�侊細绂荤嚎 + * @param state_value 鐢电珯鐘舵��(1:姝e父(杩愯),2:绂荤嚎,3:杩炴帴涓�,4:鏁呴殰,5:绂荤嚎鏈夋晠闅�) + */ + private void setHomeStateTextViewStyle(TextView textView, int state_value) { String text = mContext.getString(R.string.my_power_station_operation); Drawable drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_state_ff38c494); @@ -225,10 +287,10 @@ public TextView output_kw_unit;//棰濆畾鍔熺巼鍗曚綅 public TextView battery_storage_value_tv;//鐢垫睜鑳介噺 public TextView battery_storage_kw_unit;//鐢垫睜鑳介噺鍗曚綅 - public TextView stateTv;//鐢电珯鐘舵��(杩炴帴涓�,杩愯,绂荤嚎,鏁呴殰); + public TextView home_state_tv;//鐢电珯鐘舵��(杩炴帴涓�,杩愯,绂荤嚎,鏁呴殰); public RelativeLayout item_parent_rl;//鏉$洰鐖跺鍣� - public LinearLayout move_home_ll;//绉诲姩鐢电珯浣嶇疆 - public LinearLayout del_home_ll;//鍒犻櫎鐢电珯 + public LinearLayout home_move_ll;//绉诲姩鐢电珯浣嶇疆 + public LinearLayout home_del_ll;//鍒犻櫎鐢电珯 public TextView home_location_tv;//鐢电珯鍦板潃 public SwipeLayout item_parent_swipeLayout;//鐖跺鍣� @@ -244,10 +306,10 @@ output_kw_unit = itemView.findViewById(R.id.output_kw_unit); battery_storage_value_tv = itemView.findViewById(R.id.battery_storage_value_tv); battery_storage_kw_unit = itemView.findViewById(R.id.battery_storage_kw_unit); - stateTv = itemView.findViewById(R.id.device_state_tv); + home_state_tv = itemView.findViewById(R.id.home_state_tv); item_parent_rl = itemView.findViewById(R.id.item_parent_rl); - move_home_ll = itemView.findViewById(R.id.move_ll); - del_home_ll = itemView.findViewById(R.id.del_ll); + home_move_ll = itemView.findViewById(R.id.move_ll); + home_del_ll = itemView.findViewById(R.id.del_ll); home_location_tv = itemView.findViewById(R.id.home_location_tv); item_parent_swipeLayout = itemView.findViewById(R.id.item_parent_swipeLayout); } -- Gitblit v1.8.0