| | |
| | | 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; |
| | |
| | | |
| | | 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() { |
| | |
| | | } |
| | | }); |
| | | //移动电站位置 |
| | | holder.move_home_ll.setOnClickListener(new View.OnClickListener() { |
| | | holder.home_move_ll.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | try { |
| | |
| | | } |
| | | } |
| | | }); |
| | | 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 { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 改变组件样式 |
| | | * 设置【电站调试状态】组件样式 |
| | | * |
| | | * @param textView 显示组件 |
| | | * 如果设备从来没上报过数据数据 状态:连接中 |
| | |
| | | * 设备离线 状态:离线 |
| | | * @param state_value 电站状态(1:正常(运行),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:离线有故障Offline_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:正常(运行),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); |
| | |
| | | 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;//父容器 |
| | | |
| | |
| | | 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); |
| | | } |