From 671a674c6e2570adbc61f9cbca91e5a1f609fab5 Mon Sep 17 00:00:00 2001 From: Andrew Quan Date: Fri, 26 Mar 2021 13:33:30 +0200 Subject: [PATCH] Android - Foldables Added support for Multi-Window and related properties: https://developer.android.com/guide/topics/ui/foldables https://developer.android.com/guide/topics/ui/multi-window https://developer.android.com/guide/topics/ui/picture-in-picture https://developer.samsung.com/galaxy/foldable/techdocs https://stackoverflow.com/questions/14111052/adding-samsung-multi-window-support-to-android-application https://program.developer.samsung.com/2019/04/05/seven-mistakes-to-avoid-when-developing-for-foldable-displays Sample project settings: ``` "Android": { "MultiWindow": { "Enabled": true, "DefaultSizeWidth": "320p", "DefaultSizeHeight": "640p", "MultiInstance": true }, "PenWindow": true, "AllowMultipleResumedActivities": true, "ResizeableActivity": true, "SupportsPictureInPicture": true, "WindowLayoutInDisplayCutoutMode": 'default', "MaxAspect": "21:9", "Layout": { "DefaultHeight": "640dp", "DefaultWidth": "320dp", "Gravity": "top|end", "MinHeight": "300dp", "MinWidth": "280dp" }, ``` --- .../Android/app/src/main/AndroidManifest.xml | 66 ++++++++++++++++++- .../app/src/main/res/values/styles.xml | 3 + 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/lib/UnoCore/Targets/Android/app/src/main/AndroidManifest.xml b/lib/UnoCore/Targets/Android/app/src/main/AndroidManifest.xml index 008c9f478..4e60a324b 100644 --- a/lib/UnoCore/Targets/Android/app/src/main/AndroidManifest.xml +++ b/lib/UnoCore/Targets/Android/app/src/main/AndroidManifest.xml @@ -107,7 +107,7 @@ #endif android:taskAffinity="" android:windowSoftInputMode="adjustResize" - android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|uiMode" + android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|uiMode|screenLayout" #if @(Project.Mobile.Orientations:Equals('Portrait')) android:screenOrientation="portrait" #elif @(Project.Mobile.Orientations:Equals('LandscapeLeft')) @@ -118,12 +118,48 @@ android:screenOrientation="sensorLandscape" #else android:screenOrientation="user" +#endif +#if @(Project.Android.ResizeableActivity:Test(1, 0)) + android:resizeableActivity="true" +#endif +#if @(Project.Android.SupportsPictureInPicture:Test(1, 0)) + android:supportsPictureInPicture="true" #endif android:windowActionBar="false"> + +#if @(Project.Android.Layout.DefaultHeight:IsSet) || + @(Project.Android.Layout.DefaultWidth:IsSet) || + @(Project.Android.Layout.Gravity:IsSet) || + @(Project.Android.Layout.MinHeight:IsSet) || + @(Project.Android.Layout.MinWidth:IsSet) + + #endif +#if @(Project.Android.MultiWindow.Enabled:Test(1, 0)) + +#endif +#if @(Project.Android.PenWindow:Test(1, 0)) + +#endif @@ -155,5 +191,33 @@ #endif + + +#if @(Project.Android.MultiWindow.Enabled:Test(1, 0)) + + + #if @(Project.Android.MultiWindow.DefaultSizeWidth:IsSet) + + #endif + #if @(Project.Android.MultiWindow.DefaultSizeHeight:IsSet) + + #endif +#endif +#if @(Project.Android.MaxAspect:IsSet) + +#endif +#if @(Project.Android.AllowMultipleResumedActivities:Test(1, 0)) + +#endif +#if @(Project.Android.MultiWindow.MultiInstance:Test(1, 0)) + +#endif +#if @(Project.Android.PenWindow:Test(1, 0)) + +#endif diff --git a/lib/UnoCore/Targets/Android/app/src/main/res/values/styles.xml b/lib/UnoCore/Targets/Android/app/src/main/res/values/styles.xml index 7b34d6891..c81151ba4 100644 --- a/lib/UnoCore/Targets/Android/app/src/main/res/values/styles.xml +++ b/lib/UnoCore/Targets/Android/app/src/main/res/values/styles.xml @@ -13,6 +13,9 @@ #endif @null @(Project.Android.WindowIsTranslucent || 'false') +#if @(Project.Android.WindowLayoutInDisplayCutoutMode:IsSet) + @(Project.Android.WindowLayoutInDisplayCutoutMode || 'default') +#endif