From f7c38847b8e00c84c30e51a92c03071d3e9a9da8 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 14 五月 2024 09:08:57 +0800
Subject: [PATCH] 2024年05月14日09:08:49
---
app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java | 3
app/src/main/res/layout/fragment_home_page.xml | 151 ++++++++++++++++++++++++++++++-------
app/src/main/java/com/hdl/photovoltaic/ui/test/TestMainActivity.java | 2
app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java | 6 -
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListEditActivity.java | 2
app/src/main/res/layout/activity_my_power_station.xml | 9 +-
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | 28 ++++++
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java | 2
app/build.gradle | 1
app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java | 4
10 files changed, 161 insertions(+), 47 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index a01b02a..56f9234 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -146,6 +146,7 @@
//灞忓箷閫傞厤搴�
implementation 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1'
+
//鍥剧墖鍔犺浇搴�
implementation 'com.github.bumptech.glide:glide:4.13.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
index ab7d37a..0a1e88a 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -901,9 +901,9 @@
/**
* 鍒濆鍖栭�嗗彉鍣�
*
- * @param mac 缃戝叧mac
+ * @param mac 閫嗗彉鍣╩ac
*/
- public void initializeGateway(String mac, LinkCallBack<Boolean> linkCallBack) {
+ public void initializeInverter(String mac, LinkCallBack<Boolean> linkCallBack) {
String requestUrl = TopicApi.GATEWAY_INITIALIZE_REMOTE;
JsonObject jObject = new JsonObject();
jObject.addProperty("device_mac", mac);
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
index 03200e1..d422b52 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -237,7 +237,6 @@
case HDLUniMP.UNI_EVENT_REPLY_DEVICE_TIME: {
this.uniGetInverterTime(mode_type, data, callback);
}
-
break;
//閫嗗彉鍣ㄦ椂闂寸紪杈�
case HDLUniMP.UNI_EVENT_REPLY_DEVICE_TIME_EDIT: {
@@ -267,6 +266,11 @@
//鑾峰彇鏈鐞�/鏈娑堟伅鏁伴噺
case HDLUniMP.UNI_EVENT_REPLY_DEVICE_MESSAGE_NUMBER: {
this.uniGetMessageNumber(mode_type, data, callback);
+ }
+ break;
+ //鍒濆鍖栭�嗗彉鍣�
+ case HDLUniMP.UNI_EVENT_REPLY_DEVICE_INITIALIZEINVERTER: {
+ this.setInitializeGateway(mode_type, data, callback);
}
break;
@@ -1723,6 +1727,28 @@
).start();
}
+ /**
+ * 鍒濆鍖栦綘閫嗗彉鍣�
+ *
+ * @param type 璐﹀彿
+ * @param data uni璇锋眰鏁版嵁
+ * @param callback uni鍥炶皟
+ */
+ public void setInitializeGateway(String type, Object data, DCUniMPJSCallback callback) {
+ String mac = getKeyValue("mac", getKeyValue("data", data));
+ HdlDeviceLogic.getInstance().initializeInverter(mac, new LinkCallBack<Boolean>() {
+ @Override
+ public void onSuccess(Boolean obj) {
+ uniCallbackData(type, obj, callback);
+ }
+
+ @Override
+ public void onError(HDLLinkException e) {
+ uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+ }
+ });
+ }
+
/**
* 鍙戦�乵odbus鍗忚鏁版嵁
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
index 97eea5a..97db0db 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
@@ -5,10 +5,7 @@
import android.os.Process;
import android.os.SystemClock;
import android.text.TextUtils;
-import android.util.Log;
-
-import androidx.annotation.Nullable;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -36,8 +33,6 @@
import com.hdl.photovoltaic.uni.HDLUniMP;
import com.hdl.photovoltaic.uni.HDLUniMPSDKManager;
import com.hdl.photovoltaic.utils.AppManagerUtils;
-import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
-import com.hdl.photovoltaic.widget.ConfirmationTipDialog;
import com.hdl.sdk.link.HDLLinkLocalSdk;
import com.hdl.sdk.link.common.event.EventListener;
import com.hdl.sdk.link.core.bean.LinkResponse;
@@ -45,7 +40,6 @@
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
import com.hdl.sdk.link.core.bean.gateway.GatewayBean;
import com.hdl.sdk.link.core.config.HDLLinkConfig;
-import com.hdl.sdk.link.core.connect.HDLUdpConnect;
import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient;
import org.greenrobot.eventbus.Subscribe;
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListEditActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListEditActivity.java
index 438a6be..8564260 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListEditActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListEditActivity.java
@@ -209,7 +209,7 @@
}
for (int i = 0; i < list.size(); i++) {
GatewayBean gatewayBean = list.get(i);
- HdlDeviceLogic.getInstance().initializeGateway(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
+ HdlDeviceLogic.getInstance().initializeInverter(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
@Override
public void onSuccess(Boolean obj) {
// HdlLogLogic.print("鍒濆鍖栭�嗗彉鍣ㄦ垚鍔�-->mac:" + cloudInverterDeviceBean.getOsn(),true);
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
index c88b871..b4e83d1 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
@@ -707,7 +707,7 @@
}
for (int i = 0; i < list.size(); i++) {
GatewayBean gatewayBean = list.get(i);
- HdlDeviceLogic.getInstance().initializeGateway(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
+ HdlDeviceLogic.getInstance().initializeInverter(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
@Override
public void onSuccess(Boolean obj) {
// HdlLogLogic.print("鍒濆鍖栭�嗗彉鍣ㄦ垚鍔�-->mac:" + cloudInverterDeviceBean.getOsn(),true);
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/test/TestMainActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/test/TestMainActivity.java
index 10880f8..ff0771b 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/test/TestMainActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/test/TestMainActivity.java
@@ -291,7 +291,7 @@
public void Confirm() {
confirmationCancelDialog.dismiss();
showLoading("瑙g粦涓�...");
- HdlDeviceLogic.getInstance().initializeGateway(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
+ HdlDeviceLogic.getInstance().initializeInverter(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
@Override
public void onSuccess(Boolean obj) {
hideLoading();
diff --git a/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java b/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
index 73893f0..f08827d 100644
--- a/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
+++ b/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
@@ -51,6 +51,7 @@
public final static String UNI_EVENT_REPLY_DEVICE_Link_read_SEND = "link_property_read";//link鍗忚灞炴�ц鍙�
public final static String UNI_EVENT_REPLY_DEVICE_MESSAGE_NUMBER = "message_number";//娑堟伅鎬绘暟閲�
public final static String UNI_EVENT_REPLY_DEVICE_DELETE_OID = "delete_Oid";//鍒犻櫎璁惧oid
+ public final static String UNI_EVENT_REPLY_DEVICE_INITIALIZEINVERTER = "initializeInverter";//閲嶇疆閫嗗彉鍣�
/*********OTA妯″潡*********/
@@ -108,7 +109,7 @@
public final static String UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_USERINFO = "refresh_userinfo";//鍒锋柊鐢ㄦ埛淇℃伅
public final static String UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_TEMPERATURE = "temperature_format_changed";//鍒锋柊鍗曚綅娓╁害
public final static String UNI_EVENT_NOTIFICATION_DEVICE_REFRESH_REFRESH_UNREAD_NUMBER = "refresh_unread_messages_number";//鍒锋柊鏈娑堟伅鏁伴噺
- public final static String UNI_EVENT_NOTIFICATION_MQTT_CONNECT_SUCCESS= "mqtt_connect_success";//閫氱煡mqtt杩炴帴鎴愬姛
+ public final static String UNI_EVENT_NOTIFICATION_MQTT_CONNECT_SUCCESS = "mqtt_connect_success";//閫氱煡mqtt杩炴帴鎴愬姛
public final static String UNI_EVENT_NOTIFICATION_REMOVE_VIEW = "remove_view";//閫氱煡uni绉婚櫎鐣岄潰
public final static String UNI_EVENT_NOTIFICATION_DEVICE_ADD = "add";//璁惧娣诲姞
public final static String UNI_EVENT_NOTIFICATION_DEVICE_DEL = "del";//璁惧鍒犻櫎
diff --git a/app/src/main/res/layout/activity_my_power_station.xml b/app/src/main/res/layout/activity_my_power_station.xml
index 814c7ba..dbfaefd 100644
--- a/app/src/main/res/layout/activity_my_power_station.xml
+++ b/app/src/main/res/layout/activity_my_power_station.xml
@@ -12,7 +12,7 @@
android:id="@+id/my_home_page_fcv0"
android:name="com.hdl.photovoltaic.ui.home.HomePageFragment"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/my_power_station_bottom_ll"
@@ -21,10 +21,9 @@
app:layout_constraintTop_toTopOf="parent" />
<!--鐢电珯-Fragment-->
<androidx.fragment.app.FragmentContainerView
-
android:id="@+id/my_power_station_fcv1"
android:name="com.hdl.photovoltaic.ui.powerstation.HouseListFragment"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/my_power_station_bottom_ll"
@@ -35,7 +34,7 @@
<androidx.fragment.app.FragmentContainerView
android:id="@+id/my_message_fcv2"
android:name="com.hdl.photovoltaic.ui.message.MessageFragment"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/my_power_station_bottom_ll"
@@ -46,7 +45,7 @@
<androidx.fragment.app.FragmentContainerView
android:id="@+id/my_me_fcv3"
android:name="com.hdl.photovoltaic.ui.me.MeFragment"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/my_power_station_bottom_ll"
diff --git a/app/src/main/res/layout/fragment_home_page.xml b/app/src/main/res/layout/fragment_home_page.xml
index 97c4360..998fe5f 100644
--- a/app/src/main/res/layout/fragment_home_page.xml
+++ b/app/src/main/res/layout/fragment_home_page.xml
@@ -53,45 +53,138 @@
android:layout_marginStart="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16">
- <LinearLayout
+ <RelativeLayout
android:id="@+id/home_page_station_ll"
- android:layout_width="375dp"
+ android:layout_width="0dp"
android:layout_height="@dimen/dp_56"
- android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
- <!--鍏ㄩ儴-->
- <include
- android:id="@+id/home_page_station_all_ic"
- layout="@layout/item_station" />
- <View
- android:layout_width="15.5dp"
- android:layout_height="match_parent" />
- <!--鏁呴殰-->
- <include
- android:id="@+id/home_page_station_fault_ic"
- layout="@layout/item_station" />
+ <RelativeLayout
+ android:id="@+id/station_status_all_rl"
+ android:layout_width="74dp"
+ android:layout_height="match_parent"
+ android:background="@drawable/station_status_no_ffffff">
- <View
- android:layout_width="16dp"
- android:layout_height="match_parent" />
- <!--绂荤嚎-->
- <include
- android:id="@+id/home_page_station_offline_ic"
- layout="@layout/item_station" />
+ <TextView
+ android:id="@+id/station_status_all_tv"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_25"
+ android:layout_marginTop="7dp"
+ android:gravity="center"
+ android:text="999"
+ android:textColor="@color/text_90000000"
+ android:textSize="@dimen/text_21"
+ android:textStyle="bold" />
- <View
- android:layout_width="15.5dp"
- android:layout_height="match_parent" />
- <!--寰呮帴鍏�-->
- <include
- android:id="@+id/home_page_station_connected_ic"
- layout="@layout/item_station" />
+ <TextView
+ android:id="@+id/station_status_number_all_tv"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_17"
+ android:layout_below="@+id/station_status_all_tv"
+ android:layout_marginTop="1dp"
+ android:gravity="center"
+ android:text="state"
+ android:textColor="@color/text_40000000"
+ android:textSize="@dimen/text_14" />
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:id="@+id/station_status_faults_rl"
+ android:layout_width="74dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_toEndOf="@+id/station_status_all_rl"
+ android:background="@drawable/station_status_no_ffffff">
+
+ <TextView
+ android:id="@+id/station_status_faults_tv"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_25"
+ android:layout_marginTop="7dp"
+ android:gravity="center"
+ android:text="999"
+ android:textColor="@color/text_90000000"
+ android:textSize="@dimen/text_21"
+ android:textStyle="bold" />
+
+ <TextView
+ android:id="@+id/station_status_number_faults_tv"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_17"
+ android:layout_below="@+id/station_status_faults_tv"
+ android:layout_marginTop="1dp"
+ android:gravity="center"
+ android:text="state"
+ android:textColor="@color/text_40000000"
+ android:textSize="@dimen/text_14" />
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:id="@+id/station_status_off_rl"
+ android:layout_width="74dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_toEndOf="@+id/station_status_faults_rl"
+ android:background="@drawable/station_status_no_ffffff">
+
+ <TextView
+ android:id="@+id/station_status_off_tv"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_25"
+ android:layout_marginTop="7dp"
+ android:gravity="center"
+ android:text="999"
+ android:textColor="@color/text_90000000"
+ android:textSize="@dimen/text_21"
+ android:textStyle="bold" />
+
+ <TextView
+ android:id="@+id/station_status_number_off_tv"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_17"
+ android:layout_below="@+id/station_status_off_tv"
+ android:layout_marginTop="1dp"
+ android:gravity="center"
+ android:text="state"
+ android:textColor="@color/text_40000000"
+ android:textSize="@dimen/text_14" />
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:id="@+id/station_status_connected_rl"
+ android:layout_width="74dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_toEndOf="@+id/station_status_off_rl"
+ android:background="@drawable/station_status_no_ffffff">
+
+ <TextView
+ android:id="@+id/station_status_connected_tv"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_25"
+ android:layout_marginTop="7dp"
+ android:gravity="center"
+ android:text="999"
+ android:textColor="@color/text_90000000"
+ android:textSize="@dimen/text_21"
+ android:textStyle="bold" />
+
+ <TextView
+ android:id="@+id/station_status_number_connected_tv"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/dp_17"
+ android:layout_below="@+id/station_status_connected_tv"
+ android:layout_marginTop="1dp"
+ android:gravity="center"
+ android:text="state"
+ android:textColor="@color/text_40000000"
+ android:textSize="@dimen/text_14" />
+ </RelativeLayout>
- </LinearLayout>
+ </RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/home_page_station_info_cl"
--
Gitblit v1.8.0