GitToTheHub commented on code in PR #1924:
URL: https://github.com/apache/cordova-android/pull/1924#discussion_r3248824499


##########
framework/src/org/apache/cordova/CordovaActivity.java:
##########
@@ -222,16 +222,24 @@ protected void createViews() {
             Insets bars = insets.getInsets(
                     WindowInsetsCompat.Type.systemBars() | 
WindowInsetsCompat.Type.displayCutout()
             );
+            Insets ime = insets.getInsets(WindowInsetsCompat.Type.ime());

Review Comment:
   Put this variable after `int bottom = 0;` and name it `imeInsets`



##########
framework/src/org/apache/cordova/CordovaActivity.java:
##########
@@ -222,16 +222,24 @@ protected void createViews() {
             Insets bars = insets.getInsets(
                     WindowInsetsCompat.Type.systemBars() | 
WindowInsetsCompat.Type.displayCutout()
             );
+            Insets ime = insets.getInsets(WindowInsetsCompat.Type.ime());
 
             boolean isStatusBarVisible = statusBarView.getVisibility() != 
View.GONE;
             int top = isStatusBarVisible && !canEdgeToEdge && !isFullScreen ? 
bars.top : 0;
-            int bottom = !canEdgeToEdge && !isFullScreen ? bars.bottom : 0;
             int left = !canEdgeToEdge && !isFullScreen ? bars.left : 0;
             int right = !canEdgeToEdge && !isFullScreen ? bars.right : 0;
 
+            int bottom = 0;
+            if (!isFullScreen) {

Review Comment:
   What does this code? Add documentation why `if (!isFullScreen)` is set here



##########
framework/src/org/apache/cordova/CordovaActivity.java:
##########
@@ -222,16 +222,24 @@ protected void createViews() {
             Insets bars = insets.getInsets(
                     WindowInsetsCompat.Type.systemBars() | 
WindowInsetsCompat.Type.displayCutout()
             );
+            Insets ime = insets.getInsets(WindowInsetsCompat.Type.ime());
 
             boolean isStatusBarVisible = statusBarView.getVisibility() != 
View.GONE;
             int top = isStatusBarVisible && !canEdgeToEdge && !isFullScreen ? 
bars.top : 0;
-            int bottom = !canEdgeToEdge && !isFullScreen ? bars.bottom : 0;
             int left = !canEdgeToEdge && !isFullScreen ? bars.left : 0;
             int right = !canEdgeToEdge && !isFullScreen ? bars.right : 0;
 
+            int bottom = 0;
+            if (!isFullScreen) {
+                bottom = !canEdgeToEdge ? Math.max(bars.bottom, ime.bottom) : 
ime.bottom;

Review Comment:
   You can revert the condition and don't need the `!` at the beginning and 
it's easier to read:
   
   ```java
   bottom = canEdgeToEdge ? ime.bottom : Math.max(bars.bottom, ime.bottom);
   ```



##########
framework/src/org/apache/cordova/CordovaActivity.java:
##########
@@ -222,16 +222,24 @@ protected void createViews() {
             Insets bars = insets.getInsets(
                     WindowInsetsCompat.Type.systemBars() | 
WindowInsetsCompat.Type.displayCutout()
             );
+            Insets ime = insets.getInsets(WindowInsetsCompat.Type.ime());
 
             boolean isStatusBarVisible = statusBarView.getVisibility() != 
View.GONE;
             int top = isStatusBarVisible && !canEdgeToEdge && !isFullScreen ? 
bars.top : 0;
-            int bottom = !canEdgeToEdge && !isFullScreen ? bars.bottom : 0;
             int left = !canEdgeToEdge && !isFullScreen ? bars.left : 0;
             int right = !canEdgeToEdge && !isFullScreen ? bars.right : 0;
 
+            int bottom = 0;
+            if (!isFullScreen) {
+                bottom = !canEdgeToEdge ? Math.max(bars.bottom, ime.bottom) : 
ime.bottom;
+            }
+
             FrameLayout.LayoutParams webViewParams = 
(FrameLayout.LayoutParams) webView.getLayoutParams();
-            webViewParams.setMargins(left, top, right, bottom);
-            webView.setLayoutParams(webViewParams);
+            if (webViewParams.leftMargin != left || webViewParams.topMargin != 
top

Review Comment:
   Why are these conditions here? Please document it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to