Fixed
Status Update
Comments
lp...@google.com <lp...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 9082f62682f853ad5251a1c79dde9eccba7abdd9
Author: Max Alfonso-Ying <maxying@google.com>
Date: Thu Apr 18 00:34:40 2024
[M2 text field] Apply background to decoration box
...instead of to the BasicTextField, so changing the
backgroundColor will properly change the decoration
box's background color.
Fixes: b/307694651
Test: added unit tests
Relnote: "Fix backgroundColor not applying to
TextFieldDecorationBox and OutlinedTextFieldDecorationBox.
Decoration boxes now accept a `shape` parameter."
Change-Id: I371c26718597cb36ac537e9412ce476532afb40d
M compose/material/material/api/current.txt
M compose/material/material/api/restricted_current.txt
M compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/TextFieldDecorationBoxDemos.kt
M compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/textfield/TextFieldDecorationBoxTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/OutlinedTextField.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextField.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
https://android-review.googlesource.com/3046833
Branch: androidx-main
commit 9082f62682f853ad5251a1c79dde9eccba7abdd9
Author: Max Alfonso-Ying <maxying@google.com>
Date: Thu Apr 18 00:34:40 2024
[M2 text field] Apply background to decoration box
...instead of to the BasicTextField, so changing the
backgroundColor will properly change the decoration
box's background color.
Fixes:
Test: added unit tests
Relnote: "Fix backgroundColor not applying to
TextFieldDecorationBox and OutlinedTextFieldDecorationBox.
Decoration boxes now accept a `shape` parameter."
Change-Id: I371c26718597cb36ac537e9412ce476532afb40d
M compose/material/material/api/current.txt
M compose/material/material/api/restricted_current.txt
M compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/TextFieldDecorationBoxDemos.kt
M compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/textfield/TextFieldDecorationBoxTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/OutlinedTextField.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextField.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
ad...@google.com <ad...@google.com> #3
Yes, definitely related.
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 36faab79e432504b1274aeb5c4375cc664f6d98d
Author: Mihai Popa <popam@google.com>
Date: Mon Jul 05 17:40:45 2021
Default true usePlatformDefaultWidth for dialogs
Relnote: "Dialogs now follow the platform sizing behaviour. Set usePlatformDefaultWidth to false to override this behaviour."
Fixes: 192682388
Test: AlertDialogTest
Change-Id: Iffaedb8890f59627a58fb4f33d06044ac120fd7d
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/AlertDialogTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/window/AndroidDialog.android.kt
https://android-review.googlesource.com/1756490
Branch: androidx-main
commit 36faab79e432504b1274aeb5c4375cc664f6d98d
Author: Mihai Popa <popam@google.com>
Date: Mon Jul 05 17:40:45 2021
Default true usePlatformDefaultWidth for dialogs
Relnote: "Dialogs now follow the platform sizing behaviour. Set usePlatformDefaultWidth to false to override this behaviour."
Fixes: 192682388
Test: AlertDialogTest
Change-Id: Iffaedb8890f59627a58fb4f33d06044ac120fd7d
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/AlertDialogTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/window/AndroidDialog.android.kt
ha...@gmail.com <ha...@gmail.com> #5
In reply to last comment,
This commit still has issue, as you are passing the default value of usePlatformDefaultWidth true.
But in the inner constructor its not being used it is still hardcoded.
So if we pass usePlatformDefaultWidth = false, its not reflected in the object and thus issue is still there.
@Immutable
class DialogProperties @ExperimentalComposeUiApi constructor( //This constructor is used by app
val dismissOnBackPress: Boolean = true,
val dismissOnClickOutside: Boolean = true,
val securePolicy: SecureFlagPolicy = SecureFlagPolicy.Inherit,
val usePlatformDefaultWidth: Boolean = true,
decorFitsSystemWindows: Boolean = true
) {
@Suppress("OPT_IN_MARKER_ON_WRONG_TARGET", "CanBePrimaryConstructorProperty")
@get:ExperimentalComposeUiApi
@ExperimentalComposeUiApi
val decorFitsSystemWindows: Boolean = decorFitsSystemWindows
@OptIn(ExperimentalComposeUiApi::class)
constructor( // This is the inner constructor thus setting the value usePlatformDefaultWidth = true and not reflecting in the SDK code.
dismissOnBackPress: Boolean = true,
dismissOnClickOutside: Boolean = true,
securePolicy: SecureFlagPolicy = SecureFlagPolicy.Inherit,
) : this(
dismissOnBackPress = dismissOnBackPress,
dismissOnClickOutside = dismissOnClickOutside,
securePolicy = securePolicy,
usePlatformDefaultWidth = true,
decorFitsSystemWindows = true
)
This commit still has issue, as you are passing the default value of usePlatformDefaultWidth true.
But in the inner constructor its not being used it is still hardcoded.
So if we pass usePlatformDefaultWidth = false, its not reflected in the object and thus issue is still there.
@Immutable
class DialogProperties @ExperimentalComposeUiApi constructor( //This constructor is used by app
val dismissOnBackPress: Boolean = true,
val dismissOnClickOutside: Boolean = true,
val securePolicy: SecureFlagPolicy = SecureFlagPolicy.Inherit,
val usePlatformDefaultWidth: Boolean = true,
decorFitsSystemWindows: Boolean = true
) {
@Suppress("OPT_IN_MARKER_ON_WRONG_TARGET", "CanBePrimaryConstructorProperty")
@get:ExperimentalComposeUiApi
@ExperimentalComposeUiApi
val decorFitsSystemWindows: Boolean = decorFitsSystemWindows
@OptIn(ExperimentalComposeUiApi::class)
constructor( // This is the inner constructor thus setting the value usePlatformDefaultWidth = true and not reflecting in the SDK code.
dismissOnBackPress: Boolean = true,
dismissOnClickOutside: Boolean = true,
securePolicy: SecureFlagPolicy = SecureFlagPolicy.Inherit,
) : this(
dismissOnBackPress = dismissOnBackPress,
dismissOnClickOutside = dismissOnClickOutside,
securePolicy = securePolicy,
usePlatformDefaultWidth = true,
decorFitsSystemWindows = true
)
Description
Using the AlertDialog API as shown in the sample code here:https://cs.android.com/androidx/platform/tools/dokka-devsite-plugin/+/master:testData/compose/samples/material/samples/AlertDialogSample.kt;l=36 yields a dialog that extends all the way to the device screen edges as shown in the attached screenshot.
AlertDialogs should leave space near the edges as
android.app.AlertDialog
does.We should address this prior to 1.0 if we can; as-is it's seemingly mandatory to add a
Modifier.padding(24.dp)
to AlertDialog usages to avoid the edges of the screen.Other adaptive behavior for larger screens is out of scope for this change.