From 2225b1f0727fb74e10ac5692e68e4cd48f4f62d7 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期一, 03 三月 2025 15:02:14 +0800
Subject: [PATCH] 2025年03月03日15:02:11
---
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java | 337 +++++++++++++++++++++++++++++++++----------------------
1 files changed, 202 insertions(+), 135 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
index 4206835..ec9501d 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
@@ -1,11 +1,20 @@
package com.hdl.photovoltaic.ui.powerstation;
+import android.Manifest;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.location.LocationManager;
import android.os.Bundle;
+import android.os.SystemClock;
+import android.provider.Settings;
+import android.util.Log;
import android.view.View;
-import android.widget.LinearLayout;
-import android.widget.TextView;
+import android.view.Window;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
@@ -15,12 +24,14 @@
import com.google.gson.Gson;
import com.hdl.linkpm.sdk.core.exception.HDLException;
+import com.hdl.photovoltaic.HDLApp;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.bean.PageNumberObject;
import com.hdl.photovoltaic.config.ConstantManage;
import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.databinding.FragmentHouseListBinding;
import com.hdl.photovoltaic.base.CustomBaseFragment;
+import com.hdl.photovoltaic.enums.DebugStatus;
import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch;
import com.hdl.photovoltaic.enums.LowerTagType;
import com.hdl.photovoltaic.enums.PowerStationStatus;
@@ -29,9 +40,12 @@
import com.hdl.photovoltaic.enums.SortValue;
import com.hdl.photovoltaic.listener.CloudCallBeak;
import com.hdl.photovoltaic.listener.LinkCallBack;
+import com.hdl.photovoltaic.listener.OnCallBeak;
import com.hdl.photovoltaic.other.HdlCommonLogic;
import com.hdl.photovoltaic.other.HdlDeviceLogic;
+import com.hdl.photovoltaic.other.HdlDialogLogic;
import com.hdl.photovoltaic.other.HdlLogLogic;
+import com.hdl.photovoltaic.other.HdlOtaLogic;
import com.hdl.photovoltaic.other.HdlResidenceLogic;
import com.hdl.photovoltaic.other.HdlThreadLogic;
import com.hdl.photovoltaic.other.HdlUniLogic;
@@ -41,8 +55,11 @@
import com.hdl.photovoltaic.ui.bean.HouseIdBean;
import com.hdl.photovoltaic.ui.bean.StatusOverviewBean;
import com.hdl.photovoltaic.uni.HDLUniMP;
+import com.hdl.photovoltaic.utils.GPSManagerUtils;
import com.hdl.photovoltaic.utils.PermissionUtils;
+import com.hdl.photovoltaic.utils.ProcessManagerUtils;
import com.hdl.photovoltaic.utils.URLEncodingUtils;
+import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
import com.hdl.photovoltaic.widget.DefaultFilteringDialog;
import com.hdl.photovoltaic.widget.DelayedConfirmationCancelDialog;
import com.hdl.sdk.link.common.exception.HDLLinkException;
@@ -86,7 +103,7 @@
private String value = SortValue.all;//descending:闄嶅簭,ascending:鍗囧簭
private String installedCapacityMinValue = "";//鏈�灏忕粍涓插閲�(瑁呮満瀹归噺)
private String installedCapacityMaxValue = "";//鏈�澶х粍涓插閲�(瑁呮満瀹归噺)
- private String gridTypeValue = "";//骞剁綉鐘舵��(鍏ㄩ儴 涓嶄紶璇ヨ繃婊ゅ弬鏁�,FULL_GRID:骞剁綉,OFFLINE:绂荤綉)
+ private String debugStatus = DebugStatus.All;//绛涢�夋潯浠剁姸鎬�
private String powerStationStatusValue = PowerStationStatus.All;//鐢电珯鐘舵��(鍏ㄩ儴 涓嶄紶璇ヨ繃婊ゅ弬鏁�,1:姝e父(杩愯),2:绂荤嚎,3:寰呮帴鍏�,4:鏁呴殰)
private final long pageSize = 20;//椤垫暟
@@ -94,12 +111,12 @@
/**
* 杩樺師鏉′欢鐨勫垵濮嬪寲鐘舵��
*/
- private void InitializationState() {
+ private void initializationState() {
key = SortValue.all;
value = SortValue.all;
installedCapacityMinValue = "";
installedCapacityMaxValue = "";
- gridTypeValue = "";
+ debugStatus = DebugStatus.All;
powerStationStatusValue = PowerStationStatus.All;
}
@@ -130,9 +147,9 @@
}
isClickPowerStationLabel = true;
selectedTitleLabelStyle();
- InitializationState();
+ initializationState();
getStatusOverview();
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
}
});
@@ -149,39 +166,51 @@
}
});
//鍏ㄩ儴
- viewBinding.powerStationAllIl.parentLl.setOnClickListener(new View.OnClickListener() {
+ viewBinding.allLl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
powerStationStatusValue = PowerStationStatus.All;
- selectedStationStateStyle(viewBinding.powerStationAllIl.parentLl, viewBinding.powerStationAllIl.stationTotalTv, viewBinding.powerStationAllIl.stationTitleTv, true);
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff));
+ viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
}
});
//鏁呴殰
- viewBinding.powerStationFaultsIl.parentLl.setOnClickListener(new View.OnClickListener() {
+ viewBinding.faultsLl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
powerStationStatusValue = PowerStationStatus.malfunction;
- selectedStationStateStyle(viewBinding.powerStationFaultsIl.parentLl, viewBinding.powerStationFaultsIl.stationTotalTv, viewBinding.powerStationFaultsIl.stationTitleTv, true);
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff));
+ viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
}
});
//绂荤嚎
- viewBinding.powerStationOfflineIl.parentLl.setOnClickListener(new View.OnClickListener() {
+ viewBinding.offlineLl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
powerStationStatusValue = PowerStationStatus.off;
- selectedStationStateStyle(viewBinding.powerStationOfflineIl.parentLl, viewBinding.powerStationOfflineIl.stationTotalTv, viewBinding.powerStationOfflineIl.stationTitleTv, true);
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff));
+ viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
}
});
//寰呮帴鍏�
- viewBinding.powerStationConnectedIl.parentLl.setOnClickListener(new View.OnClickListener() {
+ viewBinding.connectedLl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
powerStationStatusValue = PowerStationStatus.connecting;
- selectedStationStateStyle(viewBinding.powerStationConnectedIl.parentLl, viewBinding.powerStationConnectedIl.stationTotalTv, viewBinding.powerStationConnectedIl.stationTitleTv, true);
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff));
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
}
});
@@ -189,7 +218,14 @@
viewBinding.addIv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null);
+
+ requestPermissions(new OnCallBeak() {
+ @Override
+ public void onClickCallBeak() {
+// UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1);
+// HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null);
+ }
+ });
}
});
@@ -208,14 +244,14 @@
public void onClick(View v) {
DefaultFilteringDialog defaultFilteringDialog = new DefaultFilteringDialog(_mActivity);
defaultFilteringDialog.show();
- defaultFilteringDialog.initState(installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue);
+ defaultFilteringDialog.initState(installedCapacityMinValue, installedCapacityMaxValue, debugStatus);
defaultFilteringDialog.setOnClickListener(new DefaultFilteringDialog.OnClickListener() {
@Override
public void confirm(String min, String max, String state) {
installedCapacityMinValue = min;//鏈�灏忕粍涓插閲�(瑁呮満瀹归噺)
installedCapacityMaxValue = max;//鏈�澶х粍涓插閲�(瑁呮満瀹归噺)
- gridTypeValue = state;//骞剁綉鐘舵��(鍏ㄩ儴 涓嶄紶璇ヨ繃婊ゅ弬鏁�,FULL_GRID:骞剁綉,OFFLINE:绂荤綉)
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ debugStatus = state;//璋冭瘯鐘舵��(鍏ㄩ儴;璋冭瘯涓�;璋冭瘯瀹屾垚;宸蹭氦浠�;鎺堟潈璋冭瘯)
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
}
});
}
@@ -228,7 +264,7 @@
@Override
public void onRefresh() {
viewBinding.fragmentHouseSrl.setRefreshing(false);
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
getStatusOverview();
}
});
@@ -249,7 +285,7 @@
if (!isHouseLoadingMore) {
// 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔
HdlLogLogic.print("---婊戝姩鍒颁簡搴曢儴");
- loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, ++currentHouseListPage, false);
+ loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, ++currentHouseListPage, false);
}
}
}
@@ -259,11 +295,11 @@
@Override
public void onClick(int position, HouseIdBean houseIdBean) {
//鐐瑰嚮浣忓畢璇︽儏
- HdlLogLogic.print("鐐瑰嚮浣忓畢璇︽儏---" + new Gson().toJson(houseIdBean), false);
- HdlResidenceLogic.getInstance().switchHouse(houseIdBean);
+ UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(0);
+ HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true);
String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus();
HdlUniLogic.getInstance().openUniMP(path, null);
-
+ HdlLogLogic.print("鐐瑰嚮浣忓畢璇︽儏---" + new Gson().toJson(houseIdBean), false);
}
@Override
@@ -363,11 +399,10 @@
@Override
public void onClick(View v) {
boolean isSelected = !v.isSelected();
- viewBinding.stationNameRl.setSelected(isSelected);
- viewBinding.stationNameIv.setSelected(isSelected);
+ screenIconState(viewBinding.stationNameRl, viewBinding.stationNameIv, isSelected);
key = SortType.homeNameSort;
value = isSelected ? SortValue.ascending : SortValue.descending;
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
}
});
//鐢电珯鍙戠數鍔熺巼绛涢��
@@ -375,11 +410,10 @@
@Override
public void onClick(View v) {
boolean isSelected = !v.isSelected();
- viewBinding.stationPowerRl.setSelected(isSelected);
- viewBinding.stationPowerIv.setSelected(isSelected);
+ screenIconState(viewBinding.stationPowerRl, viewBinding.stationPowerIv, isSelected);
key = SortType.powerSort;
value = isSelected ? SortValue.ascending : SortValue.descending;
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
}
});
//鐢电珯褰撴棩鍙戠數閲忕瓫閫�
@@ -387,23 +421,21 @@
@Override
public void onClick(View v) {
boolean isSelected = !v.isSelected();
- viewBinding.stationDayRl.setSelected(isSelected);
- viewBinding.stationDayIv.setSelected(isSelected);
+ screenIconState(viewBinding.stationDayRl, viewBinding.stationDayIv, isSelected);
key = SortType.todayElectricitySort;
value = isSelected ? SortValue.ascending : SortValue.descending;
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
}
});
- //鐢电珯褰撴湀鍙戠數閲忕瓫閫�
+ //鐢电珯鐢垫睜瀹归噺绛涢��
viewBinding.stationMonthRl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean isSelected = !v.isSelected();
- viewBinding.stationMonthRl.setSelected(isSelected);
- viewBinding.stationMonthIv.setSelected(isSelected);
- key = SortType.monthElectricitySort;
+ screenIconState(viewBinding.stationMonthRl, viewBinding.stationMonthIv, isSelected);
+ key = SortType.batteryCapacitySort;
value = isSelected ? SortValue.ascending : SortValue.descending;
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
}
});
//璁惧鐐瑰嚮
@@ -494,16 +526,33 @@
}
+ /**
+ * 鏇存柊绛涢�夋潯浠剁姸鎬�
+ *
+ * @param relativeLayout 缁勪欢鍚嶇О
+ * @param imageView 缁勪欢鍚嶇О
+ * @param isSelected 鐘舵��
+ */
+ private void screenIconState(RelativeLayout relativeLayout, ImageView imageView, boolean isSelected) {
+ viewBinding.stationNameRl.setSelected(false);
+ viewBinding.stationNameIv.setSelected(false);
+ viewBinding.stationPowerRl.setSelected(false);
+ viewBinding.stationPowerIv.setSelected(false);
+ viewBinding.stationDayRl.setSelected(false);
+ viewBinding.stationDayIv.setSelected(false);
+ viewBinding.stationMonthRl.setSelected(false);
+ viewBinding.stationMonthIv.setSelected(false);
+ relativeLayout.setSelected(isSelected);
+ imageView.setSelected(isSelected);
+ }
+
private void initView() {
viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);
viewBinding.deviceLabelParent.setVisibility(View.GONE);
-
- viewBinding.powerStationAllIl.stationTitleTv.setText(getString(R.string.message_all));
- viewBinding.powerStationFaultsIl.stationTitleTv.setText(getString(R.string.my_power_station_malfunction));
- viewBinding.powerStationOfflineIl.stationTitleTv.setText(getString(R.string.my_power_station_off_line));
- viewBinding.powerStationConnectedIl.stationTitleTv.setText(getString(R.string.to_be_added));
-
- selectedStationStateStyle(viewBinding.powerStationAllIl.parentLl, viewBinding.powerStationAllIl.stationTotalTv, viewBinding.powerStationAllIl.stationTitleTv, true);
+ viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff));
+ viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
+ viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
//鐢电珯鏍囩
houseInfoAdapter = new HouseInfoAdapter(_mActivity);
viewBinding.fragmentHouseSrlListRc.setLayoutManager(new LinearLayoutManager(_mActivity));
@@ -514,7 +563,7 @@
deviceInfoAdapter = new DeviceInfoAdapter(_mActivity);
viewBinding.fragmentDeviceSrlListRc.setLayoutManager(new LinearLayoutManager(_mActivity));
viewBinding.fragmentDeviceSrlListRc.setAdapter(deviceInfoAdapter);
- this.nullDataUpdateUi();
+// this.nullDataUpdateUi();
}
@@ -523,8 +572,8 @@
*/
private void selectedTitleLabelStyle() {
if (isClickPowerStationLabel) {
- viewBinding.powerStationLabel.setTextAppearance(R.style.Text20Style);
- viewBinding.deviceLabel.setTextAppearance(R.style.Text16Style);
+ viewBinding.powerStationLabel.setTextAppearance(R.style.Text18Style);
+ viewBinding.deviceLabel.setTextAppearance(R.style.Text14Style);
// viewBinding.editIv.setVisibility(View.VISIBLE);//缂栬緫鍥炬爣闅愯棌
viewBinding.addIv.setVisibility(View.VISIBLE);//娣诲姞鍥炬爣闅愯棌
viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//鐢电珯鏍囩銆愮埗瀹瑰櫒銆戞樉绀�
@@ -533,8 +582,8 @@
viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE);
}
} else {
- viewBinding.deviceLabel.setTextAppearance(R.style.Text20Style);
- viewBinding.powerStationLabel.setTextAppearance(R.style.Text16Style);
+ viewBinding.deviceLabel.setTextAppearance(R.style.Text18Style);
+ viewBinding.powerStationLabel.setTextAppearance(R.style.Text14Style);
// viewBinding.editIv.setVisibility(View.GONE);//缂栬緫鍥炬爣闅愯棌
viewBinding.addIv.setVisibility(View.GONE);//娣诲姞鍥炬爣闅愯棌
viewBinding.powerStationLabelParent.setVisibility(View.GONE);//鐢电珯鏍囩銆愮埗瀹瑰櫒銆戦殣钘�
@@ -546,40 +595,6 @@
}
- /**
- * 鏄剧ず閫変腑鐘舵�佹牱寮�
- *
- * @param linearLayout 缁勪欢
- * @param numberTv 缁勪欢
- * @param titleTv 缁勪欢
- * @param isShowSelectedStatus 鏄惁鏄剧ず鐘舵�佹牱寮�
- */
- private void selectedStationStateStyle(LinearLayout linearLayout, TextView numberTv, TextView titleTv, boolean isShowSelectedStatus) {
- viewBinding.powerStationAllIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
- viewBinding.powerStationFaultsIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
- viewBinding.powerStationOfflineIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
- viewBinding.powerStationConnectedIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
-
- viewBinding.powerStationAllIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null));
- viewBinding.powerStationAllIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null));
-
- viewBinding.powerStationFaultsIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null));
- viewBinding.powerStationFaultsIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null));
-
- viewBinding.powerStationOfflineIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null));
- viewBinding.powerStationOfflineIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null));
-
- viewBinding.powerStationConnectedIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null));
- viewBinding.powerStationConnectedIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null));
-
-
- if (isShowSelectedStatus) {
- linearLayout.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.selected_8_38c494));
- numberTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
- titleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
- }
-
- }
private void initData() {
if (isClickPowerStationLabel) {
@@ -606,12 +621,12 @@
// 鍙栨秷绮樻�т簨浠�
EventBus.getDefault().removeStickyEvent(eventBus);
//uin鍒涘缓鐢电珯鎴愬姛鍚庨�氱煡
- loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+ loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
if (eventBus.getData() != null) {
Gson gson = new Gson();
String json = eventBus.getData().toString();
HouseIdBean houseIdBean = gson.fromJson(json, HouseIdBean.class);
- HdlResidenceLogic.getInstance().switchHouse(houseIdBean);
+ HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true);
}
} else if (HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT.equals(eventBus.getType())) {
@@ -646,11 +661,11 @@
EventBus.getDefault().removeStickyEvent(eventBus);
//鏄湪锛堢數绔欙級妯″潡涓斿湪锛堢數绔欙級鏍囩椤垫墠杩涙潵杩欓噷
if (HdlCommonLogic.lowerTagType == LowerTagType.power_station && isClickPowerStationLabel) {
- //uin鍏抽棴浣忓畢璇︽儏鐣岄潰閫氱煡
- if (MqttRecvClient.getInstance() != null) {
- MqttRecvClient.getInstance().removeAllTopic();
- }
- loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+// //uin鍏抽棴浣忓畢璇︽儏鐣岄潰閫氱煡
+// if (MqttRecvClient.getInstance() != null) {
+// MqttRecvClient.getInstance().removeAllTopic();
+// }
+ loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
}
} else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(eventBus.getType())) {
// 鍙栨秷绮樻�т簨浠�
@@ -658,24 +673,28 @@
// if (!isClickPowerStationLabel) {
// return;
// }
+ //鍏堟竻绌鸿闃呬富棰�
+ if (MqttRecvClient.getInstance() != null) {
+ MqttRecvClient.getInstance().removeAllTopic();
+ }
+ String homeId = eventBus.getData().toString();
//杩涘幓浣忓畢璇︽儏uni璇诲彇閫嗗彉鍣ㄥ垪琛ㄦ垚鍔熷悗閫氱煡
- for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId()).size(); i++) {
- String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId()).get(i).getGatewayId();
+ for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).size(); i++) {
+ String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).get(i).getGatewayId();
//瀛楃涓叉槸鑷繁鎸夎鍒欐嫾鎺ョ殑,閲岄潰娉ㄥ唽涓婚鏃朵細瑙f瀽瀛楃涓�,鍙嬁getGatewayId()鍊�;
String topic = "/user/" + gatewayId + "/#";
//杩涘幓浣忓畢璇︽儏寮�濮嬭闃呬富棰�
MqttRecvClient.getInstance().checkAndsubscribeAllTopics(topic);//璁㈤槄銆愰�嗗彉鍣ㄣ�戞秷鎭�
-
}
- String topicHome = "/user/" + UserConfigManage.getInstance().getHomeId() + "/#";
+ String topicHome = "/user/" + homeId + "/#";
MqttRecvClient.getInstance().checkAndsubscribeAllTopics(topicHome);//璁㈤槄銆愮數绔欍�戞秷鎭�
} else if (eventBus.getTopic().equals(ConstantManage.homepage_title_tab_switch)) {
+ // 鍙栨秷绮樻�т簨浠�
+ EventBus.getDefault().removeStickyEvent(eventBus);
//鎺ユ敹澶栭儴鐐瑰嚮浜嬩欢
if (eventBus.getType().equals(HomepageTitleTabSwitch.powerstation.toString())) {
- // 鍙栨秷绮樻�т簨浠�
- EventBus.getDefault().removeStickyEvent(eventBus);
HdlLogLogic.print("姝e湪鐐瑰嚮銆愮數绔欍��");
// if (!isReadData) {
// //1锛屼粠棣栭〉-鏁呴殰-杩涙潵-鐢电珯锛堜笉璇诲彇锛�
@@ -686,27 +705,28 @@
//2024骞�06鏈�24鏃�14:34:01 浜у搧缁忕悊瑕佹眰杩涘幓鐢电珯鍒楄〃閮借璇诲彇 涓旈粯璁よ繘鍘婚兘鏄粯璁ょ數绔欐爣绛�
isClickPowerStationLabel = true;
selectedTitleLabelStyle();
- InitializationState();
+ initializationState();
getStatusOverview();
- loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
-
-
- } else if (eventBus.getType().equals(PowerStationStatus.All)) {
- isClickPowerStationLabel = true;
- selectedTitleLabelStyle();
- viewBinding.powerStationAllIl.parentLl.performClick();
- } else if (eventBus.getType().equals(PowerStationStatus.malfunction)) {
- isClickPowerStationLabel = true;
- selectedTitleLabelStyle();
- viewBinding.powerStationFaultsIl.parentLl.performClick();
- } else if (eventBus.getType().equals(PowerStationStatus.off)) {
- isClickPowerStationLabel = true;
- selectedTitleLabelStyle();
- viewBinding.powerStationOfflineIl.parentLl.performClick();
- } else if (eventBus.getType().equals(PowerStationStatus.connecting)) {
- isClickPowerStationLabel = true;
- selectedTitleLabelStyle();
- viewBinding.powerStationConnectedIl.parentLl.performClick();
+ loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, debugStatus, powerStationStatusValue, 1, true);
+ } else if (eventBus.getType().equals(ConstantManage.station_page)) {
+ //閫氳繃棣栭〉鐢电珯杩涙潵鐨�
+ if (eventBus.getData().equals(PowerStationStatus.All)) {
+ isClickPowerStationLabel = true;
+ selectedTitleLabelStyle();
+ viewBinding.allLl.performClick();
+ } else if (eventBus.getData().equals(PowerStationStatus.malfunction)) {
+ isClickPowerStationLabel = true;
+ selectedTitleLabelStyle();
+ viewBinding.faultsLl.performClick();
+ } else if (eventBus.getData().equals(PowerStationStatus.off)) {
+ isClickPowerStationLabel = true;
+ selectedTitleLabelStyle();
+ viewBinding.offlineLl.performClick();
+ } else if (eventBus.getData().equals(PowerStationStatus.connecting)) {
+ isClickPowerStationLabel = true;
+ selectedTitleLabelStyle();
+ viewBinding.connectedLl.performClick();
+ }
} else if (eventBus.getType().equals(ConstantManage.station_edit)) {
//缂栬緫鍚庢洿鏂颁竴涓嬩綇瀹呭垪琛�
//loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
@@ -731,10 +751,10 @@
if (statusOverviewBean == null) {
return;
}
- viewBinding.powerStationAllIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getTotal()));
- viewBinding.powerStationFaultsIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getFault()));
- viewBinding.powerStationOfflineIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline()));
- viewBinding.powerStationConnectedIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getConnecting()));
+ viewBinding.allTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getTotal()));
+ viewBinding.faultsTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getFault()));
+ viewBinding.offlineTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline()));
+ viewBinding.connectedTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getConnecting()));
}
@Override
@@ -752,11 +772,12 @@
* @param key 鍙戠數鍔熺巼鎺掑簭(powerSort);
* 浠婃棩鍙戠數閲忔帓搴�(todayElectricitySort);
* 鍒涘缓鏃堕棿鎺掑簭(createTimeSort);
+ * 鐢垫睜瀹归噺鎺掑簭(batteryCapacitySort);
* @param keyValue (descending:闄嶅簭
* ascending:鍗囧簭),
* @param installedCapacityMin 鏈�灏忕粍涓插閲�(瑁呮満瀹归噺)
* @param installedCapacityMax 鏈�澶х粍涓插閲�(瑁呮満瀹归噺)
- * @param gridType 骞剁綉鐘舵�� (鍏ㄩ儴 锛�"";FULL_GRID 锛� 骞剁綉;OFFLINE 锛氱缃�)
+ * @param gridType 璋冭瘯鐘舵��(鍏ㄩ儴;璋冭瘯涓�;璋冭瘯瀹屾垚;宸蹭氦浠�;鎺堟潈璋冭瘯)
* @param powerStationStatus 鐢电珯鐘舵�� (鍏ㄩ儴 锛�"";1 锛� 姝e父;2 锛� 绂荤嚎; 3 锛� 寰呮帴鍏�;4 锛� 鏁呴殰)
* @param pageNo 椤电爜
* @param isClear 鏄惁娓呴櫎鏁版嵁
@@ -997,13 +1018,18 @@
if (requestCode == PermissionUtils.STATUS_SUCCESS) {
for (int i = 0; i < permissions.length; i++) {
if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
- if (mPermissionsResultCallback != null) {
- mPermissionsResultCallback.succeed();
+ switch (permissions[i]) {
+ case Manifest.permission.ACCESS_FINE_LOCATION: {
+ UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1);
+ HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null);
+ locationUpdates();
+ }
+ break;
}
+
} else {
- if (mPermissionsResultCallback != null) {
- mPermissionsResultCallback.failing();
- }
+ HdlDialogLogic.getInstance().showSettingPermissionDialog(_mActivity, _mActivity.getString(R.string.set_location_permissions));
+ break;
}
}
@@ -1011,16 +1037,57 @@
}
+ public void requestPermissions(OnCallBeak onCallBeak) {
- private PermissionsResultCallback mPermissionsResultCallback;
+ //ACCESS_FINE_LOCATION 鍏佽浣跨敤GPS瀹氫綅
+ //ACCESS_COARSE_LOCATION 鍏佽浣跨敤WIFI鐑偣鎴栧熀绔欐潵鑾峰彇绮楃暐鐨勫畾浣�
+ String[] ary = PermissionUtils.checkPermission(_mActivity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION});
+ if (ary.length > 0) {
+ this.requestPermissions(ary, PermissionUtils.STATUS_SUCCESS);
+ } else {
- public interface PermissionsResultCallback {
+ UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1);
+ HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null);
+ locationUpdates();
- void succeed();
- void failing();
+ }
}
+ /**
+ * 鍒濆鍖栥�愬紑鍚畾浣嶃�戝拰銆愪綅缃俊鎭�戞潈闄�
+ */
+ private void locationUpdates() {
+ // 鍒濆鍖朙ocationManager瀵硅薄
+ LocationManager locationManager = (LocationManager) _mActivity.getSystemService(Context.LOCATION_SERVICE);
+ GPSManagerUtils.getInstance().getLocation(_mActivity);
+ // 鍒ゆ柇璁惧鏄惁鏀寔瀹氫綅鍔熻兘
+ if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
+ // 鎻愮ず鐢ㄦ埛鎵撳紑瀹氫綅鍔熻兘鎴栬�呭紩瀵肩敤鎴峰幓绯荤粺璁剧疆椤甸潰鎵撳紑瀹氫綅鍔熻兘
+ ConfirmationCancelDialog confirmationCancelDialog = new ConfirmationCancelDialog(_mActivity);
+ confirmationCancelDialog.setContent(getString(R.string.system_positioning_switch));
+ confirmationCancelDialog.setConfirmation(getString(R.string.go_to_settings));
+ confirmationCancelDialog.show();
+ confirmationCancelDialog.isHideTitle(true);
+ confirmationCancelDialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() {
+ @Override
+ public void Confirm() {
+ confirmationCancelDialog.dismiss();
+ Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ HDLApp.getInstance().startActivity(intent);
+ }
+ });
+ confirmationCancelDialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() {
+ @Override
+ public void Cancel() {
+ confirmationCancelDialog.dismiss();
+ }
+ });
+
+ }
+
+ }
}
--
Gitblit v1.8.0