Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26bc13d9 authored by Chen Bai's avatar Chen Bai Committed by Android (Google) Code Review
Browse files

Merge "m3: impl changed material3 AlertDialog design" into main

parents 54ed719e abd6efd2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
    <solid android:color="@color/btn_material_filled_tonal_background_color"/>
    <corners android:radius="@dimen/config_bottomDialogCornerRadius" />
    <corners android:radius="@dimen/config_wearMaterial3_bottomDialogCornerRadius" />
    <size
        android:width="@dimen/dialog_btn_negative_width"
        android:height="@dimen/dialog_btn_negative_height" />
+123 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2024 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<!-- This layout is the AlertDialog template. It overrides the system layout with the same name.
    Make sure to include all the existing id of the overridden alert_dialog_material.-->
<com.android.internal.widget.WatchListDecorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/parentPanel"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ScrollView
        android:id="@+id/scrollView"
        android:fillViewport="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <!-- Top Panel -->
            <FrameLayout
                android:paddingLeft="?dialogPreferredPadding"
                android:paddingRight="?dialogPreferredPadding"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/topPanel"
                android:minHeight="@dimen/dialog_list_padding_top_no_title">
                <include android:id="@+id/title_template"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         layout="@layout/alert_dialog_title_material"/>
            </FrameLayout>

            <!-- Content Panel -->
            <FrameLayout android:id="@+id/contentPanel"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:clipToPadding="false">
                <TextView android:id="@+id/message"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:gravity="center_horizontal|top"
                          android:textAppearance="@style/TextAppearance.DeviceDefault.Body1"
                          android:paddingStart="?dialogPreferredPadding"
                          android:paddingEnd="?dialogPreferredPadding"
                          android:paddingTop="8dip"
                          android:paddingBottom="8dip"/>
            </FrameLayout>

            <!-- Custom Panel, to replace content panel if needed -->
            <FrameLayout android:id="@+id/customPanel"
                         android:layout_width="match_parent"
                         android:layout_height="match_parent"
                         android:minHeight="64dp">
                <FrameLayout android:id="@+android:id/custom"
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content" />
            </FrameLayout>

            <!-- Button Panel -->
            <FrameLayout
                android:id="@+id/buttonPanel"
                android:minHeight="@dimen/dialog_list_padding_bottom_no_buttons"
                android:layout_weight="1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center">
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:orientation="horizontal"
                    android:paddingBottom="?dialogPreferredPadding"
                    style="?android:attr/buttonBarStyle"
                    android:measureWithLargestChild="true">
                    <Button android:id="@+id/button2"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:gravity="center"
                            android:layout_weight="1"
                            style="@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog.WearMaterial3.Negative" />
                    <Button android:id="@+id/button3"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:gravity="center"
                            android:layout_weight="1"
                            style="?android:attr/buttonBarButtonStyle"/>
                    <FrameLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">
                        <Button android:id="@+id/button1"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_gravity="center"
                                android:gravity="center"
                                android:layout_weight="1"
                                style="@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog.WearMaterial3.Confirm" />
                        <!-- This works as background. -->
                        <ImageView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:src="@drawable/dialog_alert_button_positive"/>
                    </FrameLayout>
                </LinearLayout>
            </FrameLayout>
        </LinearLayout>
    </ScrollView>
</com.android.internal.widget.WatchListDecorLayout>
+7 −17
Original line number Diff line number Diff line
@@ -82,9 +82,8 @@
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:orientation="horizontal"
                    android:orientation="vertical"
                    android:paddingBottom="?dialogPreferredPadding"
                    style="?android:attr/buttonBarStyle"
                    android:measureWithLargestChild="true">
                    <Button android:id="@+id/button2"
                            android:layout_width="wrap_content"
@@ -92,7 +91,7 @@
                            android:layout_gravity="center"
                            android:gravity="center"
                            android:layout_weight="1"
                            style="@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog.Negative" />
                            style="@*android:style/Widget.DeviceDefault.Button.WearMaterial3"/>
                    <Button android:id="@+id/button3"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
@@ -100,22 +99,13 @@
                            android:gravity="center"
                            android:layout_weight="1"
                            style="?android:attr/buttonBarButtonStyle"/>
                    <FrameLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">
                    <Button android:id="@+id/button1"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_gravity="center"
                            android:gravity="center"
                            android:layout_weight="1"
                                style="@style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog.Confirm"/>
                        <!-- This works as background. -->
                        <ImageView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:src="@drawable/dialog_alert_button_positive"/>
                    </FrameLayout>
                            style="@*android:style/Widget.DeviceDefault.Button.Filled"/>
                </LinearLayout>
            </FrameLayout>
        </LinearLayout>
+1 −1
Original line number Diff line number Diff line
@@ -16,5 +16,5 @@

<resources>
    <dimen name="config_wearMaterial3_buttonCornerRadius">26dp</dimen>
    <dimen name="config_bottomDialogCornerRadius">18dp</dimen>
    <dimen name="config_wearMaterial3_bottomDialogCornerRadius">18dp</dimen>
</resources>
+3 −3
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@
    </style>

    <!--  AlertDialog Styles  -->
    <style name="Widget.DeviceDefault.Button.ButtonBar.AlertDialog" parent="Widget.DeviceDefault.Button">
    <style name="Widget.DeviceDefault.Button.ButtonBar.AlertDialog.WearMaterial3" parent="Widget.DeviceDefault.Button">
        <item name="android:textSize">0sp</item>
        <item name="android:gravity">center</item>
        <item name="android:paddingStart">0dp</item>
@@ -65,14 +65,14 @@
        <item name="android:drawablePadding">0dp</item>
    </style>

    <style name="Widget.DeviceDefault.Button.ButtonBar.AlertDialog.Confirm" parent="Widget.DeviceDefault.Button.ButtonBar.AlertDialog">
    <style name="Widget.DeviceDefault.Button.ButtonBar.AlertDialog.WearMaterial3.Confirm">
        <!-- Use a ImageView as background -->
        <item name="background">@android:color/transparent</item>
        <item name="minWidth">@dimen/dialog_btn_confirm_width</item>
        <item name="minHeight">@dimen/dialog_btn_confirm_height</item>
    </style>

    <style name="Widget.DeviceDefault.Button.ButtonBar.AlertDialog.Negative" parent="Widget.DeviceDefault.Button.ButtonBar.AlertDialog">
    <style name="Widget.DeviceDefault.Button.ButtonBar.AlertDialog.WearMaterial3.Negative">
        <item name="background">@drawable/dialog_alert_button_negative</item>
        <item name="minWidth">@dimen/dialog_btn_negative_width</item>
        <item name="minHeight">@dimen/dialog_btn_negative_height</item>