| | |
| | | |
| | | private List<DeviceBean> mListDevice = new ArrayList<>(); |
| | | |
| | | public static String getConvertDoubleUnit(String value) { |
| | | if (TextUtils.isEmpty(value)) { |
| | | return noValue + kWh; |
| | | } |
| | | BigDecimal formattedValue = getBigDecimal(value); |
| | | return formattedValue + kWh; |
| | | |
| | | } |
| | | |
| | | public static String getConvertDoubleUnit(int value) { |
| | | if (value == 0) { |
| | | return noValue + kWh; |
| | | } |
| | | BigDecimal formattedValue = getBigDecimal(value + ""); |
| | | return formattedValue + kWh; |
| | | } |
| | | |
| | | private static BigDecimal getBigDecimal(String value) { |
| | | if (TextUtils.isEmpty(value)) { |
| | | return new BigDecimal(0); |
| | | } |
| | | double doubleValue = Double.parseDouble(value); |
| | | return BigDecimal.valueOf(doubleValue).setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | public void clearDeviceList() { |
| | | if (mListDevice == null) { |