Android icon indicating copy to clipboard operation
Android copied to clipboard

Proper edge-to-edge support

Open TheLastProject opened this issue 10 months ago • 4 comments

Catima's edge-to-edge support on Android 15 (2.34.4) is completely broken. It needs to be reverted. It looks fine in portrait mode, but as soon as you run it in landscape mode with 3 button navigation part of the UI is no longer usable.

After reverting and doing a priority bugfix release, we need to implement proper edge-to-edge support. This will probably not be easy, so any help is welcome.

TheLastProject avatar Jan 16 '25 23:01 TheLastProject

The toolbar seemed to be the most broken part last time. Look at https://github.com/material-components/material-components-android/blob/master/docs/components/TopAppBar.md to confirm our setup is right

TheLastProject avatar Jan 28 '25 10:01 TheLastProject

It's not really "proper" support but I've been linked to https://android.googlesource.com/platform/packages/apps/MusicFX/+/cb72de3e999fd9cf082c448672037f54363b60ca which contains this workaround Google uses for some apps:

index 8ec4b98..d275a85 100644
--- a/src/com/android/musicfx/ActivityMusic.java
+++ b/src/com/android/musicfx/ActivityMusic.java

@@ -46,6 +46,11 @@
 import android.widget.TextView;
 import android.widget.Toast;
 
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowCompat;
+import androidx.core.view.WindowInsetsCompat;
+
 import com.android.audiofx.OpenSLESConstants;
 
 import java.util.Formatter;
@@ -522,6 +527,9 @@
             ((TextView) findViewById(R.id.noEffectsTextView)).setVisibility(View.VISIBLE);
         }
 
+        if (com.android.media.audio.Flags.musicFxEdgeToEdge()) {
+            setupEdgeToEdge();
+        }
     }
 
     /*
@@ -895,4 +903,18 @@
         }
         return transauralSupported;
     }
+
+    private void setupEdgeToEdge() {
+        WindowCompat.setDecorFitsSystemWindows(getWindow(), false /* decorFitsSystemWindows */);
+        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.contentSoundEffects),
+                (v, windowInsets) -> {
+                    Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
+                    // Apply the insets paddings to the view.
+                    v.setPadding(insets.left, insets.top, insets.right, insets.bottom);
+
+                    // Return CONSUMED if you don't want the window insets to keep being
+                    // passed down to descendant views.
+                    return WindowInsetsCompat.CONSUMED;
+                });
+    }
 }

If it works, might save a lot of time for now.

TheLastProject avatar Feb 12 '25 19:02 TheLastProject

Also worth noting, uCrop doesn't support this still: https://github.com/Yalantis/uCrop/issues/913

People are posting workarounds in that thread too.

TheLastProject avatar Feb 12 '25 19:02 TheLastProject

Apparently Tusky uses https://github.com/CanHub/Android-Image-Cropper. Maybe that has better Android 16 support. However, it also doesn't seem Compose ready: https://chaos.social/@ConnyDuck/114800012394870581

TheLastProject avatar Jul 05 '25 11:07 TheLastProject