| | |
| | | import android.Manifest; |
| | | import android.content.pm.PackageManager; |
| | | import android.os.Bundle; |
| | | import android.os.Process; |
| | | import android.view.View; |
| | | |
| | | import com.google.gson.Gson; |
| | |
| | | import com.hdl.photovoltaic.other.HdlDeviceLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlMqttLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.other.HdlUniLogic; |
| | | import com.hdl.photovoltaic.ui.bean.DeviceRemoteInfo; |
| | | import com.hdl.photovoltaic.uni.HDLUniMP; |
| | | import com.hdl.photovoltaic.utils.AppManagerUtils; |
| | | import com.hdl.photovoltaic.utils.PermissionUtils; |
| | | import com.hdl.sdk.link.HDLLinkLocalSdk; |
| | | import com.hdl.sdk.link.common.event.EventListener; |
| | |
| | | private ActivityMyPowerStationBinding viewBinding; |
| | | private int currentFragmentIndex = 1; |
| | | private EventListener allTopicsListener; |
| | | |
| | | private int backPressTimes; |
| | | |
| | | |
| | | @Override |
| | |
| | | if (response.getTopic() == null) { |
| | | return; |
| | | } |
| | | HdlLogLogic.print("监听到的数据===========" + new Gson().toJson(response)); |
| | | HdlLogLogic.print("监听到的数据==="+new Gson().toJson(response),false); |
| | | // if (response.getTopic().endsWith("custom/native/inverter/up")) { |
| | | HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); |
| | | uniCallBackBaseBean.setType(response.getTopic()); |
| | |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | HdlLogLogic.print("读取mqtt远程信息失败", e.getMessage(), e.getCode()); |
| | | HdlLogLogic.print("读取mqtt远程信息失败==="+e.getMessage(), e.getCode(),true); |
| | | } |
| | | }); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 点击返回键的事件 |
| | | */ |
| | | @Override |
| | | public void onBackPressed() { |
| | | if (AppManagerUtils.getAppManager().getActivitySize() <= 1) { |
| | | if (backPressTimes == 0) { |
| | | HdlThreadLogic.toast(_mActivity, R.string.kill_app); |
| | | backPressTimes = 1; |
| | | new Thread() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Thread.sleep(2000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | backPressTimes = 0; |
| | | } |
| | | } |
| | | }.start(); |
| | | return; |
| | | } else { |
| | | AppManagerUtils.getAppManager().finishAllActivity(); |
| | | Process.killProcess(Process.myPid()); |
| | | } |
| | | } |
| | | super.onBackPressed(); |
| | | } |
| | | |
| | | } |