Fixed
Status Update
Comments
jb...@google.com <jb...@google.com>
cl...@google.com <cl...@google.com> #2
I forgot to mention in the description that I'm using
Material version: androidx.compose.material3:material3:1.1.0-alpha08
IDE: Android Studio Electric Eel | 2022.1.1 Patch 2
Kotlin version : 1.8.10
Compose version : 1.3.3
this is the sample code.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DatePickSample(
colors: DatePickerColors = DatePickerDefaults.colors(
containerColor = Color.DarkGray,
titleContentColor = Color.White,
headlineContentColor = Color.White,
weekdayContentColor = Color.White,
subheadContentColor = Color.White,
currentYearContentColor = Color.White,
yearContentColor = Color.White,
selectedYearContainerColor = Color.DarkGray,
selectedYearContentColor = Color.White,
dayContentColor = Color.White,
selectedDayContainerColor = Color.Black,
selectedDayContentColor = Color.White,
disabledDayContentColor = Color.LightGray,
todayContentColor = Color.White,
todayDateBorderColor = Color.White,
disabledSelectedDayContainerColor = Color.DarkGray,
disabledSelectedDayContentColor = Color.White,
dayInSelectionRangeContentColor = Color.White,
dayInSelectionRangeContainerColor = Color.White,
),
) {
val openDialog = remember { mutableStateOf(false) }
if (openDialog.value) {
val datePickerState = rememberDatePickerState(initialSelectedDateMillis = Date().time)
val confirmEnabled = remember {
derivedStateOf { datePickerState.selectedDateMillis != null }
}
DatePickerDialog(
onDismissRequest = {
openDialog.value = false
},
confirmButton = {
Button( onClick = {
openDialog.value = false
println("date selected: ${datePickerState.selectedDateMillis}")
},
colors = ButtonDefaults.buttonColors(
containerColor = Color.LightGray,
contentColor = Color.Black
)
) {
Text(text = "ok")
}
},
dismissButton = {
Button( onClick = {
openDialog.value = false
},
colors = ButtonDefaults.buttonColors(
containerColor = Color.LightGray,
contentColor = Color.Black
)
) {
Text(text = "cancel")
}
},
colors = colors,
) {
DatePicker(
state = datePickerState,
colors = colors,
showModeToggle = false
)
}
}
Button( onClick = {
openDialog.value = !openDialog.value
}) {
Text(text = "toggle date picker", color = Color.White)
}
}
Colors also not set when you set showModeToggle to true and click on InputMode
PS: It should be possible to customize the colors of the all datepicker's UI elements based on the app's own color scheme, in addition to the predefined color schemes provided by MaterialTheme
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 8b3441338fc74687fed347fe85fe8ed9dc6b9844
Author: Shalom Gibly <sgibly@google.com>
Date: Thu Mar 30 05:34:49 2023
Additional color customizations for date pickers
Updates to the DatePickerColors to include additional color params for
the date picker dividers and navigation components, as well as a
TextFieldColors parameter for customizing the text fields when in a date
input mode.
Bug: 274626815
Test: Manual & verified that the screenshot tests are passing
RelNote: "Updated the DatePickerColors to include additional
customization options for the date picker divider, navigation, and text
input fields colors."
Change-Id: I1a6856afd9a84e2aec18ece4ed6646b7f4ff4079
M compose/material3/material3/api/public_plus_experimental_current.txt
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
https://android-review.googlesource.com/2514032
Branch: androidx-main
commit 8b3441338fc74687fed347fe85fe8ed9dc6b9844
Author: Shalom Gibly <sgibly@google.com>
Date: Thu Mar 30 05:34:49 2023
Additional color customizations for date pickers
Updates to the DatePickerColors to include additional color params for
the date picker dividers and navigation components, as well as a
TextFieldColors parameter for customizing the text fields when in a date
input mode.
Bug: 274626815
Test: Manual & verified that the screenshot tests are passing
RelNote: "Updated the DatePickerColors to include additional
customization options for the date picker divider, navigation, and text
input fields colors."
Change-Id: I1a6856afd9a84e2aec18ece4ed6646b7f4ff4079
M compose/material3/material3/api/public_plus_experimental_current.txt
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
jb...@google.com <jb...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3-android:1.2.0-alpha02
pr...@google.com <pr...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-runtime:2.8.0-alpha03
Description
Component used: Navigation Version used: 2.7.6 Devices/Android versions reproduced on: any devices
When using
saveState
andrestoreState
in Nested Navigation, the ViewModel whose parent BackStackEntry is Owner is not restored.I have attached the project to reproduce, so please check it.