Status Update
Comments
sg...@google.com <sg...@google.com>
ap...@google.com <ap...@google.com> #2
Related to
na...@google.com <na...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
Author: Shalom Gibly <
Link:
Date pickers Locale support
Expand for full commit details
Date pickers Locale support
This change improves how the DatePicker and DateRangePicker handle
locales when a Locale that was set by the date picker's state wasn't
consistently applied to all its parts, leading to potential
inconsistencies in things like date formatting, weekday names, the
first day of the week, etc.
The DatePickerState and the DateRangePickerState were modified to
include and expose a Locale value that can be used by the various parts
of the UI.
There are two ways to create the state:
- Using remember functions: This will default to your device's locale
and is the recommended way.
- Using DatePickerState or DateRangePickerState directly: This allows
you to specify a custom Locale that will be applied most of the date
picker parts, but not all. Note that the title and the headline's
default text will need to be adjusted to support a specific Locale in
case a specific one is set.
Fixes: 326490763
Fixes: 321657276
Test: additional date picker and input tests
Relnote: "Updates to the date pickers to ensure consistent Locale
usage throughout the DatePicker and DateRangePicker when setting a
Locale directly through a DatePickerState or a DateRangePickerState.
Note that when setting Locales directly to the state, it's up to you to
ensure that the title and headline texts are localized accordingly, as
their default text will still be applied according to the default
platform Locale."
Change-Id: I370735477b6adae8628fb967b6aa6c6138216883
Files:
- M
compose/material3/material3/api/current.txt
- M
compose/material3/material3/api/restricted_current.txt
- M
compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/DatePickerSamples.kt
- M
compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/DateInputTest.kt
- M
compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/DatePickerScreenshotTest.kt
- M
compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/DatePickerTest.kt
- M
compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/DateRangeInputTest.kt
- M
compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/DateRangePickerScreenshotTest.kt
- M
compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/DateRangePickerTest.kt
- M
compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DateInput.kt
- M
compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DatePicker.kt
- M
compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DateRangeInput.kt
- M
compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DateRangePicker.kt
Hash: 2579989ac2b9c281d530ffbf1d1bd9d89fb91270
Date: Mon Sep 30 10:51:27 2024
de...@gmail.com <de...@gmail.com> #4
Fixed. Please read the commit details for some "gotchas" when applying the Locale just on the picker's state.
To force every part of the picker into a non-default Locale, you can do something like this:
val preferredLocales = LocaleList.forLanguageTags("hr")
val config = Configuration()
config.setLocales(preferredLocales)
val newContext = LocalContext.current.createConfigurationContext(config)
CompositionLocalProvider(
LocalContext provides newContext,
LocalConfiguration provides config
) {
DatePicker(state = rememberDatePickerState())
}
sg...@google.com <sg...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3:1.4.0-alpha02
androidx.compose.material3:material3-android:1.4.0-alpha02
androidx.compose.material3:material3-jvmstubs:1.4.0-alpha02
androidx.compose.material3:material3-linuxx64stubs:1.4.0-alpha02
ph...@gmail.com <ph...@gmail.com> #6
Issue for Medium and Large Top App Bars:
Description
Starting with
1.0.0-beta02
, trying to set the container color of a TopAppBar to be transparent no longer works.It looks like inhttps://android-review.googlesource.com/c/platform/frameworks/support/+/2189523 the behavior was changed so that there is always a
Surface
with the default color underneath the TopAppBar, whose color can't be configured to be transparent.Example usage:https://github.com/android/nowinandroid/blob/main/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt#L143-L145