.idea/.name
New file @@ -0,0 +1 @@ PhotovoltaicDebug .idea/compiler.xml
New file @@ -0,0 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="CompilerConfiguration"> <bytecodeTargetLevel target="11" /> </component> </project> .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> .idea/vcs.xml
New file @@ -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> 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' } 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; 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) app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java
New file @@ -0,0 +1,4 @@ package com.hdl.photovoltaic.internet; public class HttpClient { } app/src/main/java/com/hdl/photovoltaic/internet/TcpClient.java
New file @@ -0,0 +1,4 @@ package com.hdl.photovoltaic.internet; public class TcpClient { } app/src/main/java/com/hdl/photovoltaic/internet/UdpClient.java
New file @@ -0,0 +1,4 @@ package com.hdl.photovoltaic.internet; public class UdpClient { } app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java
New file @@ -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"; } app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java
New file @@ -0,0 +1,4 @@ package com.hdl.photovoltaic.internet.api; public class TopicApi { } 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); // } // } // }); // } } 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); } }); app/src/main/java/com/hdl/photovoltaic/utils/AppManagerUtils.java
@@ -94,6 +94,7 @@ /** * 指定一个类名,从指定类名开始移除后面所有Activity * * @param className Activity-类名(activity.getClass().getName()) * @param removeClass 是否移除本身(true-移除) */ @@ -156,7 +157,6 @@ // return false; // } // } } app/src/main/java/com/hdl/photovoltaic/utils/FileUtils.java
New file @@ -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 ""; } } }