From 07ccc78892b26dabc976363c874c177230f9bbcb Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期三, 07 六月 2023 21:26:57 +0800
Subject: [PATCH] 2023年06月07日21:26:48
---
app/src/main/java/com/hdl/photovoltaic/utils/AppManagerUtils.java | 6
app/src/main/java/com/hdl/photovoltaic/utils/FileUtils.java | 139 +++++++++++++++++++++++
app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java | 4
app/src/main/java/com/hdl/photovoltaic/HDLApp.java | 1
app/src/main/java/com/hdl/photovoltaic/internet/TcpClient.java | 4
.idea/misc.xml | 33 -----
app/src/main/java/com/hdl/photovoltaic/internet/UdpClient.java | 4
app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java | 4
.idea/vcs.xml | 6 +
app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java | 27 ++++
.idea/compiler.xml | 6 +
.idea/.name | 1
app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java | 54 +++++++++
app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java | 4
app/src/main/java/com/hdl/photovoltaic/base/BaseFragment.java | 13 +-
app/build.gradle | 3
16 files changed, 265 insertions(+), 44 deletions(-)
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..914a7c4
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+PhotovoltaicDebug
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..fb7f4a8
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CompilerConfiguration">
+ <bytecodeTargetLevel target="11" />
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 19f8f00..25d34a4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,36 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
- <component name="DesignSurface">
- <option name="filePathToZoomLevelMap">
- <map>
- <entry key="../../../../../layout/custom_preview.xml" value="0.22923076923076924" />
- <entry key="../../../.gradle/caches/transforms-2/files-2.1/7c2cbaa925629e10707989293f119941/jetified-zxing-android-embedded-3.4.0/res/layout/zxing_barcode_scanner.xml" value="0.20625" />
- <entry key="../../../.gradle/caches/transforms-2/files-2.1/7c2cbaa925629e10707989293f119941/jetified-zxing-android-embedded-3.4.0/res/layout/zxing_capture.xml" value="0.20625" />
- <entry key="app/src/main/res/drawable/bg_load_dialog.xml" value="0.1275" />
- <entry key="app/src/main/res/drawable/progress_small.xml" value="0.1275" />
- <entry key="app/src/main/res/drawable/progress_small1.xml" value="0.1275" />
- <entry key="app/src/main/res/layout/activity_1.xml" value="0.20625" />
- <entry key="app/src/main/res/layout/activity_123.xml" value="0.20625" />
- <entry key="app/src/main/res/layout/activity_capture.xml" value="0.20625" />
- <entry key="app/src/main/res/layout/activity_fast_scan.xml" value="0.20625" />
- <entry key="app/src/main/res/layout/activity_home_login.xml" value="0.20625" />
- <entry key="app/src/main/res/layout/activity_my_power_station.xml" value="0.20625" />
- <entry key="app/src/main/res/layout/activity_new_capture.xml" value="0.20625" />
- <entry key="app/src/main/res/layout/fragment_house_list.xml" value="0.20625" />
- <entry key="app/src/main/res/layout/fragment_me.xml" value="0.1" />
- <entry key="app/src/main/res/layout/frgment_house_list_line.xml" value="0.20625" />
- <entry key="app/src/main/res/layout/loading_alert.xml" value="0.20625" />
- <entry key="app/src/main/res/layout/loading_alert1.xml" value="0.1" />
- <entry key="app/src/main/res/layout/toolbar_top_view_52.xml" value="0.20625" />
- <entry key="app/src/main/res/layout/toolbar_top_view_53.xml" value="0.20625" />
- <entry key="third-zxing/src/main/res/drawable/transparent_divider.xml" value="0.1275" />
- <entry key="third-zxing/src/main/res/layout/activity_capture.xml" value="0.20625" />
- <entry key="third-zxing/src/main/res/layout/toolbar.xml" value="0.20625" />
- <entry key="third-zxing/src/main/res/layout/toolbar_top_view.xml" value="0.20625" />
- <entry key="third-zxing/src/main/res/layout/toolbar_top_view_52.xml" value="0.20625" />
- </map>
- </option>
- </component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
- <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" />
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
+ </component>
+</project>
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index f2ec162..34b647a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -43,7 +43,8 @@
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
- implementation 'org.greenrobot:eventbus:3.0.0'
+// implementation 'org.greenrobot:eventbus:3.0.0'
+ implementation 'com.hdl.hdlhttp:hxhttp:1.0.4'
}
\ No newline at end of file
diff --git a/app/src/main/java/com/hdl/photovoltaic/HDLApp.java b/app/src/main/java/com/hdl/photovoltaic/HDLApp.java
index c5bc0f1..9a77268 100644
--- a/app/src/main/java/com/hdl/photovoltaic/HDLApp.java
+++ b/app/src/main/java/com/hdl/photovoltaic/HDLApp.java
@@ -2,6 +2,7 @@
import android.app.Application;
+
import java.util.HashMap;
import java.util.Objects;
diff --git a/app/src/main/java/com/hdl/photovoltaic/base/BaseFragment.java b/app/src/main/java/com/hdl/photovoltaic/base/BaseFragment.java
index 7e4d36b..1cd2301 100644
--- a/app/src/main/java/com/hdl/photovoltaic/base/BaseFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/base/BaseFragment.java
@@ -21,7 +21,6 @@
import com.hdl.photovoltaic.other.HdlThreadLogic;
import com.hdl.photovoltaic.widget.LoadingDialog;
-import org.greenrobot.eventbus.EventBus;
import java.util.Locale;
@@ -107,15 +106,15 @@
protected void unregisterEventBus() {
- if (EventBus.getDefault().isRegistered(this)) {
- EventBus.getDefault().unregister(this);
- }
+// if (EventBus.getDefault().isRegistered(this)) {
+// EventBus.getDefault().unregister(this);
+// }
}
protected void registerEventBus() {
- if (!EventBus.getDefault().isRegistered(this)) {
- EventBus.getDefault().register(this);
- }
+// if (!EventBus.getDefault().isRegistered(this)) {
+// EventBus.getDefault().register(this);
+// }
}
// @Subscribe(threadMode = ThreadMode.MAIN)
diff --git a/app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java b/app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java
new file mode 100644
index 0000000..e82d14e
--- /dev/null
+++ b/app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java
@@ -0,0 +1,4 @@
+package com.hdl.photovoltaic.internet;
+
+public class HttpClient {
+}
diff --git a/app/src/main/java/com/hdl/photovoltaic/internet/TcpClient.java b/app/src/main/java/com/hdl/photovoltaic/internet/TcpClient.java
new file mode 100644
index 0000000..9afc648
--- /dev/null
+++ b/app/src/main/java/com/hdl/photovoltaic/internet/TcpClient.java
@@ -0,0 +1,4 @@
+package com.hdl.photovoltaic.internet;
+
+public class TcpClient {
+}
diff --git a/app/src/main/java/com/hdl/photovoltaic/internet/UdpClient.java b/app/src/main/java/com/hdl/photovoltaic/internet/UdpClient.java
new file mode 100644
index 0000000..47e1bbd
--- /dev/null
+++ b/app/src/main/java/com/hdl/photovoltaic/internet/UdpClient.java
@@ -0,0 +1,4 @@
+package com.hdl.photovoltaic.internet;
+
+public class UdpClient {
+}
diff --git a/app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java b/app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java
new file mode 100644
index 0000000..75b8eec
--- /dev/null
+++ b/app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java
@@ -0,0 +1,27 @@
+package com.hdl.photovoltaic.internet.api;
+
+public class HttpApi {
+ /*-----鐢ㄦ埛绠$悊---------*/
+ //鑾峰彇璐﹀彿鍖哄煙淇℃伅
+ public static final String POST_RegionByUserAccount = "/smart-footstone/region/regionByUserAccount";
+ //鐧诲綍鎺ュ彛
+ public static final String POST_Login = "/smart-footstone/user/oauth/login";
+ //鍙戦�佹秷鎭獙璇佺爜
+ public static final String POST_VERIFICATION_CODE_SEND= "/smart-footstone/verification/message/send";
+ //鐢ㄦ埛鎵惧洖瀵嗙爜 蹇樿瀵嗙爜,閫氳繃閭鍜屾墜鏈哄彿鎵惧洖
+ public static final String POST_FORGET_PROGRAM_PWD = "/smart-footstone/user/oauth/forgetProgramPwd";
+ //鏇存敼涓汉瀵嗙爜
+ public static final String POST_UPDATE_PROGRAM_PASSWORD = "/smart-footstone/user/userInfo/updateProgramPassword";
+ //鑾峰彇鍛樺伐鍒楄〃
+ public static final String POST_GET_USER_LIST = "/smart-footstone/user/userInfo/getUserList";
+ //鑾峰彇鐢ㄦ埛涓汉淇℃伅 C绔�
+ public static final String POST_GET_MEMBER_INFO= "/smart-footstone/member/memberInfo/getMemberInfo";
+ //鏇存柊涓汉淇℃伅 C绔�
+ public static final String POST_UPDATE_MEMBER_INFO = "/smart-footstone/member/memberInfo/updateMemberInfo";
+ //涓婁紶鍥剧墖
+ public static final String POST_UPLOAD_IMAGE = "/home-wisdom/app/images/upload_image";
+ //涓婁紶鍥剧墖锛堟柊锛�
+ public static final String POST_UPLOAD_IMAGE_NEW = "/basis-cosmos/file/upload";
+ //鏌ヨ鍥剧墖璺緞
+ public static final String POST_GET_IMAGE_URL = "/home-wisdom/app/images/get_image_url";
+}
diff --git a/app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java b/app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java
new file mode 100644
index 0000000..d814fe7
--- /dev/null
+++ b/app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java
@@ -0,0 +1,4 @@
+package com.hdl.photovoltaic.internet.api;
+
+public class TopicApi {
+}
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 4238242..63c9ae5 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java
@@ -1,5 +1,6 @@
package com.hdl.photovoltaic.other;
+
/**
* 鐧婚檰鐣岄潰鐨勯�昏緫
*/
@@ -19,4 +20,57 @@
return sHdlAccountLogic;
}
+
+ /**
+ * 鍒濆鍖栬处鍙风殑Url鍖哄煙鍦板潃(鍙兘鐘舵�佺爜:Sucess NotAccount NotNetWork)
+ *
+ * @param i_account
+ * @return
+ */
+ private void InitAccoutRegionInfo(String i_account) {
+// String regionUrl = this.GetAccoutRegionInfo(i_account);
+//
+//
+// if (regionUrl == null) {
+// return AccountStatu.NotNetWork;
+// }
+// if (regionUrl == string.Empty) {
+// return AccountStatu.NotAccount;
+// }
+//
+// return AccountStatu.Sucess;
+ }
+
+ /**
+ * 鑾峰彇璐﹀彿鎵�鍦ㄥ尯鍩�
+ *
+ * @param account
+ * @param callBack
+ * @return https://nearest.hdlcontrol.com/smart-footstone/region/regionByUserAccount
+ */
+// public Disposable regionByAccount(String account, IRegionByAccountCallBack callBack) {
+// String requestUrl = HDLLinkPMSdk.getInitUrl() + HttpApi.POST_RegionByUserAccount;
+// return HxHttp.builder()
+// .url(requestUrl)
+// .params("account", account)
+// .build()
+// .post()
+// .subscribeWith(new HDLResponse<HDLUserRegionBean>() {
+// @Override
+// public void onResponse(HDLUserRegionBean response) {
+// if (callBack != null) {
+// callBack.onSuccess(response);
+// }
+// }
+//
+// @Override
+// public void onFailure(HDLException e) {
+// HDLExceptionSubmitUtils.submit(requestUrl, account, e);
+// if (callBack != null) {
+// callBack.onFailure(e);
+// }
+// }
+// });
+
+// }
}
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java
index 6f15e08..b655da1 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java
@@ -24,6 +24,7 @@
import com.hdl.photovoltaic.base.CustomBaseActivity;
import com.hdl.photovoltaic.databinding.ActivityHomeLoginBinding;
import com.hdl.photovoltaic.ui.MyPowerStationActivity;
+import com.hdl.photovoltaic.utils.FileUtils;
public class HomeLoginActivity extends CustomBaseActivity {
@@ -159,7 +160,8 @@
viewBinding.homeLoginExperienceTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- //startActivity(MyPowerStationActivity.class);
+ startActivity(MyPowerStationActivity.class);
+
}
});
diff --git a/app/src/main/java/com/hdl/photovoltaic/utils/AppManagerUtils.java b/app/src/main/java/com/hdl/photovoltaic/utils/AppManagerUtils.java
index b263fd8..d4bee60 100644
--- a/app/src/main/java/com/hdl/photovoltaic/utils/AppManagerUtils.java
+++ b/app/src/main/java/com/hdl/photovoltaic/utils/AppManagerUtils.java
@@ -94,10 +94,11 @@
/**
* 鎸囧畾涓�涓被鍚�,浠庢寚瀹氱被鍚嶅紑濮嬬Щ闄ゅ悗闈㈡墍鏈堿ctivity
- * @param className Activity-绫诲悕(activity.getClass().getName())
+ *
+ * @param className Activity-绫诲悕(activity.getClass().getName())
* @param removeClass 鏄惁绉婚櫎鏈韩(true-绉婚櫎)
*/
- public void finishActivity(String className,boolean removeClass) {
+ public void finishActivity(String className, boolean removeClass) {
Iterator<Activity> iterator = activityStack.listIterator();
while (iterator.hasNext()) {
Activity activity = iterator.next();
@@ -156,7 +157,6 @@
// return false;
// }
// }
-
}
diff --git a/app/src/main/java/com/hdl/photovoltaic/utils/FileUtils.java b/app/src/main/java/com/hdl/photovoltaic/utils/FileUtils.java
new file mode 100644
index 0000000..528c1ee
--- /dev/null
+++ b/app/src/main/java/com/hdl/photovoltaic/utils/FileUtils.java
@@ -0,0 +1,139 @@
+package com.hdl.photovoltaic.utils;
+
+import android.content.Context;
+import android.util.Log;
+
+import com.hdl.photovoltaic.other.HdlLogLogic;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
+import java.util.Objects;
+
+
+public class FileUtils {
+
+ private static final String TAG = "FileUtils";
+
+ /**
+ * 鑾峰彇鍐呴儴瀛樺偍鏂囦欢璺緞
+ *
+ * @param context 涓婁笅鏂�
+ * @return -
+ */
+ public static String getInternalStoreFilesPath(Context context) {
+ if (context == null) {
+ return "";
+ }
+ return context.getFilesDir().getAbsolutePath();
+ }
+
+ public static File createFile(String dirPath, String fileName) {
+ try {
+ File dirFile = new File(dirPath);
+ if (!dirFile.exists()) {
+ if (!createFileDir(dirFile)) {
+ HdlLogLogic.print(TAG, "createFile dirFile.mkdirs fail");
+ return null;
+ }
+ } else if (!dirFile.isDirectory()) {
+ boolean delete = dirFile.delete();
+ if (delete) {
+ return createFile(dirPath, fileName);
+ } else {
+ HdlLogLogic.print(TAG, "createFile dirFile !isDirectory and delete fail");
+ return null;
+ }
+ }
+ File file = new File(dirPath, fileName);
+ if (!file.exists()) {
+ if (!file.createNewFile()) {
+ Log.e(TAG, "createFile createNewFile fail");
+ return null;
+ }
+ }
+ return file;
+ } catch (Exception e) {
+ HdlLogLogic.print(TAG, "createFile fail :" + e.getMessage());
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * 鍒涘缓鏂囦欢澶�---涔嬫墍浠ヨ涓�灞傚眰鍒涘缓锛屾槸鍥犱负涓�娆℃�у垱寤哄灞傛枃浠跺す鍙兘浼氬け璐ワ紒
+ */
+ public static boolean createFileDir(File dirFile) {
+ if (dirFile == null) {
+ return true;
+ }
+ if (dirFile.exists()) {
+ return true;
+ }
+ File parentFile = dirFile.getParentFile();
+ if (parentFile != null && !parentFile.exists()) {
+ //鐖舵枃浠跺す涓嶅瓨鍦紝鍒欏厛鍒涘缓鐖舵枃浠跺す锛屽啀鍒涘缓鑷韩鏂囦欢澶�
+ return createFileDir(parentFile) && createFileDir(dirFile);
+ } else {
+ boolean mkdirs = dirFile.mkdirs();
+ boolean isSuccess = mkdirs || dirFile.exists();
+ if (!isSuccess) {
+ Log.e("FileUtil", "createFileDir fail " + dirFile);
+ }
+ return isSuccess;
+ }
+ }
+
+ public static void writeFile(String path, String data) {
+ try {
+ File file = new File(path);
+ if (!file.exists()) {
+ if (!file.mkdir() && !file.isDirectory()) {
+ HdlLogLogic.print(TAG, "Error: make dir failed!");
+ return;
+ }
+ }
+ FileOutputStream d = new FileOutputStream(file);
+ d.write(data.getBytes());
+ d.flush();
+ d.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public static String readFile(String filepath) {
+ try {
+ String fileContent = "";
+ if (null == filepath) {
+ Log.d(TAG, "Error: Invalid file name!");
+ return fileContent;
+ }
+
+ File f = new File(filepath);
+ if (!f.exists()) {
+ return fileContent;
+ }
+ FileInputStream fis = new FileInputStream(f);
+ byte[] bytes = new byte[(int) f.length()];
+ fis.read(bytes);
+ fis.close();
+ fileContent = new String(bytes, 0, bytes.length);
+ return fileContent;
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ Log.d(TAG, "Error: Input File not find!");
+ return "";
+ }
+
+ }
+
+}
+
+
+
--
Gitblit v1.8.0