From cbd0384e4e68c3d838981aba0602c6d76fdc091b Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 22 四月 2025 19:26:28 +0800
Subject: [PATCH] Merge branch '1.5.1_google' into 1.5.2
---
app/src/main/java/com/hdl/photovoltaic/ui/StartActivity.java | 1
app/src/main/java/com/hdl/photovoltaic/ui/adapter/DeviceInfoAdapter.java | 9
app/src/main/res/values/strings.xml | 2
app/src/main/java/com/hdl/photovoltaic/ui/me/CPersonalDataActivity.java | 4
app/src/main/AndroidManifest.xml | 19 +-
app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java | 79 ++++----
app/src/main/res/layout/item_plant_details.xml | 2
app/src/main/java/com/hdl/photovoltaic/ui/me/AsRegardsActivity.java | 28 ++
app/src/main/java/com/hdl/photovoltaic/utils/SharedPreUtils.java | 4
app/src/main/java/com/hdl/photovoltaic/widget/popupview/CameraAlbumPopWindow.java | 4
/dev/null | 296 --------------------------------
app/src/main/res/layout/dialog_confirm_cancel.xml | 2
app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java | 22 +-
app/src/main/res/values-zh/strings.xml | 2
app/src/main/res/layout/activity_as_regards.xml | 14 +
app/src/main/res/values-en/strings.xml | 2
app/src/main/java/com/hdl/photovoltaic/ui/newC/PowerStationsListEdit.java | 4
app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java | 19 +
app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java | 2
19 files changed, 124 insertions(+), 391 deletions(-)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ee6ece8..60a9274 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -24,8 +24,11 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 濡傛灉鏄畨鍗�10.0锛岄渶瑕佸悗鍙拌幏鍙栬繛鎺ョ殑wifi鍚嶇О鍒欐坊鍔犺繘绋嬭幏鍙栦綅缃俊鎭潈闄� -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- android 10.0浣跨敤wifi api鏂版坊鍔犵殑鏉冮檺 -->
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+ <!-- <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /><!–鏉冮檺鍏佽搴旂敤绋嬪簭鍦ㄥ悗鍙拌闂綅缃俊鎭� 璋锋瓕play涓婃灦涓嶄簡 –>-->
<uses-permission android:name="android.permission.CAMERA" />
- <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- UNI鐩告満鍜屽瓨鍌ㄧ殑鏉冮檺 -->
+ <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+ <!-- UNI鐩告満鍜屽瓨鍌ㄧ殑鏉冮檺 -->
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
@@ -33,17 +36,18 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- Optional. Required for location feature -->
<!-- 涓轰簡鎻愰珮sdk璇嗗埆鍞竴鐢ㄦ埛鐨勮兘鍔涳紝淇濊瘉娑堟伅鎺ㄩ�佺殑绮惧噯閫佽揪锛屽缓璁泦鎴愪互涓嬫潈闄愶紙鍙�夛級 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
- <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
- <uses-permission android:name="android.permission.BLUETOOTH" />
- <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" /> <!-- 濡傛偍闇�瑕佹帴鍏ュ湴鐞嗗洿鏍忎笟鍔★紝寤鸿闆嗘垚浠ヤ笅鏉冮檺锛堝彲閫夛級 -->
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> <!– 濡傛偍闇�瑕佸搴旇澶囬�氱煡鐩稿叧鐨勮兘鍔涳紝寤鸿闆嗘垚浠ヤ笅鏉冮檺锛堝彲閫夛級 –> -->
+ <uses-permission android:name="android.permission.BLUETOOTH" /> <!-- Optional. Required for location feature -->
+ <!-- 涓轰簡鎻愰珮sdk璇嗗埆鍞竴鐢ㄦ埛鐨勮兘鍔涳紝淇濊瘉娑堟伅鎺ㄩ�佺殑绮惧噯閫佽揪锛屽缓璁泦鎴愪互涓嬫潈闄愶紙鍙�夛級 -->
+ <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+ <!-- <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" /><!–璋锋瓕play涓婃灦涓嶄簡–>-->
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 濡傛偍闇�瑕佹帴鍏ュ湴鐞嗗洿鏍忎笟鍔★紝寤鸿闆嗘垚浠ヤ笅鏉冮檺锛堝彲閫夛級 -->
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" /> <!-- 鍗庝负瑙掓爣 -->
<uses-permission android:name="com.vivo.notification.permission.BADGE_ICON" /> <!-- VIVO瑙掓爣鏉冮檺 -->
<uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" /> <!-- 鎸姩鍣ㄦ潈闄愶紝JPUSH鏀寔閫氱煡寮�鍚尟鍔ㄥ姛鑳斤紝灏忕背鎺ㄩ�佸繀椤� -->
@@ -127,9 +131,6 @@
<activity
android:name=".ui.me.CPersonalDataActivity"
android:exported="false" />
-
- <service android:name=".widget.apkwgtupload.ApkDownLoadService" />
- <!--largeHeap="true" 涓存椂缂撹В鍐呭瓨涓嶈冻闂 -->
<activity
android:name=".ui.me.WebActivity"
android:exported="false"
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java
index 2c49f36..dda8973 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java
@@ -820,7 +820,7 @@
UserConfigManage.getInstance().setTheSameLoginAccount(isUserId);//涓庝笂涓�涓处鍙锋槸鍚﹀悓涓�涓�
//UserConfigManage.getInstance().getUserId()琛ㄧず绗竴娆″畨瑁呯櫥褰�
if (!TextUtils.isEmpty(UserConfigManage.getInstance().getUserId()) && !UserConfigManage.getInstance().isTheSameLoginAccount()) {
- //涓嶅悓璐﹀彿,鍒犻櫎涔嬪墠鐨勬棫璐﹀彿鏃ュ織淇℃伅;
+ //涓嶅悓璐﹀彿,鍒犻櫎涔嬪墠鐨勬棫璐﹀彿淇℃伅;
HdlFileLogic.getInstance().deleteDirectory(HdlFileLogic.getInstance().getCurrentUserRootPath());
HdlFileLogic.getInstance().deleteDirectory(HdlFileLogic.getInstance().getUserFilePath());
UserConfigManage.getInstance().setHomeId("");
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java
index 4720942..a935e16 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlCommonLogic.java
@@ -62,14 +62,15 @@
/**
- * @param value 鍊�
+ * @param value 鍊�
+ * @param unitType 闇�瑕佽浆鐨勫崟浣嶏紙kW锛宬Wh锛�
* @return 瀛楃涓插�艰繑鍥�
*/
- public static String convertDoubleValue(String value) {
+ public static String convertDoubleValue(String value, String unitType) {
if (TextUtils.isEmpty(value)) {
return UnitType.noValue;
}
- return divideByOneThousandAndFormat(value).toString();
+ return divideByOneThousandAndFormat(value,unitType).toString();
}
/**
@@ -122,10 +123,10 @@
* @param value 鍊�
* @return BigDecimal
*/
- public static BigDecimal divideByOneThousandAndFormat(String value) {
+ public static BigDecimal divideByOneThousandAndFormat(String value, String unitType) {
try {
double doubleValue = Double.parseDouble(value);
- int mDoubleValue = doubleValue(value);
+ long mDoubleValue = doubleValue(value,unitType);
if (mDoubleValue == 0) {
return getBigDecimal(value);
} else {
@@ -143,17 +144,29 @@
*
* @param value 鍊�
*/
- public static int doubleValue(String value) {
+ public static long doubleValue(String value, String unitType) {
try {
double doubleValue = Double.parseDouble(value);
- if (doubleValue > 1000 && doubleValue < 1000 * 1000) {
- return 1000;
- } else if (doubleValue > 1000 * 1000 && doubleValue < 1000 * 1000 * 1000) {
- return 1000 * 1000;
- } else if (doubleValue > 1000 * 1000 * 1000) {
- return 1000 * 1000 * 1000;
+ if (unitType.equals(UnitType.kW)) {
+ if (doubleValue > 1000 && doubleValue < 1000 * 1000) {
+ return 1000 ;
+ } else if (doubleValue >= 1000 * 1000 && doubleValue < 1000 * 1000 * 1000) {
+ return 1000 * 1000 ;
+ } else if (doubleValue >= 1000 * 1000 * 1000) {
+ return 1000L * 1000 * 1000 ;
+ } else {
+ return 1000;
+ }
} else {
- return 0;
+ if (doubleValue >= 1000 && doubleValue < 1000 * 1000) {
+ return 1000;
+ } else if (doubleValue >= 1000 * 1000 && doubleValue < 1000 * 1000 * 1000) {
+ return 1000 * 1000;
+ } else if (doubleValue >= 1000 * 1000 * 1000) {
+ return 1000 * 1000 * 1000;
+ } else {
+ return 0;
+ }
}
} catch (Exception e) {
return 0;
@@ -161,29 +174,7 @@
}
- /**
- * 杞崲鍗曚綅
- *
- * @param value 鍊�
- * @param unitType 琛ㄧず鏄崟浣嶏紙鍔熺巼锛岀數閲忥級
- */
- public static String convertUnit(String value, String unitType) {
- try {
- double doubleValue = Double.parseDouble(value);
- if (doubleValue > 1000 && doubleValue < 1000 * 1000) {
- return unitType.equals(UnitType.kW) ? UnitType.mW : UnitType.mWh;
- } else if (doubleValue > 1000 * 1000 && doubleValue < 1000 * 1000 * 1000) {
- return unitType.equals(UnitType.kW) ? UnitType.gW : UnitType.gWh;
- } else if (doubleValue > 1000 * 1000 * 1000) {
- return unitType.equals(UnitType.kW) ? UnitType.tW : UnitType.tWh;
- } else {
- return unitType.equals(UnitType.kW) ? UnitType.kW : UnitType.kWh;
- }
- } catch (Exception e) {
- return unitType.equals(UnitType.kW) ? UnitType.kW : UnitType.kWh;
- }
- }
/**
* 杞崲鐢甸噺(kWh)鍗曚綅
@@ -193,11 +184,11 @@
public static String convertKWHUnit(String value) {
try {
double doubleValue = Double.parseDouble(value);
- if (doubleValue > 1000 && doubleValue < 1000 * 1000) {
+ if (doubleValue >= 1000 && doubleValue < 1000 * 1000) {
return UnitType.mWh;
- } else if (doubleValue > 1000 * 1000 && doubleValue < 1000 * 1000 * 1000) {
+ } else if (doubleValue >= 1000 * 1000 && doubleValue < 1000 * 1000 * 1000) {
return UnitType.gWh;
- } else if (doubleValue > 1000 * 1000 * 1000) {
+ } else if (doubleValue >= 1000 * 1000 * 1000) {
return UnitType.tWh;
} else {
return UnitType.kWh;
@@ -217,10 +208,12 @@
try {
double doubleValue = Double.parseDouble(value);
if (doubleValue > 1000 && doubleValue < 1000 * 1000) {
+ return UnitType.kW;
+ } else if (doubleValue >= 1000 * 1000 && doubleValue < 1000 * 1000 * 1000) {
return UnitType.mW;
- } else if (doubleValue > 1000 * 1000 && doubleValue < 1000 * 1000 * 1000) {
+ } else if (doubleValue >= 1000 * 1000 * 1000&&doubleValue < 1000 * 1000 * 1000*1000L) {
return UnitType.gW;
- } else if (doubleValue > 1000 * 1000 * 1000) {
+ } else if (doubleValue >= 1000 * 1000 * 1000*1000L) {
return UnitType.tW;
} else {
return UnitType.kW;
@@ -239,11 +232,11 @@
public static String convertKWPUnit(String value) {
try {
double doubleValue = Double.parseDouble(value);
- if (doubleValue > 1000 && doubleValue < 1000 * 1000) {
+ if (doubleValue >= 1000 && doubleValue < 1000 * 1000) {
return UnitType.MWp;
- } else if (doubleValue > 1000 * 1000 && doubleValue < 1000 * 1000 * 1000) {
+ } else if (doubleValue >= 1000 * 1000 && doubleValue < 1000 * 1000 * 1000) {
return UnitType.GWp;
- } else if (doubleValue > 1000 * 1000 * 1000) {
+ } else if (doubleValue >= 1000 * 1000 * 1000) {
return UnitType.TWp;
} else {
return UnitType.kWp;
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/StartActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/StartActivity.java
index fe166b3..1e8860b 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/StartActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/StartActivity.java
@@ -21,6 +21,7 @@
import com.hdl.photovoltaic.config.AppConfigManage;
import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.listener.CloudCallBeak;
+import com.hdl.photovoltaic.other.HdlCommonLogic;
import com.hdl.photovoltaic.other.HdlResidenceLogic;
import com.hdl.photovoltaic.ui.bean.HouseIdBean;
import com.hdl.photovoltaic.ui.me.WebActivity;
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/DeviceInfoAdapter.java b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/DeviceInfoAdapter.java
index 611574c..4b36cf4 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/DeviceInfoAdapter.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/DeviceInfoAdapter.java
@@ -44,13 +44,14 @@
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
CloudInverterDeviceBean deviceBean = this.mList.get(position);
+
holder.homeNameTv.setText(deviceBean.getHomeNameAndDeviceName());
holder.device_details_sn_tv.setText(deviceBean.getOsn());
holder.device_label_run_state_value_tv.setText(deviceBean.getSystemStatusDesc());
- holder.device_label_power_value_tv.setText(HdlCommonLogic.convertDoubleValue(deviceBean.getOutputActivePower(), 1000));
- holder.device_label_power_unit.setText(HdlCommonLogic.convertUnit(deviceBean.getOutputActivePower(), UnitType.kW));
- holder.device_label_day_value_tv.setText(HdlCommonLogic.convertDoubleValue(deviceBean.getTotalElectricityPvToday()));
- holder.device_label_day_unit.setText(HdlCommonLogic.convertUnit(deviceBean.getOutputActivePower(), UnitType.kWh));
+ holder.device_label_power_value_tv.setText(HdlCommonLogic.convertDoubleValue(deviceBean.getOutputActivePower(), UnitType.kW));
+ holder.device_label_power_unit.setText(HdlCommonLogic.convertKWUnit(deviceBean.getOutputActivePower()));
+ holder.device_label_day_value_tv.setText(HdlCommonLogic.convertDoubleValue(deviceBean.getTotalElectricityPvToday(), UnitType.kWh));
+ holder.device_label_day_unit.setText(HdlCommonLogic.convertKWHUnit(deviceBean.getTotalElectricityPvToday()));
holder.device_label_location_tv.setText(deviceBean.getHomeAddress());
setTextViewStyle(holder.device_label_state_tv, deviceBean.getDeviceStatus());
holder.itemView.setTag(position);
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java
index a445f25..d2d9071 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java
@@ -61,17 +61,18 @@
HouseIdBean houseIdBean = this.mList.get(position);
holder.homeNameTv.setText(houseIdBean.getHomeName().trim());
//瑁呮満瀹归噺
- String capacity = HdlCommonLogic.getBigDecimal(houseIdBean.getInstalledCapacity()).toString();
- holder.capacityTv.setText(capacity);
+ holder.capacityTv.setText(HdlCommonLogic.convertDoubleValue(houseIdBean.getInstalledCapacity(), UnitType.kWp));
+ holder.capacity_kwp_unit.setText(HdlCommonLogic.convertKWPUnit(houseIdBean.getInstalledCapacity()));
+
//鍙戠數鍔熺巼
- holder.power_value_tv.setText(HdlCommonLogic.convertDoubleValue(houseIdBean.getPower()));
- holder.power_kw_unit.setText(HdlCommonLogic.convertUnit(houseIdBean.getPower(), UnitType.kW));
+ holder.power_value_tv.setText(HdlCommonLogic.convertDoubleValue(houseIdBean.getPower(), UnitType.kW));
+ holder.power_kw_unit.setText(HdlCommonLogic.convertKWUnit(houseIdBean.getPower()));
//褰撴棩鍙戠數閲�
- holder.day_value_tv.setText(HdlCommonLogic.convertDoubleValue(houseIdBean.getTodayElectricity()));
- holder.day_kwh_unit.setText(HdlCommonLogic.convertUnit(houseIdBean.getTodayElectricity(), UnitType.kWh));
+ holder.day_value_tv.setText(HdlCommonLogic.convertDoubleValue(houseIdBean.getTodayElectricity(), UnitType.kWh));
+ holder.day_kwh_unit.setText(HdlCommonLogic.convertKWHUnit(houseIdBean.getTodayElectricity()));
//鐢垫睜瀹归噺
- holder.month_value_tv.setText(HdlCommonLogic.convertDoubleValue(houseIdBean.getBatteryCapacity()));
- holder.month_kwh_unit.setText(HdlCommonLogic.convertUnit(houseIdBean.getBatteryCapacity(), UnitType.kWh));
+ holder.month_value_tv.setText(HdlCommonLogic.convertDoubleValue(houseIdBean.getBatteryCapacity(), UnitType.kWh));
+ holder.month_kwh_unit.setText(HdlCommonLogic.convertKWHUnit(houseIdBean.getBatteryCapacity()));
holder.plant_details_location_tv.setText(houseIdBean.getHomeAddress());
holder.item_parent_rl.setTag(position);
@@ -219,6 +220,7 @@
public ImageView homeIconIv;//浣忓畢鍥剧墖
public TextView homeNameTv;//浣忓畢鍚嶇О
public TextView capacityTv;//瑁呮満瀹归噺
+ public TextView capacity_kwp_unit;//瑁呮満瀹归噺鍗曚綅
public TextView power_value_tv;//鍙戠數鍔熺巼
public TextView power_kw_unit;//鍙戠數鍔熺巼鍗曚綅
public TextView day_value_tv;//褰撴棩鍙戠數閲�
@@ -237,6 +239,7 @@
homeIconIv = itemView.findViewById(R.id.device_details_image_iv);
homeNameTv = itemView.findViewById(R.id.device_details_name_tv);
capacityTv = itemView.findViewById(R.id.device_details_value_tv);
+ capacity_kwp_unit = itemView.findViewById(R.id.capacity_kwp_unit);
power_value_tv = itemView.findViewById(R.id.power_value_tv);
power_kw_unit = itemView.findViewById(R.id.power_kw_unit);
day_value_tv = itemView.findViewById(R.id.day_value_tv);
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
index d576529..17e4a36 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
@@ -535,11 +535,13 @@
if (dataOverBean == null) {
return;
}
- String capacityValue = HdlCommonLogic.divideByOneThousandAndFormat(dataOverBean.getInstalledCapacity()).toString();
+
+ String capacityValue = HdlCommonLogic.convertDoubleValue(dataOverBean.getInstalledCapacity(), UnitType.kWp);
viewBinding.infoRl1Text1Tv.setText(capacityValue);
viewBinding.kwpUnit.setText(HdlCommonLogic.convertKWPUnit(dataOverBean.getInstalledCapacity()));
- viewBinding.infoRl1Text3Tv.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getPower()));
+ viewBinding.infoRl1Text3Tv.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getPower(), UnitType.kW));
+ viewBinding.kwUnit.setText(HdlCommonLogic.convertKWUnit(dataOverBean.getPower()));
// String str = dataOverBean.getPowerRatio() + "%";
// int startIndex = str.lastIndexOf("%");
// int endIndex = str.lastIndexOf("%") + 1;
@@ -567,14 +569,14 @@
} catch (Exception ignored) {
}
- viewBinding.day.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getTodayElectricity()));
- viewBinding.dayUnit.setText(HdlCommonLogic.convertUnit(dataOverBean.getTodayElectricity(), UnitType.kWh));
- viewBinding.month.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getMonthElectricity()));
- viewBinding.monthUnit.setText(HdlCommonLogic.convertUnit(dataOverBean.getMonthElectricity(), UnitType.kWh));
- viewBinding.year.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getYearElectricity()));
- viewBinding.yearUnit.setText(HdlCommonLogic.convertUnit(dataOverBean.getYearElectricity(), UnitType.kWh));
- viewBinding.Total.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getTotalElectricity()));
- viewBinding.TotalUnit.setText(HdlCommonLogic.convertUnit(dataOverBean.getTotalElectricity(), UnitType.kWh));
+ viewBinding.day.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getTodayElectricity(), UnitType.kWh));
+ viewBinding.dayUnit.setText(HdlCommonLogic.convertKWHUnit(dataOverBean.getTodayElectricity()));
+ viewBinding.month.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getMonthElectricity(), UnitType.kWh));
+ viewBinding.monthUnit.setText(HdlCommonLogic.convertKWHUnit(dataOverBean.getMonthElectricity()));
+ viewBinding.year.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getYearElectricity(), UnitType.kWh));
+ viewBinding.yearUnit.setText(HdlCommonLogic.convertKWHUnit(dataOverBean.getYearElectricity()));
+ viewBinding.Total.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getTotalElectricity(), UnitType.kWh));
+ viewBinding.TotalUnit.setText(HdlCommonLogic.convertKWHUnit(dataOverBean.getTotalElectricity()));
}
});
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/me/AsRegardsActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/me/AsRegardsActivity.java
index faf6411..b1a6ae1 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/me/AsRegardsActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/me/AsRegardsActivity.java
@@ -4,6 +4,8 @@
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
import android.os.Bundle;
import android.view.View;
@@ -19,7 +21,7 @@
import com.hdl.photovoltaic.other.HdlCommonLogic;
import com.hdl.photovoltaic.other.HdlThreadLogic;
import com.hdl.photovoltaic.widget.FlashingBoxDialog;
-import com.hdl.photovoltaic.widget.apkwgtupload.ApkDownLoadService;
+import com.hdl.photovoltaic.widget.FlashingIconBoxDialog;
import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
import com.hdl.photovoltaic.widget.UpdateConfirmationCancelDialog;
@@ -132,6 +134,7 @@
private void initView() {
viewBinding.toolbarTopRl.topBarView.setBackgroundColor(getColor(R.color.text_00000000));
+ viewBinding.asRegardsVersionUpdatingRl.setVisibility(View.GONE);
viewBinding.toolbarTopRl.topTitleTv.setText(R.string.me_regard);
viewBinding.toolbarTopRl.topBackLl.setVisibility(View.VISIBLE);
String versionsStr = _mActivity.getResources().getString(R.string.app_version_number) + " " + AppConfigManage.getVersionName();
@@ -165,11 +168,24 @@
updateConfirmationCancelDialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() {
@Override
public void Confirm() {
- Intent intent = new Intent(_mActivity, ApkDownLoadService.class);
- intent.putExtra("updateUrl", mNewVersionBean.getPackageUrl());
- intent.putExtra("downLoadName", HdlAppUpdateLogic.getInstance().getApkFileName());
- intent.putExtra("downLoadType", "0");
- _mActivity.startService(intent);
+ FlashingBoxDialog flashingBoxDialog = new FlashingBoxDialog(_mActivity, 1500);
+ flashingBoxDialog.setContent(getString(R.string.loading_not_supported));
+ flashingBoxDialog.show();
+// try {
+// PackageManager packageManager = getPackageManager();
+// PackageInfo packageInfo = packageManager.getPackageInfo("com.android.vending", 0);
+// String versionName = packageInfo.versionName; // 鑾峰彇鐗堟湰鍙�
+// int versionCode = packageInfo.versionCode; // 鑾峰彇鐗堟湰浠g爜
+// // 鍦ㄦ澶勫鐞嗙増鏈俊鎭�
+// } catch (PackageManager.NameNotFoundException e) {
+// e.printStackTrace();
+// // 澶勭悊寮傚父锛屼緥濡傝胺姝孭lay鍟嗗簵搴旂敤鏈畨瑁�
+// }
+//
+// String packageName = "com.hdl.photovoltaic"; // 鏇挎崲涓轰綘鎯宠烦杞埌鐨勫簲鐢ㄧ殑鍖呭悕
+// Intent intent = new Intent(Intent.ACTION_VIEW);
+// intent.setData(Uri.parse("market://details?id=" + packageName));
+// startActivity(intent);
updateConfirmationCancelDialog.dismiss();
}
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/me/CPersonalDataActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/me/CPersonalDataActivity.java
index 638eab9..5634ba5 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/me/CPersonalDataActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/me/CPersonalDataActivity.java
@@ -128,11 +128,11 @@
// }, true);
} else {
// 鏈巿鏉� 濡傛灉搴旂敤绋嬪簭娌℃湁鎵�闇�鐨勬潈闄愶紝鍒欐樉绀鸿В閲婅鏄�
- PermissionExplanationDialog.getInstance().showPortConflictPdDialog(_mActivity, getString(R.string.camera_storage_instructions), getString(R.string.camera_storage_purpose));
+// PermissionExplanationDialog.getInstance().showPortConflictPdDialog(_mActivity, getString(R.string.camera_storage_instructions), getString(R.string.camera_storage_purpose));
PermissionUtils.requestPermissionsResultCallback(_mActivity, Manifest.permission.WRITE_EXTERNAL_STORAGE, new PermissionUtils.PermissionState() {
@Override
public void Success(int value) {
- PermissionExplanationDialog.getInstance().dismiss();
+// PermissionExplanationDialog.getInstance().dismiss();
if (value == PermissionUtils.STATUS_REFUSE_PERMANENT | value == PermissionUtils.STATUS_REFUSE) {
// HdlThreadLogic.toast(_mActivity, R.string.permission_open);
return;
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/newC/PowerStationsListEdit.java b/app/src/main/java/com/hdl/photovoltaic/ui/newC/PowerStationsListEdit.java
index efa0636..2d96976 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/newC/PowerStationsListEdit.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/newC/PowerStationsListEdit.java
@@ -134,11 +134,11 @@
public void onClick(View v) {
// 鏈巿鏉� 濡傛灉搴旂敤绋嬪簭娌℃湁鎵�闇�鐨勬潈闄愶紝鍒欐樉绀鸿В閲婅鏄�
- PermissionExplanationDialog.getInstance().showPortConflictPdDialog(_mActivity, getString(R.string.camera_storage_instructions), getString(R.string.camera_storage_purpose));
+// 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();
+// PermissionExplanationDialog.getInstance().dismiss();
if (value == PermissionUtils.STATUS_REFUSE_PERMANENT | value == PermissionUtils.STATUS_REFUSE) {
// HdlThreadLogic.toast(_mActivity, R.string.permission_open);
return;
diff --git a/app/src/main/java/com/hdl/photovoltaic/utils/SharedPreUtils.java b/app/src/main/java/com/hdl/photovoltaic/utils/SharedPreUtils.java
index c459b9a..815357a 100644
--- a/app/src/main/java/com/hdl/photovoltaic/utils/SharedPreUtils.java
+++ b/app/src/main/java/com/hdl/photovoltaic/utils/SharedPreUtils.java
@@ -5,7 +5,9 @@
import com.hdl.photovoltaic.HDLApp;
-
+/**
+ * 杞婚噺绾у偍瀛�
+ */
public class SharedPreUtils {
private static final String FILE_NAME = "MyData";
diff --git a/app/src/main/java/com/hdl/photovoltaic/widget/apkwgtupload/AndroidPermissionActivity.java b/app/src/main/java/com/hdl/photovoltaic/widget/apkwgtupload/AndroidPermissionActivity.java
deleted file mode 100644
index e0294f4..0000000
--- a/app/src/main/java/com/hdl/photovoltaic/widget/apkwgtupload/AndroidPermissionActivity.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package com.hdl.photovoltaic.widget.apkwgtupload;
-
-import android.Manifest;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.provider.Settings;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.RequiresApi;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.core.app.ActivityCompat;
-
-import com.hdl.photovoltaic.HDLApp;
-import com.hdl.photovoltaic.R;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Author: zoro
- * Date: 2021/5/25
- * Description: This is AndroidOPermissionActivity
- */
-
-public class AndroidPermissionActivity extends AppCompatActivity {
- public static final int INSTALL_PACKAGES_REQUESTCODE = 1;
- private AlertDialog mAlertDialog;
- public static AppDownloadManager.AndroidOInstallPermissionListener sListener;
-
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- // 寮圭獥
- if (Build.VERSION.SDK_INT >= 26) {
- ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.REQUEST_INSTALL_PACKAGES}, INSTALL_PACKAGES_REQUESTCODE);
- } else {
- finish();
- }
-
-
- }
-
- @RequiresApi(api = Build.VERSION_CODES.O)
- @Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
- super.onRequestPermissionsResult(requestCode, permissions, grantResults);
- switch (requestCode) {
- case INSTALL_PACKAGES_REQUESTCODE:
- if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- if (sListener != null) {
- sListener.permissionSuccess();
- finish();
- }
- } else {
- showDialog();
- }
- break;
-
- }
- }
-
- private void showDialog() {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(R.string.app_name);
- builder.setMessage(HDLApp.getInstance().getAppLocaleContext().getString(R.string.app_update_content));
- builder.setPositiveButton(HDLApp.getInstance().getAppLocaleContext().getString(R.string.me_set), new DialogInterface.OnClickListener() {
- @RequiresApi(api = Build.VERSION_CODES.O)
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- startInstallPermissionSettingActivity();
- mAlertDialog.dismiss();
- }
- });
- builder.setNegativeButton(HDLApp.getInstance().getAppLocaleContext().getString(R.string.loading_cancel), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- if (sListener != null) {
- sListener.permissionFail();
- }
- mAlertDialog.dismiss();
- finish();
- }
- });
- builder.setCancelable(false);
- mAlertDialog = builder.create();
- mAlertDialog.show();
- }
-
- @RequiresApi(api = Build.VERSION_CODES.O)
- private void startInstallPermissionSettingActivity() {
- //娉ㄦ剰杩欎釜鏄�8.0鏂癆PI
- Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:" + getPackageName()));
- startActivityForResult(intent, 1);
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (requestCode == 1 && resultCode == RESULT_OK) {
- // 鎺堟潈鎴愬姛
- if (sListener != null) {
- sListener.permissionSuccess();
- }
- } else {
- // 鎺堟潈澶辫触
- if (sListener != null) {
- sListener.permissionFail();
- }
- }
- finish();
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- sListener = null;
- }
-}
diff --git a/app/src/main/java/com/hdl/photovoltaic/widget/apkwgtupload/ApkDownLoadService.java b/app/src/main/java/com/hdl/photovoltaic/widget/apkwgtupload/ApkDownLoadService.java
deleted file mode 100644
index 67c0287..0000000
--- a/app/src/main/java/com/hdl/photovoltaic/widget/apkwgtupload/ApkDownLoadService.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package com.hdl.photovoltaic.widget.apkwgtupload;
-
-import android.app.Notification;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
-import android.app.Service;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Build;
-import android.os.IBinder;
-
-import androidx.core.app.NotificationCompat;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Created by Zoro
- * Created on 2021/5/25
- * description:
- */
-public class ApkDownLoadService extends Service {
-
-
- private Context context;
-
- /**
- * apk鏇存柊绠$悊绫�
- */
- private AppDownloadManager manager;
-
- /**
- * 鏇存柊Url
- */
- private String updateUrl;
-
- /**
- * 涓嬭浇鏂囦欢鍚�
- */
- private String downLoadName;
-
- /**
- * 涓嬭浇鏂囦欢绫诲瀷 1锛歸gt 0锛歛pk
- */
- private String downLoadType;
-
- @Override
- public void onCreate() {
- super.onCreate();
- context = this;
- manager = new AppDownloadManager(context);
- startForeground(System.identityHashCode(this), getNotification());
- if (null != manager) {
- manager.resume();
- }
- }
-
- private Notification getNotification() {
- final String CHANNEL_ID = "default";
- final String CHANNEL_NAME = "Default Channel";
- NotificationManager notificationManager = (NotificationManager) getBaseContext().getSystemService(NOTIFICATION_SERVICE);
-
- //閫傞厤瀹夊崜8.0鐨勬秷鎭笭閬�
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- if (notificationManager != null) {
- NotificationChannel channel = new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH);
- notificationManager.createNotificationChannel(channel);
- }
- }
-
- NotificationCompat.Builder notification =
- new NotificationCompat.Builder(getBaseContext(), CHANNEL_ID);
-
- notification.setAutoCancel(true)
- .setDefaults(Notification.DEFAULT_ALL);
-
- return notification.build();
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
-// App.getApp().setShowUpdate(true);
- updateUrl = intent.getStringExtra("updateUrl");
- downLoadName = intent.getStringExtra("downLoadName");
- downLoadType = intent.getStringExtra("downLoadType");
- if (null != updateUrl) {
- if (null != manager) {
- manager.downloadApk(updateUrl, downLoadName, "update...", downLoadName, downLoadType);
- }
- }
- return super.onStartCommand(intent, flags, startId);
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- if (null != manager) {
- manager.onPause();
- }
- }
-
- @Nullable
- @Override
- public IBinder onBind(Intent intent) {
- return null;
- }
-}
diff --git a/app/src/main/java/com/hdl/photovoltaic/widget/apkwgtupload/AppDownloadManager.java b/app/src/main/java/com/hdl/photovoltaic/widget/apkwgtupload/AppDownloadManager.java
deleted file mode 100644
index 0fb6fc8..0000000
--- a/app/src/main/java/com/hdl/photovoltaic/widget/apkwgtupload/AppDownloadManager.java
+++ /dev/null
@@ -1,296 +0,0 @@
-package com.hdl.photovoltaic.widget.apkwgtupload;
-
-import android.app.Activity;
-import android.app.DownloadManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.database.ContentObserver;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Environment;
-import android.os.Handler;
-import android.text.TextUtils;
-import android.util.Log;
-
-import androidx.core.content.FileProvider;
-
-import com.hdl.photovoltaic.HDLApp;
-import com.hdl.photovoltaic.R;
-import com.hdl.photovoltaic.other.HdlAppUpdateLogic;
-import com.hdl.photovoltaic.other.HdlThreadLogic;
-import com.hdl.photovoltaic.uni.HDLUniMP;
-import com.hdl.photovoltaic.uni.HDLUniMPSDKManager;
-
-import java.io.File;
-import java.lang.ref.WeakReference;
-import java.util.Objects;
-
-/**
- * Author: zoro
- * Date: 2021/05/25
- * Description: 闇�瑕佹洿鏀笷ileProvider.getUriForFile
- */
-
-public class AppDownloadManager {
- public static final String TAG = "AppDownloadManager";
- private WeakReference<Context> weakReference;
- private DownloadManager mDownloadManager;
- private DownloadChangeObserver mDownLoadChangeObserver;
- private DownloadReceiver mDownloadReceiver;
- private long mReqId;
- private OnUpdateListener mUpdateListener;
-
- private boolean downloading = false;//姝e湪涓嬭浇
-
- private boolean downSuccess = false;//涓嬭浇鎴愬姛
-
- private String downLoadType;
-
-
- public AppDownloadManager(Context context) {
- weakReference = new WeakReference<Context>(context);
- mDownloadManager = (DownloadManager) weakReference.get().getSystemService(Context.DOWNLOAD_SERVICE);
- mDownLoadChangeObserver = new DownloadChangeObserver(new Handler());
- mDownloadReceiver = new DownloadReceiver();
- }
-
- public void setUpdateListener(OnUpdateListener mUpdateListener) {
- this.mUpdateListener = mUpdateListener;
- }
-
- /**
- * @param apkUrl 涓嬭浇鏂囦欢璺緞
- * @param title 涓嬭浇鏍囬
- * @param desc 涓嬭浇鎻忚堪
- * @param fileName 涓嬭浇鏂囦欢鍚�
- * @param downLoadType 涓嬭浇绫诲瀷 1锛歸gt 0锛歛pk
- */
- public void downloadApk(String apkUrl, String title, String desc, String fileName, String downLoadType) {
- if (downloading) {
- return;
- }
- downloading = true;
- this.downLoadType = downLoadType;
- // fix bug : 瑁呬笉浜嗘柊鐗堟湰锛屽湪涓嬭浇涔嬪墠搴旇鍒犻櫎宸叉湁鏂囦欢
- File apkFile = new File(weakReference.get().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), fileName);
- if (apkFile.exists()) {
- apkFile.delete();
- }
- DownloadManager.Request request = new DownloadManager.Request(Uri.parse(apkUrl));
- if ("0".equals(downLoadType)) {
- //璁剧疆title
- request.setTitle(title);
- // 璁剧疆鎻忚堪
- request.setDescription(desc);
- // 瀹屾垚鍚庢樉绀洪�氱煡鏍�
- request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
- request.setDestinationInExternalFilesDir(weakReference.get(), Environment.DIRECTORY_DOWNLOADS, HdlAppUpdateLogic.getInstance().getApkFileName());
- request.setMimeType("application/vnd.android.package-archive");
- } else {
- request.setDestinationInExternalFilesDir(weakReference.get(), Environment.DIRECTORY_DOWNLOADS, HDLUniMP.UNI_APP_ID + ".wgt");
- request.setMimeType("application/vnd.android.package-archive");
- }
- mReqId = mDownloadManager.enqueue(request);
- }
-
- /**
- * 鍙栨秷涓嬭浇
- */
- public void cancel() {
- mDownloadManager.remove(mReqId);
- }
-
- /**
- * 瀵瑰簲 {@link Activity }
- */
- public void resume() {
- //璁剧疆鐩戝惉Uri.parse("content://downloads/my_downloads")
- weakReference.get().getContentResolver().registerContentObserver(Uri.parse("content://downloads/my_downloads"), true,
- mDownLoadChangeObserver);
-
- IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction(DownloadManager.ACTION_DOWNLOAD_COMPLETE);
- // 娉ㄥ唽骞挎挱锛岀洃鍚珹PK鏄惁涓嬭浇瀹屾垚
- weakReference.get().registerReceiver(mDownloadReceiver, intentFilter);
- }
-
- /**
- *
- */
- public void onPause() {
- weakReference.get().getContentResolver().unregisterContentObserver(mDownLoadChangeObserver);
- weakReference.get().unregisterReceiver(mDownloadReceiver);
- }
-
- private void updateView() {
- int[] bytesAndStatus = new int[]{0, 0, 0};
- DownloadManager.Query query = new DownloadManager.Query().setFilterById(mReqId);
- Cursor c = null;
- try {
- c = mDownloadManager.query(query);
- if (c != null && c.moveToFirst()) {
- //宸茬粡涓嬭浇鐨勫瓧鑺傛暟
- bytesAndStatus[0] = c.getInt(c.getColumnIndexOrThrow(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
- //鎬婚渶涓嬭浇鐨勫瓧鑺傛暟
- bytesAndStatus[1] = c.getInt(c.getColumnIndexOrThrow(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));
- //鐘舵�佹墍鍦ㄧ殑鍒楃储寮�
- bytesAndStatus[2] = c.getInt(c.getColumnIndex(DownloadManager.COLUMN_STATUS));
- }
- } finally {
- if (c != null) {
- c.close();
- }
- }
- if (mUpdateListener != null) {
- mUpdateListener.update(bytesAndStatus[0], bytesAndStatus[1]);
- }
- if (bytesAndStatus[0] == bytesAndStatus[1]) {
- downSuccess = true;
- Log.i(TAG, "涓嬭浇杩涘害锛氬畬鎴�");
- }
- long value = bytesAndStatus[0] * 100L / bytesAndStatus[1];
- Log.i(TAG, "涓嬭浇杩涘害锛�" + value + "");
- }
-
- class DownloadChangeObserver extends ContentObserver {
-
- /**
- * Creates a content observer.
- *
- * @param handler The handler to run {@link #onChange} on, or null if none.
- */
- public DownloadChangeObserver(Handler handler) {
- super(handler);
- }
-
- @Override
- public void onChange(boolean selfChange) {
- super.onChange(selfChange);
- updateView();
- }
- }
-
- class DownloadReceiver extends BroadcastReceiver {
-
- @Override
- public void onReceive(final Context context, final Intent intent) {
- if (downSuccess) {
- if ("0".equals(downLoadType)) {
- //涓嬭浇鎴愬姛浜嗗紑濮嬪畨瑁�
- downloading = false;
- boolean haveInstallPermission;
- // 鍏煎Android 8.0
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- //鍏堣幏鍙栨槸鍚︽湁瀹夎鏈煡鏉ユ簮搴旂敤鐨勬潈闄�
- haveInstallPermission = context.getPackageManager().canRequestPackageInstalls();
- if (!haveInstallPermission) {//娌℃湁鏉冮檺
- // 寮圭獥锛屽苟鍘昏缃〉闈㈡巿鏉�
- final AndroidOInstallPermissionListener listener = new AndroidOInstallPermissionListener() {
- @Override
- public void permissionSuccess() {
- installApk(context, intent);
- }
-
- @Override
- public void permissionFail() {
- HdlThreadLogic.toast(HDLApp.getInstance(), HDLApp.getInstance().getAppLocaleContext().getString(R.string.app_update_fail));
- }
- };
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- AndroidPermissionActivity.sListener = listener;
- Intent intentPermission = new Intent(context, AndroidPermissionActivity.class);
- intentPermission.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(intentPermission);
- }
- }, 2000);
-
- } else {
- installApk(context, intent);
- }
- } else {
- installApk(context, intent);
- }
- } else {
- //閲婃斁涓嬭浇鐨剋gt鍖�
- HDLUniMPSDKManager.getInstance().hdlReleaseAppResourceToRunPathWithAppid(HDLUniMP.UNI_APP_ID);
- }
- }
- }
- }
-
-
- /**
- * @param context -
- * @param intent -
- */
- private void installApk(Context context, Intent intent) {
- long completeDownLoadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
- Uri uri;
- Intent intentInstall = new Intent();
- intentInstall.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intentInstall.setAction(Intent.ACTION_VIEW);
-
- if (completeDownLoadId == mReqId) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { // 6.0浠ヤ笅
- uri = mDownloadManager.getUriForDownloadedFile(completeDownLoadId);
- if (null == uri) {
- File apkFile = new File(weakReference.get().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), HdlAppUpdateLogic.getInstance().getApkFileName());
- if (apkFile.exists()) {
- uri = Uri.fromFile(apkFile);
- }
- }
- } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { // 6.0 - 7.0
- File apkFile = queryDownloadedApk(context, completeDownLoadId);
- uri = Uri.fromFile(apkFile);
- } else { // Android 7.0 浠ヤ笂
- uri = FileProvider.getUriForFile(context,
- "com.hdl.photovoltaic.fileProvider",
- new File(context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), HdlAppUpdateLogic.getInstance().getApkFileName()));
- intentInstall.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
- }
- // 瀹夎搴旂敤
- if (null != uri) {
- intentInstall.setDataAndType(uri, "application/vnd.android.package-archive");
- context.startActivity(intentInstall);
- }
- }
- }
-
- //閫氳繃downLoadId鏌ヨ涓嬭浇鐨刟pk锛岃В鍐�6.0浠ュ悗瀹夎鐨勯棶棰�
- public static File queryDownloadedApk(Context context, long downloadId) {
- File targetApkFile = null;
- DownloadManager downloader = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
-
- if (downloadId != -1) {
- DownloadManager.Query query = new DownloadManager.Query();
- query.setFilterById(downloadId);
- query.setFilterByStatus(DownloadManager.STATUS_SUCCESSFUL);
- Cursor cur = downloader.query(query);
- if (cur != null) {
- if (cur.moveToFirst()) {
- String uriString = cur.getString(cur.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));
- if (!TextUtils.isEmpty(uriString)) {
- targetApkFile = new File(Objects.requireNonNull(Uri.parse(uriString).getPath()));
- }
- }
- cur.close();
- }
- }
- return targetApkFile;
- }
-
- public interface OnUpdateListener {
- void update(int currentByte, int totalByte);
- }
-
- public interface AndroidOInstallPermissionListener {
- void permissionSuccess();
-
- void permissionFail();
- }
-}
diff --git a/app/src/main/java/com/hdl/photovoltaic/widget/popupview/CameraAlbumPopWindow.java b/app/src/main/java/com/hdl/photovoltaic/widget/popupview/CameraAlbumPopWindow.java
index cfcdf76..7ecee77 100644
--- a/app/src/main/java/com/hdl/photovoltaic/widget/popupview/CameraAlbumPopWindow.java
+++ b/app/src/main/java/com/hdl/photovoltaic/widget/popupview/CameraAlbumPopWindow.java
@@ -104,11 +104,11 @@
private void checkPermission_After(final Activity context, final int tag) {
String permission = Manifest.permission.CAMERA;
// 鏈巿鏉� 濡傛灉搴旂敤绋嬪簭娌℃湁鎵�闇�鐨勬潈闄愶紝鍒欐樉绀鸿В閲婅鏄�
- PermissionExplanationDialog.getInstance().showPortConflictPdDialog(context, context.getString(R.string.camera_storage_instructions), context.getString(R.string.camera_storage_purpose));
+// PermissionExplanationDialog.getInstance().showPortConflictPdDialog(context, context.getString(R.string.camera_storage_instructions), context.getString(R.string.camera_storage_purpose));
int status = PermissionUtils.getPermissionState(context, permission);
switch (status) {
case PermissionUtils.STATUS_SUCCESS:
- PermissionExplanationDialog.getInstance().dismiss();
+// PermissionExplanationDialog.getInstance().dismiss();
dismiss();
if (0 == tag) {
take_photo();
diff --git a/app/src/main/res/layout/activity_as_regards.xml b/app/src/main/res/layout/activity_as_regards.xml
index 56e573b..1df3740 100644
--- a/app/src/main/res/layout/activity_as_regards.xml
+++ b/app/src/main/res/layout/activity_as_regards.xml
@@ -81,16 +81,26 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/qr_code_box" />
+
+
+ <View
+ android:id="@+id/line"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_29"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/as_regards_download_app_tv" />
+
+
<!--鐗堟湰鏇存柊-->
<RelativeLayout
android:id="@+id/as_regards_version_updating_rl"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_57"
- android:layout_marginTop="@dimen/dp_29"
android:background="@color/text_FF1C1C1E"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/as_regards_download_app_tv">
+ app:layout_constraintTop_toBottomOf="@+id/line">
<TextView
android:id="@+id/as_regards_version_updating_tv"
diff --git a/app/src/main/res/layout/dialog_confirm_cancel.xml b/app/src/main/res/layout/dialog_confirm_cancel.xml
index ecc307d..23e58c6 100644
--- a/app/src/main/res/layout/dialog_confirm_cancel.xml
+++ b/app/src/main/res/layout/dialog_confirm_cancel.xml
@@ -12,8 +12,8 @@
android:layout_marginTop="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_48"
android:layout_marginBottom="@dimen/dp_20"
- android:paddingBottom="@dimen/dp_24"
android:background="@drawable/dalog_bj_ff222222"
+ android:paddingBottom="@dimen/dp_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
diff --git a/app/src/main/res/layout/item_plant_details.xml b/app/src/main/res/layout/item_plant_details.xml
index 2c0de7f..e20fc6c 100644
--- a/app/src/main/res/layout/item_plant_details.xml
+++ b/app/src/main/res/layout/item_plant_details.xml
@@ -86,7 +86,7 @@
android:textSize="@dimen/text_14" />
<TextView
- android:id="@+id/kwp_unit"
+ android:id="@+id/capacity_kwp_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/device_details_value_tv"
diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml
index a378ae5..add0cd1 100644
--- a/app/src/main/res/values-en/strings.xml
+++ b/app/src/main/res/values-en/strings.xml
@@ -205,7 +205,7 @@
<string name="minute">minutes</string>
<string name="event"> Event</string>
<string name="The_gateway_cannot_be_found_locally">Unable to find gateway under local network</string>
- <string name="welcome_to_the_smart_energy_app">Welcome to the Smart Energy APP</string>
+ <string name="welcome_to_the_smart_energy_app">Welcome to the Xenterra Solar APP</string>
<string name="no_permissions_unable_to_receive_push">Unable to receive push notification If the permission is not enabled, you cannot receive push information</string>
<string name="go_to_settings">Go to Settings</string>
<string name="system_positioning_switch">You need to turn on the system positioning switch. Otherwise, the system can obtain the position information</string>
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index 7102bb9..bba772b 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -203,7 +203,7 @@
<string name="minute">鍒嗛挓</string>
<string name="event">浜嬩欢</string>
<string name="The_gateway_cannot_be_found_locally">鏈湴鎵句笉鍒扮綉鍏�</string>
- <string name="welcome_to_the_smart_energy_app">娆㈣繋鎵撳紑鏅烘収鑳芥簮APP</string>
+ <string name="welcome_to_the_smart_energy_app">娆㈣繋鎵撳紑鏂扮壒閿愯兘APP</string>
<string name="no_permissions_unable_to_receive_push">閫氱煡鏉冮檺娌″紑鍚紝灏嗘棤娉曟敹鍒版帹閫佷俊鎭��</string>
<string name="go_to_settings">鍓嶅線璁剧疆</string>
<string name="system_positioning_switch">闇�瑕佹墦寮�绯荤粺瀹氫綅寮�鍏筹紝鍚﹀垯鏃犳硶鑾峰彇浣嶇疆淇℃伅銆�</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index eb4bf5a..792eb88 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -205,7 +205,7 @@
<string name="minute">minutes</string>
<string name="event"> Event</string>
<string name="The_gateway_cannot_be_found_locally">Unable to find gateway under local network</string>
- <string name="welcome_to_the_smart_energy_app">Welcome to the Smart Energy APP</string>
+ <string name="welcome_to_the_smart_energy_app">Welcome to the Xenterra Solar APP</string>
<string name="no_permissions_unable_to_receive_push">Unable to receive push notification If the permission is not enabled, you cannot receive push information</string>
<string name="go_to_settings">Go to Settings</string>
<string name="system_positioning_switch">You need to turn on the system positioning switch. Otherwise, the system can obtain the position information</string>
--
Gitblit v1.8.0