app/src/main/java/com/hdl/photovoltaic/internet/HttpServer/MyNanoHttpServer.java
@@ -45,6 +45,7 @@ return myNanoHttpServer; } @Override public Response serve(IHTTPSession session) { //TODO 解决客户端请求参数携带中文,出现中文乱码问题 @@ -79,7 +80,7 @@ String fileName = ((HTTPSession) session).getUri(); if (!TextUtils.isEmpty(fileName)) { if (fileName.contains(HdlFileLogic.getInstance().getDriveRootPath()) ||fileName.contains(HdlFileLogic.getInstance().getFirmwareRootPath())) { || fileName.contains(HdlFileLogic.getInstance().getFirmwareRootPath())) { String range = session.getHeaders().get("range"); if (TextUtils.isEmpty(range)) { return newFixedLengthResponse("错误,头部没有range字段(-500)"); app/src/main/java/com/hdl/photovoltaic/internet/HttpServer/MyNanoHttpService.java
@@ -21,6 +21,11 @@ try { myNanoHttpServer.start(); } catch (Exception e) { // if (serverSocket.isBound() && !serverSocket.isClosed()) { // // Port is available // } else { // // Port is not available // } e.printStackTrace(); startService(new Intent(this, MyNanoHttpService.class)); } app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -82,14 +82,14 @@ } /** * 获取当前住宅的【主】逆变器列表 * 获取当前住宅的【主】逆变器 */ public GatewayBean getCurrentHomeMainGateway() { return queryCurrentHomeMainGateway(this.getCurrentHomeGatewayList()); } /** * 查询当前住宅的【主】逆变器列表 * 查询当前住宅的【主】逆变器 */ public GatewayBean queryCurrentHomeMainGateway(List<GatewayBean> list) { if (list == null || list.size() == 0) { app/src/main/java/com/hdl/photovoltaic/other/HdlThreadLogic.java
@@ -171,7 +171,7 @@ Drawable drawable = AppCompatResources.getDrawable(context, R.drawable.tip_fail); flashingBoxDialog.setImage(drawable); } flashingBoxDialog.setContent(msg + "\r\n(" + code + ")"); flashingBoxDialog.setContent(msg + "(" + code + ")"); flashingBoxDialog.show(); } }, null, null); app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java
@@ -309,6 +309,13 @@ String password = viewBinding.homeLoginPasswordEt.getText().toString().replace(" ", ""); boolean isEnabled = account.length() > 0 && password.length() > 0; viewBinding.homeLoginTv.setEnabled(isEnabled); if (password.length() < 6 || password.length() > 16) { return; } //符合密码规则后隐藏错误提示; viewBinding.homeLoginLine2V.setBackgroundColor(getColor(R.color.text_E1E1E1)); viewBinding.homeLoginPasswordTextErrorTv.setText(""); } /** app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java
@@ -134,7 +134,7 @@ } private void initView() { viewBinding.myPowerStationBottomIl1.titleTv.setText(R.string.power_station); viewBinding.myPowerStationBottomIl1.titleTv.setText("首页");// viewBinding.myMessageBottomIl2.titleTv.setText(R.string.message); viewBinding.myMeBottomIl3.titleTv.setText(R.string.power_station_me); this.bottomViewChangeOfStyle(); app/src/main/java/com/hdl/photovoltaic/ui/adapter/HouseInfoAdapter.java
@@ -42,12 +42,12 @@ public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { HouseIdBean houseIdBean = this.mList.get(position); holder.homeNameTv.setText(houseIdBean.getHomeName()); holder.homeNameTv.setText(houseIdBean.getHomeName().replace(" ", "")); //装机容量 String capacity = mContext.getString(R.string.my_power_station_installed_capacity) + houseIdBean.getInstalledCapacity(); String capacity = mContext.getString(R.string.my_power_station_installed_capacity) + houseIdBean.getInstalledCapacity() + "kW"; holder.capacityTv.setText(capacity); //发电功率 String power = mContext.getString(R.string.power_station_generated_power) + houseIdBean.getPower(); String power = mContext.getString(R.string.power_station_generated_power) + houseIdBean.getPower() + "kW"; holder.powerTv.setText(power); setTextViewStyle(holder.stateTv, houseIdBean.getPowerStationStatus()); GlideUtils.getRoundedCornersImage(mContext, houseIdBean.getPowerStationImage(), holder.homeIconIv, new RoundedCorners(4)); @@ -78,6 +78,7 @@ /** * 改变组件样式 * * @param textView 显示组件 * @param state_value 电站状态(1:正常(运行),2:离线,3:连接中,4:故障) */ app/src/main/java/com/hdl/photovoltaic/ui/me/MeChangePasswordActivity.java
@@ -13,6 +13,7 @@ import android.widget.ImageView; import com.hdl.linkpm.sdk.core.exception.HDLException; import com.hdl.linkpm.sdk.user.HDLLinkPMUser; import com.hdl.photovoltaic.R; import com.hdl.photovoltaic.base.CustomBaseActivity; import com.hdl.photovoltaic.config.UserConfigManage; @@ -20,6 +21,7 @@ import com.hdl.photovoltaic.listener.CloudCallBeak; import com.hdl.photovoltaic.other.HdlAccountLogic; import com.hdl.photovoltaic.other.HdlThreadLogic; import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; /** * 我的-修改密码-界面 @@ -86,7 +88,24 @@ viewBinding.homeAffirmTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { sendChangePassword(); // 二次确认提示框 ConfirmationCancelDialog dialog = new ConfirmationCancelDialog(_mActivity); dialog.setTitle(getString(R.string.loading_title_tip)); dialog.setContent("密码修改成功,将重新登录."); dialog.show(); dialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { @Override public void Confirm() { sendChangePassword(); } }); dialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() { @Override public void Cancel() { dialog.dismiss(); } }); } }); } @@ -98,6 +117,16 @@ String oldPsw = viewBinding.meChangePasswordOldIc.mePswEt.getText().toString().replaceAll(" +", ""); String newPsw = viewBinding.meChangePasswordNewIc.mePswEt.getText().toString().replaceAll(" +", ""); String affirmPsw = viewBinding.meChangePasswordAffirmIc.mePswEt.getText().toString().replaceAll(" +", ""); if (isEditTextPassword(oldPsw, newPsw) || isEditTextPassword(oldPsw, affirmPsw)) { HdlThreadLogic.tipFlashingBox(_mActivity, true, "原密码和新密码不能一样.", -1); return; } if (newPsw.length() < 6 || affirmPsw.length() < 6) { HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_least6), -1); return; } if (!isEditTextPassword(newPsw, affirmPsw)) { HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_input_unlike_psw), -1); return; @@ -107,7 +136,8 @@ HdlAccountLogic.getInstance().updatePassword_B(oldPsw, newPsw, new CloudCallBeak<String>() { @Override public void onSuccess(String str) { HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_pws_reset_succeeded), 0); // HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_pws_reset_succeeded), 0); HDLLinkPMUser.getInstance().logout(0); } @Override @@ -120,7 +150,10 @@ HdlAccountLogic.getInstance().updatePassword_C(oldPsw, newPsw, new CloudCallBeak<String>() { @Override public void onSuccess(String obj) { HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_pws_reset_succeeded), 0); HDLLinkPMUser.getInstance().logout(0); } @Override app/src/main/java/com/hdl/photovoltaic/ui/me/MeFragment.java
@@ -103,7 +103,7 @@ // setMemberHeadIcon(cUserInfo.getMemberHeadIcon()); //更新用户名称 setMemberName(cUserInfo.getMemberName()); HdlThreadLogic.toast(_mActivity, e); // HdlThreadLogic.toast(_mActivity, e); } }); } @@ -194,7 +194,6 @@ viewBinding.toolbarTopFragmentMeRl.topTitleTv.setText(R.string.me); // viewBinding.toolbarTopFragmentMeRl.topMoreIv.setVisibility(View.VISIBLE); // viewBinding.toolbarTopFragmentMeRl.topMoreIv.setImageResource(R.drawable.message); viewBinding.fragmentMeLineSetIl.fragmentMeLineLeftIconIv.setImageResource(R.drawable.set); app/src/main/java/com/hdl/photovoltaic/ui/me/PersonalDataActivity.java
@@ -191,7 +191,7 @@ @Override public void onFailure(HDLException e) { HdlThreadLogic.tipFlashingBox(_mActivity, false, e.getMessage(), e.getCode()); HdlThreadLogic.tipFlashingBox(_mActivity, false, e.getMsg(), e.getCode()); } }); app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java
@@ -12,7 +12,9 @@ import com.hdl.photovoltaic.config.AppConfigManage; import com.hdl.photovoltaic.other.HdlLogLogic; import com.hdl.photovoltaic.other.HdlThreadLogic; import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; import org.greenrobot.eventbus.EventBus; import org.json.JSONException; import org.json.JSONObject; @@ -111,6 +113,12 @@ if (appid.equals(mCurrentAppId)) { mCurrentAppId = ""; } // //小程序被关闭了通知给原生 // BaseEventBus baseEventBus = new BaseEventBus(); // baseEventBus.setType(HDLUniMP.UNI_EVENT_REPLY_HOME_CLOSE_HOME_DETAILS_PAGE); // EventBus.getDefault().post(baseEventBus); } }); @@ -137,7 +145,7 @@ //回传数据给小程序 JSONObject params = getAppParams(); callback.invoke(params); HdlLogLogic.print( "uni_GetAppParams callback:" + params.toString()); HdlLogLogic.print("uni_GetAppParams callback:" + params.toString()); } else { //除了统一处理,剩余其它特定场景的事件通知 if (onOtherUniMPEventCallBack != null) { @@ -218,7 +226,7 @@ } }); } else { HdlLogLogic.print( "wgt包本地不存在"); HdlLogLogic.print("wgt包本地不存在"); } } @@ -253,7 +261,7 @@ public void openUniMP(String uniAppId, String path, JSONObject jsonObject, IOnOtherUniMPEventCallBack callBack) { if (TextUtils.isEmpty(uniAppId)) { HdlThreadLogic.toast(mContext, "uni Id null"); HdlLogLogic.print( "小程序ID 不能为空"); HdlLogLogic.print("小程序ID 不能为空"); return; } try { @@ -327,7 +335,7 @@ mUniMPCaches.put(uniMP.getAppid(), uniMP); } catch (Exception e) { e.printStackTrace(); HdlLogLogic.print( "打开失败===" + e.getMessage()); HdlLogLogic.print("打开失败===" + e.getMessage()); } } @@ -349,7 +357,7 @@ HdlLogLogic.print("发送失败,小程序对象为空:" + uniAppId); } } else { HdlLogLogic.print( "发送失败,找不到对应的小程序:" + uniAppId); HdlLogLogic.print("发送失败,找不到对应的小程序:" + uniAppId); } } app/src/main/java/com/hdl/photovoltaic/widget/ListDialog.java
@@ -1,5 +1,6 @@ package com.hdl.photovoltaic.widget; import android.annotation.SuppressLint; import android.app.Dialog; import android.content.Context; import android.content.Intent; @@ -48,29 +49,13 @@ this.mContext = context; } @Override protected void onStart() { super.onStart(); // 获取窗口对象 Window dialogWindow = this.getWindow(); if (dialogWindow != null) { // 获取对话框当前的参数值 WindowManager.LayoutParams p = dialogWindow.getAttributes(); p.width = LinearLayout.LayoutParams.MATCH_PARENT; p.height = LinearLayout.LayoutParams.WRAP_CONTENT; p.gravity = Gravity.TOP; // 设置到属性配置中 dialogWindow.setAttributes(p); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); viewBinding = DialogListBinding.inflate(getLayoutInflater()); setContentView(viewBinding.getRoot()); this.setCanceledOnTouchOutside(true); // setDialogTouchOutsideCloseable(this); setDialogTouchOutsideCloseable(this); initData(); LinearLayoutManager linearLayout = new LinearLayoutManager(mContext); listDialogAdapter = new ListDialogAdapter(this.list, mContext); @@ -154,40 +139,56 @@ } @SuppressLint("ClickableViewAccessibility") public void setDialogTouchOutsideCloseable(Dialog dialog) { viewBinding.getRoot().setOnTouchListener(new View.OnTouchListener() { // viewBinding.getRoot().setOnTouchListener(new View.OnTouchListener() { // // @Override // public boolean onTouch(View v, MotionEvent event) { // int top = viewBinding.dialogParent.getTop(); // int left = viewBinding.dialogParent.getLeft(); // int bottom = viewBinding.dialogParent.getBottom(); // int right = viewBinding.dialogParent.getRight(); // int y = (int) event.getY(); // int x = (int) event.getX(); // if (event.getAction() == MotionEvent.ACTION_UP) { // if (top < y && y < bottom) { // // } else { // dismiss(); // } // // if (left < x && x < right) { // // } else { // dismiss(); // } // // // } // return true; // } // }); viewBinding.getRoot().setOnClickListener(new View.OnClickListener() { @Override public boolean onTouch(View v, MotionEvent event) { public void onClick(View v) { int top = viewBinding.dialogParent.getTop(); int left = viewBinding.dialogParent.getLeft(); int bottom = viewBinding.dialogParent.getBottom(); int right = viewBinding.dialogParent.getRight(); int y = (int) event.getY(); int x = (int) event.getX(); if (event.getAction() == MotionEvent.ACTION_UP) { if (top < y && y < bottom) { } else { dismiss(); } if (left < x && x < right) { } else { dismiss(); } int y = (int) v.getY(); int x = (int) v.getX(); if (top < y && y < bottom) { } else { dismiss(); } return true; if (left < x && x < right) { } else { dismiss(); } } }); // Window window = dialog.getWindow(); // WindowManager.LayoutParams params = window.getAttributes(); // params.width = ViewGroup.LayoutParams.MATCH_PARENT; // params.height = ViewGroup.LayoutParams.MATCH_PARENT; // window.setAttributes(params); // //空白处不能取消动画 // setCanceledOnTouchOutside(true); } } app/src/main/res/layout/dialog_list.xml
@@ -19,6 +19,7 @@ android:id="@+id/logic_rcv" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app/src/main/res/layout/diaog_list_line.xml
@@ -3,7 +3,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="@dimen/dp_141" android:layout_height="@dimen/dp_54" android:background="#464D5A"> android:background="@drawable/list_464d5a" > <TextView android:id="@+id/list_item_title_tv" app/src/main/res/layout/frgment_house_list_line.xml
@@ -24,14 +24,16 @@ <TextView android:id="@+id/fragment_house_list_line_name_tv" android:layout_width="wrap_content" android:layout_width="170dp" android:layout_height="@dimen/dp_23" android:layout_marginStart="@dimen/dp_15" android:layout_marginTop="@dimen/dp_28" android:layout_toEndOf="@+id/fragment_house_list_line_left_iv" android:gravity="center_vertical" android:gravity="center_vertical|start" android:text="@string/power_station" android:textColor="@color/text_90000000" android:ellipsize="end" android:singleLine="true" android:textSize="@dimen/text_16" /> <TextView app/src/main/res/layout/general_line.xml
@@ -54,6 +54,8 @@ android:layout_centerVertical="true" android:layout_marginEnd="@dimen/dp_9" android:layout_toStartOf="@+id/sll_ll_rl_right_icon_ll" android:layout_toEndOf="@+id/sll_ll_rl_name_tv" android:gravity="end" android:orientation="horizontal" > @@ -74,6 +76,7 @@ android:id="@+id/sll_ll_rl_right_content_tv" android:layout_width="wrap_content" android:layout_height="@dimen/dp_21" android:gravity="end" android:textColor="@color/text_7C8590" android:textSize="@dimen/text_15" android:visibility="gone" />