Fixed
Status Update
Comments
ga...@google.com <ga...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 924b7e11734c0cd506a496f448e1a96b7b86ee68
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Feb 02 14:19:35 2022
Take CreationExtras in activity viewModel function
Add function to take CreationExtras in the viewModels -ktx extension
function.
RelNote: "You can now pass `CreationExtras` to the activity by
viewModels function"
Test: ActivityViewModelLazyTest
Bug: 217600303
Change-Id: I6a3e64fb4ec1c18510ab5f45b3533de586f50d77
M activity/activity-ktx/api/current.txt
M activity/activity-ktx/api/restricted_current.txt
M activity/activity-ktx/api/api_lint.ignore
M activity/activity-ktx/src/main/java/androidx/activity/ActivityViewModelLazy.kt
M activity/activity-ktx/api/public_plus_experimental_current.txt
M activity/activity-ktx/src/androidTest/java/androidx/activity/ActivityViewModelLazyTest.kt
https://android-review.googlesource.com/1969581
Branch: androidx-main
commit 924b7e11734c0cd506a496f448e1a96b7b86ee68
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Feb 02 14:19:35 2022
Take CreationExtras in activity viewModel function
Add function to take CreationExtras in the viewModels -ktx extension
function.
RelNote: "You can now pass `CreationExtras` to the activity by
viewModels function"
Test: ActivityViewModelLazyTest
Bug: 217600303
Change-Id: I6a3e64fb4ec1c18510ab5f45b3533de586f50d77
M activity/activity-ktx/api/current.txt
M activity/activity-ktx/api/restricted_current.txt
M activity/activity-ktx/api/api_lint.ignore
M activity/activity-ktx/src/main/java/androidx/activity/ActivityViewModelLazy.kt
M activity/activity-ktx/api/public_plus_experimental_current.txt
M activity/activity-ktx/src/androidTest/java/androidx/activity/ActivityViewModelLazyTest.kt
[Deleted User] <[Deleted User]> #3
This has been added internally and will be available in the Activity 1.5.0-alpha03
release.
[Deleted User] <[Deleted User]> #4
redacted
ba...@gmail.com <ba...@gmail.com> #5
Won't Fix (Intended behavior)
Is it intended that DatePickerDialog which is backed by android.app.AlertDialog doesn't look as expected?
There is no support version of this picker.
Is it intended that DatePickerDialog which is backed by android.app.AlertDialog doesn't look as expected?
There is no support version of this picker.
[Deleted User] <[Deleted User]> #6
I am using androidx.appcompat.app.AlertDialog already and the buttons still get replaced.
My solution is to use <item name="materialButtonStyle">@style/Widget.MaterialComponents.Button.TextButton</item> in the app theme.
My solution is to use <item name="materialButtonStyle">@style/Widget.MaterialComponents.Button.TextButton</item> in the app theme.
da...@loylap.com <da...@loylap.com> #7
AlertDialogs still do seem to mostly behave if you use androidx app compat for me. With no styling they show a dialog with unfilled text buttons, where the text color is your colorPrimary. It seems to do weird things though. Like invert your colors and swap colorPrimary with colorSecondary sometimes. For example if I give it a style like this:
<style name="MyOutlinedButton.Secondary" parent="Widget.MaterialComponents.Button.OutlinedButton>
<item name="rippleColor">?attr/colorSecondary</item>
<item name="android:textColor">?attr/colorSecondary</item>
<item name="strokeColor">?attr/colorSecondary</item>
</style>
<style name="MyDialogTheme" parent="@style/Theme.MaterialComponents.Light.Dialog.Alert">
<item name="materialButtonStyle">@style/LLOutlinedButton.Secondary</item>
</style>
Where a normal MyOutlinedButton.Secondary button has ripple, text and stroke set to colorSecondary. A button in the dialog has a ripple and text set to colorSecondary but the stroke is colorPrimary.
I also noticed that the material 1.0.0-rc1 lib (just before the first release) did that across the board with normal buttons. When I upgraded to 1.0.0 all of my buttons swapped from secondary to primary. So I suspect that was fixed on release for nearly everything, but the alert dialog wasn't.
If I style it like this:
<style name="MyDialogTheme" parent="@style/Theme.MaterialComponents.Light.Dialog.Alert">
<item name="colorPrimary">?attr/colorSecondary</item>
</style>
My button color is changed to a default shade of teal, so this basically doesn't work.
If I style it like this using a "hardcoded" color:
<style name="MyDialogTheme" parent="@style/Theme.MaterialComponents.Light.Dialog.Alert">
<item name="colorPrimary">@color/secondary</item>
</style>
The button text color does change..., so go figure.
<style name="MyOutlinedButton.Secondary" parent="Widget.MaterialComponents.Button.OutlinedButton>
<item name="rippleColor">?attr/colorSecondary</item>
<item name="android:textColor">?attr/colorSecondary</item>
<item name="strokeColor">?attr/colorSecondary</item>
</style>
<style name="MyDialogTheme" parent="@style/Theme.MaterialComponents.Light.Dialog.Alert">
<item name="materialButtonStyle">@style/LLOutlinedButton.Secondary</item>
</style>
Where a normal MyOutlinedButton.Secondary button has ripple, text and stroke set to colorSecondary. A button in the dialog has a ripple and text set to colorSecondary but the stroke is colorPrimary.
I also noticed that the material 1.0.0-rc1 lib (just before the first release) did that across the board with normal buttons. When I upgraded to 1.0.0 all of my buttons swapped from secondary to primary. So I suspect that was fixed on release for nearly everything, but the alert dialog wasn't.
If I style it like this:
<style name="MyDialogTheme" parent="@style/Theme.MaterialComponents.Light.Dialog.Alert">
<item name="colorPrimary">?attr/colorSecondary</item>
</style>
My button color is changed to a default shade of teal, so this basically doesn't work.
If I style it like this using a "hardcoded" color:
<style name="MyDialogTheme" parent="@style/Theme.MaterialComponents.Light.Dialog.Alert">
<item name="colorPrimary">@color/secondary</item>
</style>
The button text color does change..., so go figure.
da...@loylap.com <da...@loylap.com> #8
(I have a small typo and this horrible issue tracker won't let you edit things so LLOutlinedButton.Secondary should read MyOutlinedButton.Secondary)
ch...@gmail.com <ch...@gmail.com> #9
Intended behaviour seems to me like a joke. Every default dialog (e.g. from settings) is an AlertDialog, not an AlertDialog-v7. So most of my dialogs have filled buttons now. This should be fixed.
As I don't believe in a quick fix, please use this workaround:
Add a new style to your styles.xml:
<style name="Theme.Custom.Material.Alert.Dialog.Light" parent="Theme.MaterialComponents.Light.Dialog.Alert">
<item name="materialButtonStyle">@style/Widget.AppCompat.Button.Borderless</item>
</style>
Then just replace the default alert dialog in your style (which should be used in Manifest of course):
<style name="Theme.Custom.Material.Base.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:dialogTheme">@style/Theme.Custom.Material.Alert.Dialog.Light</item>
<item name="android:alertDialogTheme">@style/Theme.Custom.Material.Alert.Dialog.Light</item>
....
</style>
As I don't believe in a quick fix, please use this workaround:
Add a new style to your styles.xml:
<style name="Theme.Custom.Material.Alert.Dialog.Light" parent="Theme.MaterialComponents.Light.Dialog.Alert">
<item name="materialButtonStyle">@style/Widget.AppCompat.Button.Borderless</item>
</style>
Then just replace the default alert dialog in your style (which should be used in Manifest of course):
<style name="Theme.Custom.Material.Base.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:dialogTheme">@style/Theme.Custom.Material.Alert.Dialog.Light</item>
<item name="android:alertDialogTheme">@style/Theme.Custom.Material.Alert.Dialog.Light</item>
....
</style>
[Deleted User] <[Deleted User]> #10
The issue still persists. If current behavior is intended, then there must exist an androidx version of every default dialog, including the DatePickerDialog.
Currently the only solution is a workaround provided above (thank you very much for it!).
Currently the only solution is a workaround provided above (thank you very much for it!).
fr...@gmail.com <fr...@gmail.com> #11
Hi i have this problem too for example on a preference input type = password ! The "cancel" and "Ok" buttons have filled background. This looks very ugly with material components
How can i fix this in the preference input dialog with the posivite and negative button ?
How can i fix this in the preference input dialog with the posivite and negative button ?
Description
Could be related to auto inflation of MaterialButtons. Doesn't happen for android.support.v7.app.AlertDialog.