wjc
6 天以前 0770fc4f03196a27e8f4c899a44da63bb1a683e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
package com.hdl.photovoltaic.ui.newC;
 
 
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
 
import androidx.recyclerview.widget.LinearLayoutManager;
 
import com.google.gson.JsonObject;
import com.hdl.linkpm.sdk.core.exception.HDLException;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.base.CustomBaseActivity;
import com.hdl.photovoltaic.config.ConstantManage;
import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.databinding.ActivityPowerStationsListBinding;
import com.hdl.photovoltaic.enums.ShowErrorMode;
import com.hdl.photovoltaic.internet.HttpClient;
import com.hdl.photovoltaic.listener.CloudCallBeak;
import com.hdl.photovoltaic.listener.LinkCallBack;
import com.hdl.photovoltaic.other.HdlCommonLogic;
import com.hdl.photovoltaic.other.HdlDeviceLogic;
import com.hdl.photovoltaic.other.HdlResidenceLogic;
import com.hdl.photovoltaic.other.HdlThreadLogic;
import com.hdl.photovoltaic.other.HdlUniLogic;
import com.hdl.photovoltaic.ui.bean.HouseIdBean;
import com.hdl.photovoltaic.ui.device.ScanActivity;
import com.hdl.photovoltaic.ui.newC.adapter.HouseListAdapter;
import com.hdl.photovoltaic.uni.HDLUniMP;
import com.hdl.photovoltaic.utils.PermissionUtils;
import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
import com.hdl.photovoltaic.widget.DelayedConfirmationCancelDialog;
import com.hdl.photovoltaic.widget.PermissionExplanationDialog;
import com.hdl.photovoltaic.widget.refreshlayout.BGARefreshLayout;
import com.hdl.photovoltaic.widget.refreshlayout.HDLRefreshViewHolder;
import com.hdl.sdk.link.common.exception.HDLLinkException;
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
import com.hdl.sdk.link.core.bean.gateway.GatewayBean;
 
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
 
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
 
/**
 * C端电站列表编辑
 */
public class PowerStationsListActivity extends CustomBaseActivity {
    private Handler handler;
    private Runnable delayedRunnable;
    private ActivityPowerStationsListBinding viewBinding;//是否在编辑状态
 
    private HouseListAdapter houseListAdapter;
    private List<HouseIdBean> houseListBeanIDList;
 
 
    @Override
    public Object getContentView() {
        viewBinding = ActivityPowerStationsListBinding.inflate(getLayoutInflater());
        return viewBinding.getRoot();
    }
 
 
    @Override
    public void onBindView(Bundle savedInstanceState) {
        setStatusBarTranslucent();
        getWindow().setNavigationBarColor(getColor(R.color.text_FF000000));
        //初始化数据
        initData();
        //初始化
        initView();
        //初始化界面监听器
        initEvent();
        //后台读取住宅列表
//        downReadData(false);
    }
 
    private void initData() {
        this.houseListBeanIDList = new ArrayList<>();
        this.houseListBeanIDList.addAll(HdlResidenceLogic.getInstance().getHouseIdList());
        setSelectState();
    }
 
    private void initEvent() {
        //返回按钮
        viewBinding.toolbarTopRl.topBackLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        //编辑按钮
        viewBinding.toolbarTopRl.topMoreBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(_mActivity, PowerStationsMoveActivity.class);
                startActivity(intent);
            }
        });
 
        if (houseListAdapter != null) {
            //选中电站事件
            houseListAdapter.setOnItemClickListener(new HouseListAdapter.OnItemClickListener() {
                @Override
                public void onItemClick(int position, HouseIdBean houseBean) {
                    for (int i = 0; i < houseListBeanIDList.size(); i++) {
                        HouseIdBean houseIdBean = houseListBeanIDList.get(i);
                        houseIdBean.setState_select(false);
                    }
                    houseListBeanIDList.get(position).setState_select(true);
                    houseListAdapter.notifyDataSetChanged();
                    if (UserConfigManage.getInstance().getHomeId().equals(houseBean.getHomeId())) {
                        //同一个不执行弹窗
                        return;
                    }
                    houseSelectionDialog(houseBean);
                }
            });
            //删除电站事件
            houseListAdapter.setDelOnclickListener(new HouseListAdapter.OnDelClickListener() {
                @Override
                public void onDelClick(int position, HouseIdBean houseIdBean) {
                    DelayedConfirmationCancelDialog delayedConfirmationCancelDialog = new DelayedConfirmationCancelDialog(_mActivity);
                    delayedConfirmationCancelDialog.show();
                    delayedConfirmationCancelDialog.isHideTitle(true);
                    String del_home = getString(R.string.confirm_deletion) + "\"" + houseIdBean.getHomeName() + "\""+"?";
                    delayedConfirmationCancelDialog.setContent(del_home);
 
//                    delayedConfirmationCancelDialog.startCountdown(4);
                    delayedConfirmationCancelDialog.setYesOnclickListener(new DelayedConfirmationCancelDialog.onYesOnclickListener() {
                        @Override
                        public void Confirm() {
                            delayedConfirmationCancelDialog.dismiss();
                            showLoading(getString(R.string.deleting_please_wait));
                            HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(houseIdBean.getHomeId(), new CloudCallBeak<List<GatewayBean>>() {
                                @Override
                                public void onSuccess(List<GatewayBean> list) {
                                    //发起删除电站指令
                                    deleteResidence(houseIdBean.getHomeId(), list);
 
                                }
 
                                @Override
                                public void onFailure(HDLException e) {
                                    //发起删除电站指令
                                    deleteResidence(houseIdBean.getHomeId(), null);
                                }
                            });
 
                        }
                    });
                    delayedConfirmationCancelDialog.setNoOnclickListener(new DelayedConfirmationCancelDialog.onNoOnclickListener() {
                        @Override
                        public void Cancel() {
                            delayedConfirmationCancelDialog.dismiss();
                        }
                    });
                }
            });
        }
 
        viewBinding.addPowerStationTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
 
                // 未授权 如果应用程序没有所需的权限,则显示解释说明
                PermissionExplanationDialog.getInstance().showPortConflictPdDialog(_mActivity, getString(R.string.camera_storage_instructions), getString(R.string.camera_storage_purpose));
                PermissionUtils.requestPermissionsResultCallback(_mActivity, Manifest.permission.CAMERA, new PermissionUtils.PermissionState() {
                    @Override
                    public void Success(int value) {
                        PermissionExplanationDialog.getInstance().dismiss();
                        if (value == PermissionUtils.STATUS_REFUSE_PERMANENT | value == PermissionUtils.STATUS_REFUSE) {
//                            HdlThreadLogic.toast(_mActivity, R.string.permission_open);
                            return;
                        }
 
 
                        startActivity(ScanActivity.class);
                    }
                }, true);
 
            }
        });
 
    }
 
    private void initView() {
        viewBinding.toolbarTopRl.topBackLl.setVisibility(View.VISIBLE);
        viewBinding.toolbarTopRl.topTitleTv.setText(R.string.power_station_selection);
        viewBinding.toolbarTopRl.topMoreBtn.setVisibility(View.VISIBLE);
        viewBinding.toolbarTopRl.topMoreIv.setImageResource(R.drawable.editor_house);
        LinearLayoutManager linearLayout = new LinearLayoutManager(_mActivity);
        houseListAdapter = new HouseListAdapter(_mActivity);
        viewBinding.fragmentHouseSrlListRc.setLayoutManager(linearLayout);
        viewBinding.fragmentHouseSrlListRc.setAdapter(houseListAdapter);
        houseListAdapter.setList(this.houseListBeanIDList);
        this.nullDataUpdateUi(houseListBeanIDList);
        pullToRefresh();
    }
 
    /**
     * 下拉刷新的逻辑
     */
    protected void pullToRefresh() {
        viewBinding.fragmentHouseSrl.setDelegate(new BGARefreshLayout.BGARefreshLayoutDelegate() {
            @Override
            public void onBGARefreshLayoutBeginRefreshing(BGARefreshLayout refreshLayout) {
                handler = new Handler(Looper.getMainLooper());
 
                delayedRunnable = new Runnable() {
                    @Override
                    public void run() {
                        viewBinding.fragmentHouseSrl.endRefreshing();
                        downReadData(false);
                    }
                };
                // 延迟 5 秒执行
                handler.postDelayed(delayedRunnable, 1000);
            }
 
 
            @Override
            public boolean onBGARefreshLayoutBeginLoadingMore(BGARefreshLayout refreshLayout) {
 
                handler = new Handler(Looper.getMainLooper());
                delayedRunnable = new Runnable() {
                    @Override
                    public void run() {
                        viewBinding.fragmentHouseSrl.endLoadingMore();
 
                    }
                };
                // 延迟 5 秒执行
                handler.postDelayed(delayedRunnable, 10);
 
                return true;
            }
        });
        HDLRefreshViewHolder hdlRefreshViewHolder = new HDLRefreshViewHolder(_mActivity, true);
        hdlRefreshViewHolder.setPullDownImageResource(R.mipmap.loading_44);
        hdlRefreshViewHolder.setChangeToReleaseRefreshAnimResId(R.drawable.loading_refresh);
        hdlRefreshViewHolder.setRefreshingAnimResId(R.drawable.loading_refresh_end);
        viewBinding.fragmentHouseSrl.setRefreshViewHolder(hdlRefreshViewHolder);
    }
 
    /**
     * 刷新UI
     *
     * @param isRefreshing 表示是下拉刷新的
     */
    private void downReadData(boolean isRefreshing) {
        if (isRefreshing) {
            showLoading();
        }
        //获取住宅(电站)ID列表
        HdlResidenceLogic.getInstance().getResidenceIdList("", "", new CloudCallBeak<List<HouseIdBean>>() {
            @Override
            public void onSuccess(List<HouseIdBean> list) {
                HdlThreadLogic.runMainThread(new Runnable() {
                    @Override
                    public void run() {
                        if (isRefreshing) {
                            //关闭下拉刷新的圈圈
                            hideLoading();
                        }
                        if (list != null && !list.isEmpty()) {
                            if (!comparableList(houseListBeanIDList, list)) {
                                //更新缓存
                                HdlResidenceLogic.getInstance().setHouseIdList(list, true);
                                if (houseListAdapter != null) {
                                    //重新获取列表数据
                                    initData();
                                    refreshDetails();
                                    //更新电站选中状态
                                    setSelectState();
                                    //更新列表数据
                                    houseListAdapter.setList(houseListBeanIDList);
                                }
 
 
                            }
                        }
                        nullDataUpdateUi(list);
                    }
                }, _mActivity, ShowErrorMode.YES);
 
            }
 
            @Override
            public void onFailure(HDLException e) {
                HdlThreadLogic.runMainThread(new Runnable() {
                    @Override
                    public void run() {
                        if (isRefreshing) {
                            //关闭下拉刷新的圈圈
                            hideLoading();
                        }
 
                        HdlThreadLogic.toast(_mActivity, e.getMsg() + "(" + e.getCode() + ")");
 
                    }
                }, _mActivity, ShowErrorMode.YES);
            }
        });
    }
 
    /**
     * 设置当前电站选中状态
     */
    private void setSelectState() {
        for (int i = 0; i < houseListBeanIDList.size(); i++) {
            if (UserConfigManage.getInstance().getHomeId().equals(houseListBeanIDList.get(i).getHomeId())) {
                this.houseListBeanIDList.get(i).setState_select(true);
            }
        }
    }
 
    /**
     * 没有电站列表的样式
     */
    private void nullDataUpdateUi(List<HouseIdBean> list) {
        HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.nullDataIc.getRoot(), viewBinding.nullDataIc.nullDataGifAnimationIv, viewBinding.nullDataIc.nullDataTv, getString(R.string.my_power_station_data_null), list != null && list.size() > 0);
    }
 
 
    /**
     * 二次确认提示框
     *
     * @param houseIdBean 选中数据
     */
    private void houseSelectionDialog(HouseIdBean houseIdBean) {
        ConfirmationCancelDialog dialog = new ConfirmationCancelDialog(this);
        dialog.setTitle(getString(R.string.loading_title_tip));
        dialog.setContent(getString(R.string.switch_power_station).replace("%s", "\"" + houseIdBean.getHomeName() + "\""));
        dialog.show();
        dialog.isHideTitle(true);
        dialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() {
            @Override
            public void Confirm() {
                HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true);
                dialog.dismiss();
                JsonObject jsonObject = new JsonObject();
                jsonObject.addProperty("homeId", houseIdBean.getHomeId());
                jsonObject.addProperty("homeName", houseIdBean.getHomeName());
                jsonObject.addProperty("powerStationStatus", houseIdBean.getPowerStationStatus() + "");
                HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean();
                uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_DETAILS);
                uniCallBackBaseBean.setData(jsonObject);
                HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
                finish();
//                //todo 逻辑: 这里可以指定关闭小程序详情,然后再重新打开详情界面;
//                String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS_C
//                        + "?homeId=" + houseIdBean.getHomeId()
//                        + "&homeName=" + houseIdBean.getHomeName()
//                        + "&powerStationStatus=" + houseIdBean.getPowerStationStatus();
//                HdlUniLogic.getInstance().openUniMP(path, null);
 
            }
        });
        dialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() {
            @Override
            public void Cancel() {
                //取消之后还原之前状态
                for (int i = 0; i < houseListBeanIDList.size(); i++) {
                    HouseIdBean houseIdBean = houseListBeanIDList.get(i);
                    houseIdBean.setState_select(false);
                    if (UserConfigManage.getInstance().getHomeId().equals(houseIdBean.getHomeId())) {
                        houseIdBean.setState_select(true);
                    }
                }
                houseListAdapter.notifyDataSetChanged();
                dialog.dismiss();
            }
        });
 
        dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                //取消之后还原之前状态
                for (int i = 0; i < houseListBeanIDList.size(); i++) {
                    HouseIdBean houseIdBean = houseListBeanIDList.get(i);
                    houseIdBean.setState_select(false);
                    if (UserConfigManage.getInstance().getHomeId().equals(houseIdBean.getHomeId())) {
                        houseIdBean.setState_select(true);
                    }
                }
                houseListAdapter.notifyDataSetChanged();
            }
        });
    }
 
    /**
     * 删除电站
     *
     * @param homeId 电站id
     * @param list   逆变器列表
     */
    private void deleteResidence(String homeId, List<GatewayBean> list) {
 
        //删除住宅
        HdlResidenceLogic.getInstance().delResidence(homeId, new CloudCallBeak<Boolean>() {
            @Override
            public void onSuccess(Boolean obj) {
                hideLoading();
                initializeInverter(list); //发起初始化指令给逆变器;(注意:前面已先解绑云端逆变器,mqtt通道已断开,初始化只能是本地发送(先搜索局域网逆变器列表,建立本地通讯通道))
                HdlResidenceLogic.getInstance().delHouseId(homeId);//删除电站缓存
                initData();//初始化缓存数据
                refreshDetails();
                //更新电站选中状态
                setSelectState();
                houseListAdapter.setList(houseListBeanIDList); //更新列表数据
                nullDataUpdateUi(houseListBeanIDList);//检测数据是否为空
            }
 
            @Override
            public void onFailure(HDLException e) {
                hideLoading();
                HdlThreadLogic.toast(_mActivity, e);
            }
        });
    }
 
    /**
     * 删除电站,逆变器
     * (开始删除电站,同时,向逆变器发送初始化逆变器指令,无须处理结果)
     *
     * @param list 设备列表
     */
    private void initializeInverter(List<GatewayBean> list) {
        if (list == null || list.size() == 0) {
            return;
        }
        for (int i = 0; i < list.size(); i++) {
            GatewayBean gatewayBean = list.get(i);
            HdlDeviceLogic.getInstance().initializeInverter(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
                @Override
                public void onSuccess(Boolean obj) {
//                                HdlLogLogic.print("初始化逆变器成功-->mac:" + cloudInverterDeviceBean.getOsn(),true);
                }
 
                @Override
                public void onError(HDLLinkException e) {
//                                HdlLogLogic.print("初始化逆变器失败-->mac:" + cloudInverterDeviceBean.getOsn(),true);
                }
            });
        }
    }
 
 
    /**
     * 收到EventBUs通知
     *
     * @param eventBus 数据
     */
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEventMessage(BaseEventBus eventBus) {
        super.onEventMessage(eventBus);
        if (HDLUniMP.UNI_EVENT_REPLY_HOME_ADD.equals(eventBus.getTopic())) {
            if (HDLUniMP.UNI_EVENT_REPLY_HOME_ADD.equals(eventBus.getType())) {
//                // 取消粘性事件
//                EventBus.getDefault().removeStickyEvent(eventBus);
                HttpClient.getInstance().requestHttpGet(eventBus.getData().toString(), new CloudCallBeak<String>() {
                    @Override
                    public void onSuccess(String obj) {
                        downReadData(true);
                    }
 
                    @Override
                    public void onFailure(HDLException e) {
                        HdlThreadLogic.toast(_mActivity, e);
                    }
                });
 
            }
        } else if (ConstantManage.REFRESH_HOME_LIST.equals(eventBus.getTopic())) {
            if (houseListAdapter != null) {
                initData();
                setSelectState();
                //更新UI
                houseListAdapter.setList(houseListBeanIDList);
            }
        }
    }
 
 
    /**
     * 比较住宅列表数据是否都一样
     *
     * @param oldList 旧列表
     * @param newList 新列表
     * @return 相同返回true,否则返回false
     */
    boolean comparableList(List<HouseIdBean> oldList, List<HouseIdBean> newList) {
        if (oldList == null || newList == null) return false;
        if (oldList.size() != newList.size()) return false;
        List<String> oidStrList = new ArrayList<>();
        for (int i = 0; i < oldList.size(); i++) {
            oidStrList.add(oldList.get(i).getHomeId());
        }
 
        List<String> newStrList = new ArrayList<>();
        for (int i = 0; i < newList.size(); i++) {
            newStrList.add(newList.get(i).getHomeId());
        }
        Collections.sort(oidStrList);
        Collections.sort(newStrList);
        return oidStrList.equals(newStrList);
    }
 
    /**
     * 通知uni更新数据
     * (在平台上删除C端当前住宅后,获取列表实收要通知uni那边更新界面卡片)
     */
    private void refreshDetails() {
        try {
            List<HouseIdBean> localHouseIdList = HdlResidenceLogic.getInstance().getHouseIdList();
            if (localHouseIdList.isEmpty()) {
                JsonObject jsonObject = new JsonObject();
                jsonObject.addProperty("homeId", "");
                HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean();
                uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_DETAILS);
                uniCallBackBaseBean.setData(jsonObject);
                HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
            } else {
                int select_home = -1;
                for (int i = 0; i < localHouseIdList.size(); i++) {
                    if (localHouseIdList.get(i).getHomeId().equals(UserConfigManage.getInstance().getHomeId())) {
                        select_home = i;
                        break;
                    }
                }
                if (select_home == -1) {
                    //找不到默认第一个
                    HouseIdBean houseIdBean = localHouseIdList.get(0);
                    HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true);
                    JsonObject jsonObject = new JsonObject();
                    jsonObject.addProperty("homeId", houseIdBean.getHomeId());
                    jsonObject.addProperty("homeName", houseIdBean.getHomeName());
                    jsonObject.addProperty("powerStationStatus", houseIdBean.getPowerStationStatus() + "");
                    HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean();
                    uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_DETAILS);
                    uniCallBackBaseBean.setData(jsonObject);
                    HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
                }
            }
        } catch (Exception e) {
        }
    }
 
    @Override
    protected void onDestroy() {
        if (handler != null && delayedRunnable != null) {
            handler.removeCallbacks(delayedRunnable);
        }
        super.onDestroy();
    }
}