From 87cd5df70918e6ba1af849c5f026d3719bfdb1ac Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 09 四月 2025 09:06:29 +0800 Subject: [PATCH] Merge branch '1.5.2' into dev --- app/src/main/java/com/hdl/photovoltaic/utils/KeyboardStateObserverUtils.java | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/utils/KeyboardStateObserverUtils.java b/app/src/main/java/com/hdl/photovoltaic/utils/KeyboardStateObserverUtils.java index e94f1fc..408e86e 100644 --- a/app/src/main/java/com/hdl/photovoltaic/utils/KeyboardStateObserverUtils.java +++ b/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); } -- Gitblit v1.8.0