From 1a8ba64b9cca5aaa98c4f84602f0fb78d3b6b6b4 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 25 十二月 2024 13:27:02 +0800 Subject: [PATCH] 2024年12月25日13:26:59 --- app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java | 40 +++++++++++++++++++++++++--------------- 1 files changed, 25 insertions(+), 15 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 e98ed2f..cb23400 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 @@ -61,18 +61,22 @@ HouseIdBean houseIdBean = this.mList.get(position); holder.homeNameTv.setText(houseIdBean.getHomeName().trim()); //瑁呮満瀹归噺 - String capacity = mContext.getString(R.string.string_capacity) + ":" + HdlCommonLogic.getConvertDoubleUnit(houseIdBean.getInstalledCapacity(), UnitType.kWp); + String capacity = HdlCommonLogic.getBigDecimal(houseIdBean.getInstalledCapacity()).toString(); holder.capacityTv.setText(capacity); //鍙戠數鍔熺巼 - holder.power_value_tv.setText(HdlCommonLogic.getConvertDoubleUnit(houseIdBean.getPower(), UnitType.kW)); + holder.power_value_tv.setText(HdlCommonLogic.convertDoubleValue(houseIdBean.getPower())); + holder.power_kw_unit.setText(HdlCommonLogic.convertUnit(houseIdBean.getPower(), UnitType.kW)); //褰撴棩鍙戠數閲� - holder.day_value_tv.setText(HdlCommonLogic.getConvertDoubleUnit(houseIdBean.getTodayElectricity(), UnitType.kWh)); + holder.day_value_tv.setText(HdlCommonLogic.convertDoubleValue(houseIdBean.getTodayElectricity())); + holder.day_kwh_unit.setText(HdlCommonLogic.convertUnit(houseIdBean.getTodayElectricity(), UnitType.kWh)); //褰撴湀鍙戠數閲� - holder.month_value_tv.setText(HdlCommonLogic.getConvertDoubleUnit(houseIdBean.getMonthElectricity(), UnitType.kWh)); + holder.month_value_tv.setText(HdlCommonLogic.convertDoubleValue(houseIdBean.getMonthElectricity())); + holder.month_kwh_unit.setText(HdlCommonLogic.convertUnit(houseIdBean.getMonthElectricity(), UnitType.kWh)); + holder.plant_details_location_tv.setText(houseIdBean.getHomeAddress()); holder.item_parent_rl.setTag(position); setTextViewStyle(holder.stateTv, houseIdBean.getPowerStationStatus()); - GlideUtils.getRoundedCornersImage(mContext, houseIdBean.getPowerStationImage(), holder.homeIconIv, new RoundedCorners(6), false); + GlideUtils.getRoundedCornersImage(mContext, houseIdBean.getPowerStationImage(), holder.homeIconIv, 6); HdlLogLogic.print("---鐢电珯鍚嶇О:" + houseIdBean.getHomeName() + "---鍥剧墖url:" + houseIdBean.getPowerStationImage(), false); holder.item_parent_rl.setOnClickListener(new View.OnClickListener() { @Override @@ -160,7 +164,7 @@ 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); + Drawable drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_state_ff38c494); if (mPowerStationStatus.equals(PowerStationStatus.All)) { switch (state_value) { case 1: { @@ -170,18 +174,18 @@ case 2: { text = mContext.getString(R.string.my_power_station_off_line); - drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_b9b9b9); + 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.state_ffb300); + 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.state_e34343); + drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_state_fff55252); } //5:绂荤嚎鏈夋晠闅淥ffline_fault break; @@ -193,15 +197,15 @@ } } else if (mPowerStationStatus.equals(PowerStationStatus.malfunction)) { text = mContext.getString(R.string.my_power_station_malfunction); - drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_e34343); + 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.state_b9b9b9); + 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.state_ffb300); + drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_satte_ffb300); } - textView.setText(text); +// textView.setText(text); textView.setBackground(drawable); @@ -216,8 +220,11 @@ public TextView homeNameTv;//浣忓畢鍚嶇О public TextView capacityTv;//瑁呮満瀹归噺 public TextView power_value_tv;//鍙戠數鍔熺巼 + public TextView power_kw_unit;//鍙戠數鍔熺巼鍗曚綅 public TextView day_value_tv;//褰撴棩鍙戠數閲� + public TextView day_kwh_unit;//褰撴棩鍙戠數閲忓崟浣� public TextView month_value_tv;//褰撴湀鍙戠數閲� + public TextView month_kwh_unit;//褰撴湀鍙戠數閲忓崟浣� public TextView stateTv;//鐢电珯鐘舵��(杩炴帴涓�,杩愯,绂荤嚎,鏁呴殰); public RelativeLayout item_parent_rl;//鏉$洰鐖跺鍣� public LinearLayout move_home_ll;//绉诲姩鐢电珯浣嶇疆 @@ -229,11 +236,14 @@ 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); + capacityTv = itemView.findViewById(R.id.device_details_value_tv); power_value_tv = itemView.findViewById(R.id.power_value_tv); + power_kw_unit = itemView.findViewById(R.id.power_kw_unit); day_value_tv = itemView.findViewById(R.id.day_value_tv); + day_kwh_unit = itemView.findViewById(R.id.day_kwh_unit); month_value_tv = itemView.findViewById(R.id.month_value_tv); - stateTv = itemView.findViewById(R.id.fragment_house_list_line_state_tv); + month_kwh_unit = itemView.findViewById(R.id.month_kwh_unit); + stateTv = itemView.findViewById(R.id.device_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); -- Gitblit v1.8.0