| | |
| | | |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | |
| | | public static final String kWh = "kW.h"; |
| | | |
| | | public static final String kW = "kW"; |
| | | public static final String noValue = "0.00"; |
| | | |
| | | 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) { |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |