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

Commit 1a848af4 authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Create style for AlertDialog in SystemUI

This creates the style up to the design spec and customizes the
following:
* Dialog icon on top of title
* Font sizes and colors
* Buttons
* Padding

Using R.style.Theme_SystemUI_Dialog for an AlertDialog (or preferably a
SystemUIDialog) will make sure that the correct style is applied.

Test: manual, using a test dialog
Fixes: 203666386
Change-Id: Ied39acb05295dea1e1e353ef504d013900a97266
Merged-In: Ied39acb05295dea1e1e353ef504d013900a97266
parent b17c10f6
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2021 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.
  -->
<selector xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
          xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="?androidprv:attr/textColorOnAccent" />
</selector>
 No newline at end of file
+6 −6
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@
  -->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
       android:insetTop="@dimen/qs_dialog_button_vertical_inset"
       android:insetBottom="@dimen/qs_dialog_button_vertical_inset">
       android:insetTop="@dimen/dialog_button_vertical_inset"
       android:insetBottom="@dimen/dialog_button_vertical_inset">
    <ripple android:color="?android:attr/colorControlHighlight">
        <item android:id="@android:id/mask">
            <shape android:shape="rectangle">
@@ -29,10 +29,10 @@
            <shape android:shape="rectangle">
                <corners android:radius="?android:attr/buttonCornerRadius"/>
                <solid android:color="?androidprv:attr/colorAccentPrimary"/>
                <padding android:left="@dimen/qs_dialog_button_horizontal_padding"
                         android:top="@dimen/qs_dialog_button_vertical_padding"
                         android:right="@dimen/qs_dialog_button_horizontal_padding"
                         android:bottom="@dimen/qs_dialog_button_vertical_padding"/>
                <padding android:left="@dimen/dialog_button_horizontal_padding"
                         android:top="@dimen/dialog_button_vertical_padding"
                         android:right="@dimen/dialog_button_horizontal_padding"
                         android:bottom="@dimen/dialog_button_vertical_padding"/>
            </shape>
        </item>
    </ripple>
+6 −6
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@
  -->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
       android:insetTop="@dimen/qs_dialog_button_vertical_inset"
       android:insetBottom="@dimen/qs_dialog_button_vertical_inset">
       android:insetTop="@dimen/dialog_button_vertical_inset"
       android:insetBottom="@dimen/dialog_button_vertical_inset">
    <ripple android:color="?android:attr/colorControlHighlight">
        <item android:id="@android:id/mask">
            <shape android:shape="rectangle">
@@ -32,10 +32,10 @@
                <stroke android:color="?androidprv:attr/colorAccentPrimary"
                        android:width="1dp"
                />
                <padding android:left="@dimen/qs_dialog_button_horizontal_padding"
                         android:top="@dimen/qs_dialog_button_vertical_padding"
                         android:right="@dimen/qs_dialog_button_horizontal_padding"
                         android:bottom="@dimen/qs_dialog_button_vertical_padding"/>
                <padding android:left="@dimen/dialog_button_horizontal_padding"
                         android:top="@dimen/dialog_button_vertical_padding"
                         android:right="@dimen/dialog_button_horizontal_padding"
                         android:bottom="@dimen/dialog_button_vertical_padding"/>
            </shape>
        </item>
    </ripple>
+63 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!--
  ~ Copyright (C) 2021 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.
  -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@*android:id/buttonPanel"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:scrollbarAlwaysDrawVerticalTrack="true"
    android:scrollIndicators="top|bottom"
    android:fillViewport="true"
    android:paddingTop="@dimen/dialog_button_bar_top_padding"
    android:paddingStart="@dimen/dialog_side_padding"
    android:paddingEnd="@dimen/dialog_side_padding"
    android:paddingBottom="@dimen/dialog_bottom_padding"
    style="?android:attr/buttonBarStyle">
    <com.android.internal.widget.ButtonBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layoutDirection="locale"
        android:orientation="horizontal"
        android:gravity="bottom">

        <Button
            android:id="@android:id/button3"
            style="?android:attr/buttonBarNeutralButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <Space
            android:id="@*android:id/spacer"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:visibility="invisible" />

        <Button
            android:id="@android:id/button2"
            style="?android:attr/buttonBarNegativeButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <Button
            android:id="@android:id/button1"
            style="?android:attr/buttonBarPositiveButtonStyle"
            android:layout_marginStart="8dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </com.android.internal.widget.ButtonBarLayout>
</ScrollView>
 No newline at end of file
+91 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!--
  ~ Copyright (C) 2021 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.
  -->
<com.android.internal.widget.AlertDialogLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@*android:id/parentPanel"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal|top"
    android:orientation="vertical"
    android:paddingTop="@dimen/dialog_top_padding"
    >

    <include layout="@layout/alert_dialog_title_systemui" />

    <FrameLayout
        android:id="@*android:id/contentPanel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="48dp"
        android:paddingStart="@dimen/dialog_side_padding"
        android:paddingEnd="@dimen/dialog_side_padding"
        >

        <ScrollView
            android:id="@*android:id/scrollView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipToPadding="false">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <Space
                    android:id="@*android:id/textSpacerNoTitle"
                    android:visibility="gone"
                    android:layout_width="match_parent"
                    android:layout_height="0dp" />

                <TextView
                    android:id="@*android:id/message"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    style="@style/TextAppearance.Dialog.Body.Message" />

                <Space
                    android:id="@*android:id/textSpacerNoButtons"
                    android:visibility="gone"
                    android:layout_width="match_parent"
                    android:layout_height="6dp" />
            </LinearLayout>
        </ScrollView>
    </FrameLayout>

    <FrameLayout
        android:id="@*android:id/customPanel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="48dp"
        android:paddingStart="@dimen/dialog_side_padding"
        android:paddingEnd="@dimen/dialog_side_padding"
        >

        <FrameLayout
            android:id="@*android:id/custom"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </FrameLayout>

    <include
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        layout="@layout/alert_dialog_button_bar_systemui" />

</com.android.internal.widget.AlertDialogLayout>
 No newline at end of file
Loading