From 1c5c054b70a55c2567cdfee460d3876158b2945a Mon Sep 17 00:00:00 2001 From: conradchen Date: Mon, 24 Jan 2022 17:55:39 -0500 Subject: [PATCH] [Dialog] Fix crashes when colorControlHighlight is a CSL We set ?attr/colorControlHighlight as scroll indicators' background attribute. However, on older platforms this will crash the app due to Android expects a drawable or a plain color for the background attribute. Changes the view to TextView so it will be rendered as MaterialTextView, which supports app:backgroundTint with CSLs. Also changes the base background color to #1F000000 and the tint color to ?attr/colorForeground, which are aligned with what framework's alert dialog implementation is doing. Resolves https://github.com/material-components/material-components-android/issues/2455 PiperOrigin-RevId: 423917985 --- .../dialog/res/layout/m3_alert_dialog.xml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/java/com/google/android/material/dialog/res/layout/m3_alert_dialog.xml b/lib/java/com/google/android/material/dialog/res/layout/m3_alert_dialog.xml index 5569962528e..dc04f9d254e 100644 --- a/lib/java/com/google/android/material/dialog/res/layout/m3_alert_dialog.xml +++ b/lib/java/com/google/android/material/dialog/res/layout/m3_alert_dialog.xml @@ -16,6 +16,7 @@ --> - + android:background="#1f000000" + android:visibility="gone" + android:contentDescription="@null" + app:backgroundTint="?android:attr/colorForeground"/> - + android:background="#1f000000" + android:visibility="gone" + android:contentDescription="@null" + app:backgroundTint="?android:attr/colorForeground"/>