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

Commit 1536e49a authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

Make SysUI dialogs more consistent

This CL makes SysUI dialogs more consistent by ensuring they are using
the same button styles and paddings. I decided to be strongly
opinionated: the primary buttons are all filled and on the right, the
secondary button are hairline and on the left.

See b/203666386#comment13 for a video.

Bug: 203666386
Test: Manual
Change-Id: I587d9537309357555229db411edfb154151a92e7
Merged-In: I587d9537309357555229db411edfb154151a92e7
parent 7339a87b
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ public class EnableZenModeDialog {
    @VisibleForTesting
    protected Context mContext;
    private final int mThemeResId;
    private final boolean mCancelIsNeutral;
    @VisibleForTesting
    protected TextView mZenAlarmWarning;
    @VisibleForTesting
@@ -101,8 +102,13 @@ public class EnableZenModeDialog {
    }

    public EnableZenModeDialog(Context context, int themeResId) {
        this(context, themeResId, false /* cancelIsNeutral */);
    }

    public EnableZenModeDialog(Context context, int themeResId, boolean cancelIsNeutral) {
        mContext = context;
        mThemeResId = themeResId;
        mCancelIsNeutral = cancelIsNeutral;
    }

    public AlertDialog createDialog() {
@@ -115,7 +121,6 @@ public class EnableZenModeDialog {

        final AlertDialog.Builder builder = new AlertDialog.Builder(mContext, mThemeResId)
                .setTitle(R.string.zen_mode_settings_turn_on_dialog_title)
                .setNegativeButton(R.string.cancel, null)
                .setPositiveButton(R.string.zen_mode_enable_dialog_turn_on,
                        new DialogInterface.OnClickListener() {
                            @Override
@@ -145,6 +150,12 @@ public class EnableZenModeDialog {
                            }
                        });

        if (mCancelIsNeutral) {
            builder.setNeutralButton(R.string.cancel, null);
        } else {
            builder.setNegativeButton(R.string.cancel, null);
        }

        View contentView = getContentView();
        bindConditions(forever());
        builder.setView(contentView);
+0 −30
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
  -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
       android:shape="rectangle">
    <stroke
        android:color="?androidprv:attr/colorAccentPrimaryVariant"
        android:width="1dp"/>
    <corners android:radius="20dp"/>
    <padding
        android:left="8dp"
        android:right="8dp"
        android:top="4dp"
        android:bottom="4dp" />
    <solid android:color="@android:color/transparent" />
</shape>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
            <shape android:shape="rectangle">
                <corners android:radius="?android:attr/buttonCornerRadius"/>
                <solid android:color="@android:color/transparent"/>
                <stroke android:color="?androidprv:attr/colorAccentPrimary"
                <stroke android:color="?androidprv:attr/colorAccentPrimaryVariant"
                        android:width="1dp"
                />
                <padding android:left="@dimen/dialog_button_horizontal_padding"
+0 −30
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
  -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
       android:shape="rectangle">
    <stroke
        android:color="?androidprv:attr/colorAccentPrimary"
        android:width="1dp"/>
    <corners android:radius="24dp"/>
    <padding
        android:left="16dp"
        android:right="16dp"
        android:top="8dp"
        android:bottom="8dp" />
    <solid android:color="@android:color/transparent" />
</shape>
+14 −24
Original line number Diff line number Diff line
@@ -381,54 +381,44 @@
                android:id="@+id/button_layout"
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="48dp"
                android:layout_marginStart="24dp"
                android:layout_marginEnd="24dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:layout_marginBottom="34dp"
                android:layout_marginStart="@dimen/dialog_side_padding"
                android:layout_marginEnd="@dimen/dialog_side_padding"
                android:layout_marginBottom="@dimen/dialog_bottom_padding"
                android:clickable="false"
                android:focusable="false">

                <FrameLayout
                    android:id="@+id/apm_layout"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:layout_height="wrap_content"
                    android:clickable="true"
                    android:focusable="true"
                    android:layout_gravity="start|center_vertical"
                    android:orientation="vertical">
                    <Button
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/turn_off_airplane_mode"
                        android:ellipsize="end"
                        style="@*android:style/Widget.DeviceDefault.Button.Borderless.Colored"
                        android:layout_width="wrap_content"
                        android:layout_height="36dp"
                        android:layout_gravity="start|center_vertical"
                        android:textAppearance="@style/TextAppearance.InternetDialog"
                        android:textSize="14sp"
                        android:background="@drawable/internet_dialog_footer_background"
                        style="@style/Widget.Dialog.Button.BorderButton"
                        android:clickable="false"/>
                </FrameLayout>

                <FrameLayout
                    android:id="@+id/done_layout"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="16dp"
                    android:clickable="true"
                    android:focusable="true"
                    android:layout_gravity="end|center_vertical"
                    android:orientation="vertical">
                    android:clickable="true"
                    android:focusable="true">
                    <Button
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/inline_done_button"
                        android:ellipsize="end"
                        style="@*android:style/Widget.DeviceDefault.Button.Borderless.Colored"
                        android:layout_width="67dp"
                        android:layout_height="36dp"
                        android:layout_gravity="end|center_vertical"
                        android:textAppearance="@style/TextAppearance.InternetDialog"
                        android:textSize="14sp"
                        android:background="@drawable/internet_dialog_footer_background"
                        style="@style/Widget.Dialog.Button"
                        android:clickable="false"/>
                </FrameLayout>
            </FrameLayout>
Loading