| | |
| | | package com.hdl.photovoltaic.ui; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.appcompat.content.res.AppCompatResources; |
| | | |
| | | import android.Manifest; |
| | | import android.content.ComponentName; |
| | | import android.content.Intent; |
| | | import android.content.ServiceConnection; |
| | | import android.content.pm.PackageManager; |
| | | import android.os.Bundle; |
| | |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.base.CustomBaseActivity; |
| | | import com.hdl.photovoltaic.bean.MqttInfo; |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.databinding.ActivityMyPowerStationBinding; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlCommonLogic; |
| | | import com.hdl.photovoltaic.other.HdlDeviceLogic; |
| | | import com.hdl.photovoltaic.other.HdlFileLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | |
| | | import com.hdl.sdk.link.core.config.HDLLinkConfig; |
| | | import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.greenrobot.eventbus.Subscribe; |
| | | import org.greenrobot.eventbus.ThreadMode; |
| | | |
| | |
| | | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | setNotificationBarBackgroundColor(CustomColor.blue); |
| | | //初始化 |
| | | initView(); |
| | | //初始化界面监听器 |
| | |
| | | //初始化mqtt客户端 |
| | | initMqttClient(); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | private void initEvent() { |
| | |
| | | public void onClick(View v) { |
| | | currentFragmentIndex = 1; |
| | | bottomViewChangeOfStyle(); |
| | | postEventBus(HdlCommonLogic.HomepageTitleTabSwitch.powerstation); |
| | | } |
| | | }); |
| | | viewBinding.myMessageBottomIl2.clickTv.setOnClickListener(new View.OnClickListener() { |
| | |
| | | public void onClick(View v) { |
| | | currentFragmentIndex = 2; |
| | | bottomViewChangeOfStyle(); |
| | | postEventBus(HdlCommonLogic.HomepageTitleTabSwitch.message); |
| | | } |
| | | }); |
| | | viewBinding.myMeBottomIl3.clickTv.setOnClickListener(new View.OnClickListener() { |
| | |
| | | public void onClick(View v) { |
| | | currentFragmentIndex = 3; |
| | | bottomViewChangeOfStyle(); |
| | | postEventBus(HdlCommonLogic.HomepageTitleTabSwitch.me); |
| | | } |
| | | }); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 发布点击事件 |
| | | * |
| | | * @param tabSwitch - |
| | | */ |
| | | private void postEventBus(HdlCommonLogic.HomepageTitleTabSwitch tabSwitch) { |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(ConstantManage.homepage_title_tab_switch); |
| | | baseEventBus.setType(tabSwitch + ""); |
| | | EventBus.getDefault().post(baseEventBus); |
| | | } |
| | | |
| | | public void requestPermissions() { |
| | | String[] ary = PermissionUtils.checkPermission(_mActivity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}); |
| | |
| | | }); |
| | | } |
| | | } else if (event.getTopic().contains(HdlOtaLogic.localDownloadProgress)) { |
| | | //下载云端驱动或者固件文件,自己计算进度条上报到uni那边 |
| | | //下载云端驱动或者固件文件到本地,自己计算进度条上报到uni那边 |
| | | HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); |
| | | uniCallBackBaseBean.setType(HdlOtaLogic.localDownloadProgress); |
| | | uniCallBackBaseBean.setType(event.getType()); |
| | | uniCallBackBaseBean.setData(event.getData()); |
| | | HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_REPLY_OTA_MODEL, uniCallBackBaseBean); |
| | | HdlLogLogic.print(((HdlOtaLogic.Progress) event.getData()).step + "", false); |
| | | HdlLogLogic.print("进度:" + ((HdlOtaLogic.Progress) event.getData()).step + "", false); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | super.onBackPressed(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |