gabriel2mm commented on issue #1919:
URL: 
https://github.com/apache/cordova-android/issues/1919#issuecomment-4488510786

   @itbeyond 
   I have been thinking about your report regarding a keyboard fix I applied, 
and I noticed that in this version of Cordova, from my perspective, this is not 
a bug. Android 16 is forcing apps to use edge-to-edge. To maintain app 
compatibility, a view was created in the Android Activity that behaves like the 
legacy status bars, in order to ensure backward compatibility so that apps 
aren't forced to go edge-to-edge.
   
   When passing the property <preference name="AndroidEdgeToEdge" value="false" 
/> in config.xml, it is normal for the Webview to be constrained, because it 
will take into account the status bars created in the Activity that guarantee 
backward compatibility.
   
   If enabled, <preference name="AndroidEdgeToEdge" value="true" />, this 
clipping ceases to exist because the margins that account for the system bars 
are no longer applied to the Webview, thereby removing the "truncation".
   
   Take a look at this code—it applies those exact margins
   `@SuppressWarnings({"deprecation", "ResourceType"})
       protected void createViews() {
           WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
   
           // Root FrameLayout
           FrameLayout rootLayout = new FrameLayout(this);
           rootLayout.setLayoutParams(new FrameLayout.LayoutParams(
                   ViewGroup.LayoutParams.MATCH_PARENT,
                   ViewGroup.LayoutParams.MATCH_PARENT
           ));
   
           // WebView
           View webView = appView.getView();
           webView.setLayoutParams(new FrameLayout.LayoutParams(
                   ViewGroup.LayoutParams.MATCH_PARENT,
                   ViewGroup.LayoutParams.MATCH_PARENT
           ));
   
           // Create StatusBar view that will overlay the top inset
           View statusBarView = new View(this);
           statusBarView.setTag("statusBarView");
   
           // Handle Window Insets
           ViewCompat.setOnApplyWindowInsetsListener(rootLayout, (v, insets) -> 
{
               Insets bars = insets.getInsets(
                       WindowInsetsCompat.Type.systemBars() | 
WindowInsetsCompat.Type.displayCutout()
               );
   
               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;
   
               FrameLayout.LayoutParams webViewParams = 
(FrameLayout.LayoutParams) webView.getLayoutParams();
               webViewParams.setMargins(left, top, right, bottom);
               webView.setLayoutParams(webViewParams);
   
               FrameLayout.LayoutParams statusBarParams = new 
FrameLayout.LayoutParams(
                       ViewGroup.LayoutParams.MATCH_PARENT,
                       top,
                       Gravity.TOP
               );
               statusBarView.setLayoutParams(statusBarParams);
   
               return insets;
           });
   
           rootLayout.addView(webView);
           rootLayout.addView(statusBarView);
   
           setContentView(rootLayout);
           rootLayout.post(() -> ViewCompat.requestApplyInsets(rootLayout));
           webView.requestFocusFromTouch();
       }`
   
   I believe you can test my fix and see if it improves the experience in your 
app: https://github.com/apache/cordova-android/pull/1924
   
   My understanding is that this is the expected behavior for the new 
cordova-android@15 release.


-- 
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