| | |
| | | package com.hdl.photovoltaic.other; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.graphics.Bitmap; |
| | | import android.os.SystemClock; |
| | | import android.text.TextUtils; |
| | | import android.view.View; |
| | | import android.view.inputmethod.InputMethodManager; |
| | | import android.widget.ImageView; |
| | | import android.widget.TextView; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 没有数据界面的样式 |
| | | * |
| | |
| | | cloudCallBeak.onSuccess(true); |
| | | //临时的逻辑,上传oid列表到云端 |
| | | List<GatewayBean> list = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId); |
| | | uploadOidDataToCloud(UserConfigManage.getInstance().getHomeId(), list, true, null); |
| | | uploadOidDataToCloud(homeId, list, true, null); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | //添加逆变器失败后初始化逆变器 |
| | | HdlLogLogic.print("添加逆变器失败后开始初始化逆变器-->", true); |
| | | HdlDeviceLogic.getInstance().initializeInverter(mac, new LinkCallBack<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | HdlLogLogic.print("初始化逆变器成功-->mac:" + mac, true); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | HdlLogLogic.print("初始化逆变器失败-->mac:" + mac, true); |
| | | } |
| | | }); |
| | | |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | //添加逆变器失败后初始化逆变器 |
| | | HdlLogLogic.print("添加逆变器失败后开始初始化逆变器-->", true); |
| | | 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:" + gatewayBean.getDevice_mac(), true); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | HdlLogLogic.print("初始化逆变器失败-->mac:" + gatewayBean.getDevice_mac(), true); |
| | | } |
| | | }); |
| | | } |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |
| | |
| | | * @param cloudCallBeak 返回逆变器列表 |
| | | */ |
| | | public void getCurrentHomeLocalAndCloudGatewayList(String homeId, CloudCallBeak<List<GatewayBean>> cloudCallBeak) { |
| | | HdlDeviceLogic.getInstance().searchCurrentHomeGateway(new GatewayCallBack() { |
| | | HdlDeviceLogic.getInstance().searchCurrentHomeGateway(homeId,new GatewayCallBack() { |
| | | @Override |
| | | public void onSuccess(List<GatewayBean> gatewayBeanList) { |
| | | //局域网有2种情况(1:有局域网,有外网;2:有局域网,没有外网); |
| | |
| | | * |
| | | * @param gatewayCallBack - |
| | | */ |
| | | public void searchCurrentHomeGateway(GatewayCallBack gatewayCallBack) { |
| | | public void searchCurrentHomeGateway(String homeId,GatewayCallBack gatewayCallBack) { |
| | | List<String> spks = this.getGatewaySpk(); |
| | | //网关搜索 |
| | | HDLLinkLocalGateway.getInstance().refreshGatewayByHomeIdAndSpk(UserConfigManage.getInstance().getHomeId(), spks, true, gatewayCallBack); |
| | | HDLLinkLocalGateway.getInstance().refreshGatewayByHomeIdAndSpk(homeId, spks, true, gatewayCallBack); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param deviceMac 设备mac, |
| | | * @param callBeak 返回 true=本地连接;false=远程; |
| | | */ |
| | | public void isLocalConnect(String deviceMac, CloudCallBeak<Boolean> callBeak) { |
| | | searchCurrentHomeGateway(new GatewayCallBack() { |
| | | public void isLocalConnect(String homeId,String deviceMac, CloudCallBeak<Boolean> callBeak) { |
| | | searchCurrentHomeGateway(homeId,new GatewayCallBack() { |
| | | @Override |
| | | public void onSuccess(List<GatewayBean> gatewayBeanList) { |
| | | if (gatewayBeanList == null || gatewayBeanList.size() == 0) { |
| | |
| | | //重新创建住宅文件夹 |
| | | HdlFileLogic.getInstance().createDirectory(); |
| | | //进去住宅详情搜索一下逆变器列表,目的是建立通讯通道; |
| | | HdlDeviceLogic.getInstance().searchCurrentHomeGateway(null); |
| | | HdlDeviceLogic.getInstance().searchCurrentHomeGateway(houseIdBean.getHomeId(),null); |
| | | } |
| | | |
| | | |
| | |
| | | String module = "FW#" + imageId;//模块信息(HW:硬件) |
| | | |
| | | //升级本地优先->云端升级 |
| | | HdlDeviceLogic.getInstance().isLocalConnect(deviceMac, new CloudCallBeak<Boolean>() { |
| | | HdlDeviceLogic.getInstance().isLocalConnect(homeId,deviceMac, new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean b) { |
| | | if (b) { |
| | |
| | | String imageId = getKeyValue("imageId", getKeyValue("data", data));//固件镜像id |
| | | String module = driverCode + "#" + imageId; |
| | | //升级本地优先->云端升级 |
| | | HdlDeviceLogic.getInstance().isLocalConnect(deviceMac, new CloudCallBeak<Boolean>() { |
| | | HdlDeviceLogic.getInstance().isLocalConnect(homeId,deviceMac, new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean b) { |
| | | if (b) { |
| | |
| | | // com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(data); |
| | | try { |
| | | String devices = getKeyValue("devices", getKeyValue("data", data)); |
| | | String homeId = UserConfigManage.getInstance().getHomeId(); //绑定成功之后通知 |
| | | String homeId = getKeyValue("homeId", getKeyValue("data", data)); |
| | | Gson gson = new Gson(); |
| | | Type typeOfT = new TypeToken<List<GatewayBean>>() { |
| | | }.getType(); |
| | |
| | | viewBinding.homeLoginRegisterTv.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | String acc = "13375012441"; |
| | | // String acc = "18316672920"; |
| | | // String acc = "nuy13368@uzxia.com"; |
| | | String pws = "123456"; |
| | | //测试用 |
| | | viewBinding.homeLoginAccountEt.setText(acc); |
| | | viewBinding.homeLoginPasswordEt.setText(pws); |
| | | // String acc = "13375012441"; |
| | | //// String acc = "18316672920"; |
| | | //// String acc = "nuy13368@uzxia.com"; |
| | | // String pws = "123456"; |
| | | // //测试用 |
| | | // viewBinding.homeLoginAccountEt.setText(acc); |
| | | // viewBinding.homeLoginPasswordEt.setText(pws); |
| | | isLoginTextViewEnabled(); |
| | | } |
| | | |
| | |
| | | // 取消粘性事件 |
| | | EventBus.getDefault().removeStickyEvent(eventBus); |
| | | HdlLogLogic.print("正在点击【首页】"); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | return; |
| | | } |
| | | viewBinding.infoRl1Text1Tv.setText(HdlCommonLogic.getConvertDoubleUnit(dataOverBean.getInstalledCapacity())); |
| | | viewBinding.infoRl1Text3Tv.setText(HdlCommonLogic.getConvertDoubleUnit(dataOverBean.getPower(),UnitType.kW,false)); |
| | | viewBinding.infoRl1Text3Tv.setText(HdlCommonLogic.getConvertDoubleUnit(dataOverBean.getPower(), UnitType.kW, false)); |
| | | viewBinding.infoRl1FText1Tv.setText(dataOverBean.getPowerRatio()); |
| | | |
| | | viewBinding.homePageStationInfoRl2DayIc.dataTv.setText(HdlCommonLogic.getConvertDoubleUnit(dataOverBean.getTodayElectricity())); |
| | |
| | | package com.hdl.photovoltaic.ui.message; |
| | | |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.text.Editable; |
| | | import android.text.TextUtils; |
| | | import android.text.TextWatcher; |
| | | import android.view.View; |
| | | import android.view.inputmethod.InputMethodManager; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | |
| | | HdlThreadLogic.toast(_mActivity, R.string.search_content_null); |
| | | return; |
| | | } |
| | | viewBinding.messageSearchEt.clearFocus(); |
| | | hideSoftInputFromWindow(); |
| | | viewBinding.historyListParent.setVisibility(View.GONE); |
| | | viewBinding.listParent.setVisibility(View.VISIBLE); |
| | | addSearchTextToList(); |
| | |
| | | viewBinding.listParent.setVisibility(View.GONE); |
| | | searchHistoryAdapter.setList(searchHistoryTitleList); |
| | | clearCacheData(); |
| | | viewBinding.messageSearchEt.requestFocus(); |
| | | showSoftInput(); |
| | | } |
| | | }); |
| | | //删除 |
| | | viewBinding.messageDelIv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | viewBinding.messageSearchEt.clearFocus(); |
| | | hideSoftInputFromWindow(); |
| | | searchHistoryTitleList = new ArrayList<>(); |
| | | searchHistoryAdapter.setList(searchHistoryTitleList); |
| | | viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE); |
| | |
| | | HdlThreadLogic.toast(_mActivity, R.string.search_content_null); |
| | | return; |
| | | } |
| | | viewBinding.messageSearchEt.clearFocus(); |
| | | hideSoftInputFromWindow(); |
| | | viewBinding.historyListParent.setVisibility(View.GONE); |
| | | viewBinding.listParent.setVisibility(View.VISIBLE); |
| | | addSearchTextToList(); |
| | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 显示软键盘 |
| | | */ |
| | | public void showSoftInput() { |
| | | InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
| | | inputMethodManager.showSoftInput(viewBinding.messageSearchEt, 0); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 隐藏软键盘 |
| | | */ |
| | | public void hideSoftInputFromWindow() { |
| | | InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
| | | inputMethodManager.hideSoftInputFromWindow(viewBinding.getRoot().getWindowToken(), 0); |
| | | } |
| | | |
| | | private void initView() { |
| | |
| | | @Override |
| | | public void onKeyboardShow(int h) { |
| | | //Toast.makeText(MainActivity.this,"键盘弹出",Toast.LENGTH_SHORT).show(); |
| | | viewBinding.messageSearchEt.requestFocus(); |
| | | // viewBinding.messageSearchEt.requestFocus(); |
| | | |
| | | } |
| | | |
| | |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | |
| | | import android.content.Context; |
| | | import android.os.Bundle; |
| | | import android.text.Editable; |
| | | import android.text.TextUtils; |
| | | import android.text.TextWatcher; |
| | | import android.view.View; |
| | | import android.view.inputmethod.InputMethodManager; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | |
| | | HdlThreadLogic.toast(_mActivity, R.string.search_content_null); |
| | | return; |
| | | } |
| | | viewBinding.powerStationSearchEt.clearFocus(); |
| | | hideSoftInputFromWindow(); |
| | | viewBinding.historyListParent.setVisibility(View.GONE); |
| | | viewBinding.listParent.setVisibility(View.VISIBLE); |
| | | addSearchTextToList(); |
| | |
| | | viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE); |
| | | searchHistoryAdapter.setList(searchHistoryTitleList); |
| | | clearData(); |
| | | viewBinding.powerStationSearchEt.requestFocus(); |
| | | showSoftInput(); |
| | | } |
| | | }); |
| | | //删除 |
| | | viewBinding.powerStationDelIv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | viewBinding.powerStationSearchEt.clearFocus(); |
| | | hideSoftInputFromWindow(); |
| | | searchHistoryTitleList = new ArrayList<>(); |
| | | searchHistoryAdapter.setList(searchHistoryTitleList); |
| | | viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE); |
| | | HdlFileLogic.getInstance().deleteFile(getHistoryFileNamePath()); |
| | | |
| | | } |
| | | }); |
| | | //历史记录点击事件 |
| | |
| | | HdlThreadLogic.toast(_mActivity, R.string.search_content_null); |
| | | return; |
| | | } |
| | | viewBinding.powerStationSearchEt.clearFocus(); |
| | | hideSoftInputFromWindow(); |
| | | viewBinding.historyListParent.setVisibility(View.GONE); |
| | | viewBinding.listParent.setVisibility(View.VISIBLE); |
| | | addSearchTextToList(); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | private void initView() { |
| | | viewBinding.historyListParent.setVisibility(View.VISIBLE); |
| | | viewBinding.listParent.setVisibility(View.GONE); |
| | |
| | | @Override |
| | | public void onKeyboardShow(int h) { |
| | | //Toast.makeText(MainActivity.this,"键盘弹出",Toast.LENGTH_SHORT).show(); |
| | | viewBinding.powerStationSearchEt.requestFocus(); |
| | | // viewBinding.powerStationSearchEt.requestFocus(); |
| | | |
| | | } |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 显示软键盘 |
| | | */ |
| | | public void showSoftInput() { |
| | | InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
| | | inputMethodManager.showSoftInput(viewBinding.powerStationSearchEt, 0); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 隐藏软键盘 |
| | | */ |
| | | public void hideSoftInputFromWindow() { |
| | | InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
| | | inputMethodManager.hideSoftInputFromWindow(viewBinding.getRoot().getWindowToken(), 0); |
| | | } |
| | | |
| | | /** |
| | | * 输入电站名称进行过滤 |
| | |
| | | HdlResidenceLogic.getInstance().delHouseId(homeId);//删除电站缓存 |
| | | initData();//初始化缓存数据 |
| | | houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);//重新刷新列表 |
| | | getStatusOverview();//删除成功后刷新电站状态概览 |
| | | nullDataUpdateUi();//检测数据是否为空 |
| | | } |
| | | |
| | |
| | | package com.hdl.photovoltaic.ui.powerstation; |
| | | |
| | | |
| | | import android.content.Context; |
| | | import android.os.Bundle; |
| | | import android.text.Editable; |
| | | import android.text.TextUtils; |
| | | import android.text.TextWatcher; |
| | | import android.view.View; |
| | | import android.view.inputmethod.InputMethodManager; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | |
| | | } |
| | | viewBinding.historyListParent.setVisibility(View.GONE); |
| | | viewBinding.listParent.setVisibility(View.VISIBLE); |
| | | viewBinding.powerStationSearchEt.clearFocus(); |
| | | hideSoftInputFromWindow(); |
| | | addSearchTextToList(); |
| | | loadNextPageHouseList(true, 1, true); |
| | | } |
| | |
| | | loadNextPageHouseList(false, ++currentHouseListPage, false); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }); |
| | | //清除 |
| | |
| | | viewBinding.listParent.setVisibility(View.GONE); |
| | | viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE); |
| | | searchHistoryAdapter.setList(searchHistoryTitleList); |
| | | viewBinding.powerStationSearchEt.requestFocus(); |
| | | showSoftInput(); |
| | | clearData(); |
| | | } |
| | | }); |
| | |
| | | viewBinding.powerStationDelIv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | viewBinding.powerStationSearchEt.clearFocus(); |
| | | hideSoftInputFromWindow(); |
| | | searchHistoryTitleList = new ArrayList<>(); |
| | | searchHistoryAdapter.setList(searchHistoryTitleList); |
| | | viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE); |
| | | HdlFileLogic.getInstance().deleteFile(getHistoryFileNamePath()); |
| | | |
| | | } |
| | | }); |
| | | //历史记录点击事件 |
| | |
| | | HdlThreadLogic.toast(_mActivity, R.string.search_content_null); |
| | | return; |
| | | } |
| | | viewBinding.powerStationSearchEt.clearFocus(); |
| | | hideSoftInputFromWindow(); |
| | | viewBinding.historyListParent.setVisibility(View.GONE); |
| | | viewBinding.listParent.setVisibility(View.VISIBLE); |
| | | addSearchTextToList(); |
| | | loadNextPageHouseList(true, 1, true); |
| | | |
| | | } |
| | | }); |
| | | //电站点击是事件 |
| | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 显示软键盘 |
| | | */ |
| | | public void showSoftInput() { |
| | | InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
| | | inputMethodManager.showSoftInput(viewBinding.powerStationSearchEt, 0); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 隐藏软键盘 |
| | | */ |
| | | public void hideSoftInputFromWindow() { |
| | | InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
| | | inputMethodManager.hideSoftInputFromWindow(viewBinding.getRoot().getWindowToken(), 0); |
| | | } |
| | | |
| | | private void initView() { |
| | |
| | | @Override |
| | | public void onKeyboardShow(int h) { |
| | | //Toast.makeText(MainActivity.this,"键盘弹出",Toast.LENGTH_SHORT).show(); |
| | | viewBinding.powerStationSearchEt.requestFocus(); |
| | | // viewBinding.powerStationSearchEt.requestFocus(); |
| | | |
| | | } |
| | | |
| | |
| | | public String getHistoryFileNamePath() { |
| | | return HdlFileLogic.getInstance().getCurrentUserRootPath() + "/house_history.txt"; |
| | | } |
| | | |
| | | |
| | | } |