.idea/misc.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/utils/KeyboardStateObserverUtils.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/widget/ConfirmationDialog.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/widget/ConfirmationInputDialog.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/layout/activity_home_login.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/layout/loading_confirm_input.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
.idea/misc.xml
@@ -3,8 +3,12 @@ <component name="DesignSurface"> <option name="filePathToZoomLevelMap"> <map> <entry key="../../../../../layout/custom_preview.xml" value="0.22314814814814815" /> <entry key="app/src/main/res/layout/activity_home_login.xml" value="0.10030395136778116" /> <entry key="app/src/main/res/layout/activity_my_power_station.xml" value="0.10030395136778116" /> <entry key="app/src/main/res/layout/fragment_house_list.xml" value="0.10030395136778116" /> <entry key="app/src/main/res/layout/fragment_me.xml" value="0.10030395136778116" /> <entry key="app/src/main/res/layout/loading_confirm_input.xml" value="0.10030395136778116" /> <entry key="app/src/main/res/layout/toolbar_top_view_52.xml" value="0.10030395136778116" /> </map> </option> app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java
@@ -48,26 +48,27 @@ initView(); //初始化界面监听器 initEvent(); ///**/在界面中使用: //在界面中使用 // KeyboardStateObserverUtils.getKeyboardStateObserver(_mActivity).setKeyboardVisibilityListener(new KeyboardStateObserverUtils.OnKeyboardVisibilityListener() { // @Override // // public void onKeyboardShow() { // public void onKeyboardShow(int h) { // //Toast.makeText(MainActivity.this,"键盘弹出",Toast.LENGTH_SHORT).show(); // ConstraintSet cs = new ConstraintSet(); // cs.connect(R.id.home_login_title_tv, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP, 400);// // cs.clone(viewBinding.homeLoginParentCl); //// (viewBinding.loadingConfirmationRl.getTop()-dip2px(h)) // cs.connect(R.id.home_login_tv, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM, h);// // //应用约束 // cs.applyTo(viewBinding.parentCl); //// viewBinding.agreementLl.setVisibility(View.GONE); // cs.applyTo(viewBinding.homeLoginParentCl); // } // // @Override // // public void onKeyboardHide() { // //Toast.makeText(MainActivity.this,"键盘收回",Toast.LENGTH_SHORT).show(); // public void onKeyboardHide(int h) { // ConstraintSet cs = new ConstraintSet(); // cs.connect(R.id.home_login_title_tv, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP, 400);// // cs.applyTo(viewBinding.parentCl); // cs.clone(viewBinding.homeLoginParentCl); // cs.connect(R.id.home_login_tv, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM, h);// // //应用约束 // cs.applyTo(viewBinding.homeLoginParentCl); // } // // }); app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java
@@ -28,6 +28,7 @@ @Override public void onBindView(Bundle savedInstanceState) { getWindow().setStatusBarColor(getColor(R.color.text_245EC3)); //初始化 initView(); //初始化界面监听器 app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
@@ -66,13 +66,14 @@ viewBinding.toolbarTopFragmentHouseListRl.topMoreIv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String path = "pages/powerStationDetail/index"; // HDLUniMP.UNI_PATH_MILLIMETER;//原生通知小程序地址 HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_HOME_DETAILS); JSONObject json = uniCallBackBaseBean.getJSONObject(uniCallBackBaseBean); // HDLUniMPSDKManager.getInstance().openUniMP(HDLUniMP.UNI_APP_ID, path, json, new HDLUniMPSDKManager.IOnOtherUniMPEventCallBack() { // String path = "pages/powerStationDetail/index"; //// HDLUniMP.UNI_PATH_MILLIMETER;//原生通知小程序地址 // HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); // uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_HOME_DETAILS); // uniCallBackBaseBean.setPath(path); // JSONObject jsonObject = uniCallBackBaseBean.getJSONObject(); // // HDLUniMPSDKManager.getInstance().openUniMP(HDLUniMP.UNI_APP_ID, path, jsonObject, new HDLUniMPSDKManager.IOnOtherUniMPEventCallBack() { // @Override // public void onOtherUniMPEventReceive(String appid, String event, Object data, DCUniMPJSCallback callback) { // @@ -96,14 +97,14 @@ // startActivity(FastScanActivity.class); // } // ConfirmationInputDialog confirmationInputDialog =new ConfirmationInputDialog(_mActivity); // confirmationInputDialog.show(); // confirmationInputDialog.setNoOnclickListener(new ConfirmationInputDialog.onNoOnclickListener() { // @Override // public void Cancel() { // confirmationInputDialog.dismiss(); // } // }); ConfirmationInputDialog confirmationInputDialog = new ConfirmationInputDialog(_mActivity); confirmationInputDialog.show(); confirmationInputDialog.setNoOnclickListener(new ConfirmationInputDialog.onNoOnclickListener() { @Override public void Cancel() { confirmationInputDialog.dismiss(); } }); } }); app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
@@ -1,6 +1,5 @@ package com.hdl.photovoltaic.uni; import androidx.annotation.NonNull; import com.google.gson.Gson; @@ -51,6 +50,7 @@ public static class UniCallBackBaseBean implements Serializable { private String path;//打开小程序路径(暂时用不上) private String code;//状态码 private String mes;//信息描述 private String topic;//暂时用不上 @@ -109,15 +109,26 @@ this.type = type; } public JSONObject getJSONObject(Object obj) { Gson gson = new Gson(); String json = gson.toJson(obj); com.alibaba.fastjson.JSONObject d=new com.alibaba.fastjson.JSONObject(); JSONObject jsonObject = gson.fromJson(json, JSONObject.class); if (jsonObject == null) { jsonObject = new JSONObject(); public String getPath() { return path == null ? "" : path; } public void setPath(String path) { this.path = path; } /** * 当前对象转 JSONObject * * @return JSONObject */ public JSONObject getJSONObject() { try { String json = new Gson().toJson(this); return new JSONObject(json); } catch (Exception e) { return new JSONObject(); } return jsonObject; } app/src/main/java/com/hdl/photovoltaic/utils/KeyboardStateObserverUtils.java
@@ -17,7 +17,7 @@ } private View mChildOfContent; private final View mChildOfContent; private int usableHeightPrevious;//使用高度 @@ -52,20 +52,20 @@ int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { //可用高度无键盘 //获取整个屏幕的高度 int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboard - usableHeightNow; if (heightDifference > (usableHeightSansKeyboard / 4)) { if (listener != null) { listener.onKeyboardShow(); listener.onKeyboardShow(heightDifference); } } else { if (listener != null) { listener.onKeyboardHide(); listener.onKeyboardHide(heightDifference); } @@ -87,19 +87,18 @@ private int computeUsableHeight() { Rect r = new Rect(); //获取可见窗口 //获取可以显示的区域 mChildOfContent.getWindowVisibleDisplayFrame(r); //Log.d(TAG,"rec bottom>" + r.bottom + " | rec top>" + r.top); return (r.bottom - r.top);// 全屏模式下: return r.bottom } public interface OnKeyboardVisibilityListener { void onKeyboardShow(); void onKeyboardShow(int h); void onKeyboardHide(); void onKeyboardHide(int h); } app/src/main/java/com/hdl/photovoltaic/widget/ConfirmationDialog.java
@@ -54,6 +54,9 @@ return; } titleStr = title; if (viewBinding != null) { viewBinding.loadingConfirmationTitleTv.setText(titleStr); } } @@ -68,6 +71,12 @@ } yesStr = confirm; if (viewBinding != null) { viewBinding.dialogConfirmTv.setText(yesStr); } } /** @@ -80,6 +89,9 @@ return; } noStr = cancel; if (viewBinding != null) { viewBinding.dialogCancelTv.setText(noStr); } } @@ -93,6 +105,9 @@ return; } contentStr = content; if (viewBinding != null) { viewBinding.loadingConfirmationContentTv.setText(contentStr); } } private void initEvent() { app/src/main/java/com/hdl/photovoltaic/widget/ConfirmationInputDialog.java
@@ -33,7 +33,6 @@ private LoadingConfirmInputBinding viewBinding; private String titleStr, yesStr, noStr; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -48,26 +47,27 @@ initData(); //初始化界面控件的事件 initEvent(); ///**/在界面中使用: //在界面中使用 KeyboardStateObserverUtils.getKeyboardStateObserver((Activity) mContext).setKeyboardVisibilityListener(new KeyboardStateObserverUtils.OnKeyboardVisibilityListener() { @Override public void onKeyboardShow() { public void onKeyboardShow(int h) { //Toast.makeText(MainActivity.this,"键盘弹出",Toast.LENGTH_SHORT).show(); ConstraintSet cs = new ConstraintSet(); cs.connect(R.id.loading_confirmation_rl, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP, 40);// cs.clone(viewBinding.loadingParentCl); // (viewBinding.loadingConfirmationRl.getTop()-dip2px(h)) cs.connect(R.id.loading_confirmation_rl, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM, px2dip(h));// //应用约束 // cs.applyTo(viewBinding.contentBaseView); // viewBinding.agreementLl.setVisibility(View.GONE); cs.applyTo(viewBinding.loadingParentCl); } @Override public void onKeyboardHide() { //Toast.makeText(MainActivity.this,"键盘收回",Toast.LENGTH_SHORT).show(); public void onKeyboardHide(int h) { ConstraintSet cs = new ConstraintSet(); cs.connect(R.id.loading_confirmation_rl, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP, 40);// cs.clone(viewBinding.loadingParentCl); cs.connect(R.id.loading_confirmation_rl, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM, px2dip(h));// //应用约束 cs.applyTo(viewBinding.loadingParentCl); } }); @@ -85,6 +85,9 @@ return; } titleStr = title; if (viewBinding != null) { viewBinding.loadingConfirmationTitleTv.setText(titleStr); } } @@ -98,6 +101,10 @@ return; } yesStr = confirm; if (viewBinding != null) { viewBinding.dialogConfirmTv.setText(yesStr); } } @@ -113,6 +120,9 @@ } noStr = cancel; if (viewBinding != null) { viewBinding.dialogCancelTv.setText(noStr); } } @@ -158,6 +168,9 @@ * 初始化界面控件的显示数据 */ private void initData() { if (viewBinding == null) { return; } //如果用户自定了title和message if (!TextUtils.isEmpty(titleStr)) { viewBinding.loadingConfirmationTitleTv.setText(titleStr); @@ -209,4 +222,23 @@ void Confirm(String str); } /** * 根据手机的分辨率从 dp 的单位 转成为 px(像素) */ public int dip2px(float dpValue) { if (mContext == null) { return 0; } final float scale = mContext.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); } /** * 根据手机的分辨率从 px(像素) 的单位 转成为 dp */ public int px2dip(float pxValue) { final float scale = mContext.getResources().getDisplayMetrics().density; return (int) (pxValue / scale + 0.5f); } } app/src/main/res/layout/activity_home_login.xml
@@ -2,7 +2,7 @@ <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/parent_cl" android:id="@+id/home_login_parent_cl" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.hdl.photovoltaic.ui.HomeLoginActivity"> app/src/main/res/layout/loading_confirm_input.xml
@@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/loading_parent_cl" android:layout_width="match_parent" android:layout_height="match_parent">