| | |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | |
| | | houseIdList = new ArrayList<>(); |
| | | } |
| | | this.houseIdList = houseIdList; |
| | | } |
| | | |
| | | /** |
| | | * 删除电站 |
| | | * |
| | | * @param houseId 电站id |
| | | */ |
| | | public void delHouseId(String houseId) { |
| | | if (TextUtils.isEmpty(houseId)) { |
| | | return; |
| | | } |
| | | for (int i = 0; i < houseIdList.size(); i++) { |
| | | if (houseIdList.get(i).getHomeId().equals(houseId)) { |
| | | houseIdList.remove(i); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 移动电站位置 |
| | | * |
| | | * @param houseId 电站id |
| | | */ |
| | | public void moveHouseId(String houseId) { |
| | | if (TextUtils.isEmpty(houseId)) { |
| | | return; |
| | | } |
| | | int index = -1; |
| | | for (int i = 0; i < houseIdList.size(); i++) { |
| | | if (houseIdList.get(i).getHomeId().equals(houseId)) { |
| | | index = i; |
| | | break; |
| | | } |
| | | } |
| | | if (index == -1) { |
| | | return; |
| | | } |
| | | //index==0表示只有一个元素或者在首位,不需要移动位置 |
| | | if (index > 0) { |
| | | Collections.swap(houseIdList, index - 1, index); |
| | | } |
| | | } |
| | | |
| | | //住宅ID列表 |
| | |
| | | JsonObject json = new JsonObject(); |
| | | json.addProperty("deviceName", Build.MODEL);//设备名称 |
| | | json.addProperty("deviceType", "Android");//设备类型 |
| | | json.addProperty("produce", AppConfigManage.isIsOnlineServer());//是否是生成版本 |
| | | json.addProperty("produce", AppConfigManage.isIsOnlineServer());//表示是否是正式服务器 |
| | | json.addProperty("pushToken", UserConfigManage.getInstance().getRegistrationID());//App的推送Token,在极光为RegId |
| | | json.addProperty("software", "PHOTOVOLTAIC");//软件来源 |
| | | |