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

Commit 3aa3517d authored by Luca Stefani's avatar Luca Stefani
Browse files

DeskClock: Move from DropDownPreference to ListPreference

They don't really feel good on M3E

Change-Id: Ic679ee7e88cf6be93c05c8ec67c3a325119dc6ee
parent ccd06394
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners
        android:topLeftRadius="28dp"
        android:topRightRadius="28dp"/>
    <solid android:color="?attr/colorPrimary" />
</shape>
+0 −26
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
    style="?android:attr/spinnerDropDownItemStyle"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:ellipsize="marquee"
    android:gravity="center"
    android:maxLines="1"
    android:minWidth="112dp"
    android:paddingEnd="16dp"
    android:paddingStart="16dp" />
+3 −3
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:title="@string/app_label">

    <com.android.deskclock.settings.SimpleMenuPreference
    <ListPreference
        android:defaultValue="@string/default_clock_style"
        android:dialogTitle="@string/clock_style"
        android:entries="@array/clock_style_entries"
@@ -27,7 +27,7 @@
        android:title="@string/clock_style"
        app:iconSpaceReserved="false" />

    <com.android.deskclock.settings.SimpleMenuPreference
    <ListPreference
        android:defaultValue="@string/default_clock_color"
        android:entries="@array/clock_color_entries"
        android:entryValues="@array/clock_color_values"
@@ -70,7 +70,7 @@
            android:dependency="screensaver_night_mode"
            app:iconSpaceReserved="false" />

        <com.android.deskclock.settings.SimpleMenuPreference
        <ListPreference
            android:defaultValue="@string/default_clock_color"
            android:entries="@array/clock_color_entries"
            android:entryValues="@array/clock_color_values"
+5 −5
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
        android:title="@string/clock_settings"
        app:iconSpaceReserved="false">

        <com.android.deskclock.settings.SimpleMenuPreference
        <ListPreference
            android:defaultValue="@string/default_clock_style"
            android:dialogTitle="@string/clock_style"
            android:entries="@array/clock_style_entries"
@@ -117,7 +117,7 @@
            android:title="@string/crescendo_duration_title"
            app:iconSpaceReserved="false"  />

        <com.android.deskclock.settings.SimpleMenuPreference
        <ListPreference
            android:defaultValue="0"
            android:dialogTitle="@string/volume_button_setting_title"
            android:entries="@array/volume_button_setting_entries"
@@ -126,7 +126,7 @@
            android:title="@string/volume_button_setting_title"
            app:iconSpaceReserved="false"  />

        <com.android.deskclock.settings.SimpleMenuPreference
        <ListPreference
            android:defaultValue="0"
            android:dialogTitle="@string/flip_action_title"
            android:entries="@array/action_setting_entries"
@@ -135,7 +135,7 @@
            android:title="@string/flip_action_title"
            app:iconSpaceReserved="false"  />

        <com.android.deskclock.settings.SimpleMenuPreference
        <ListPreference
            android:defaultValue="0"
            android:dialogTitle="@string/shake_action_title"
            android:entries="@array/action_setting_entries"
@@ -144,7 +144,7 @@
            android:title="@string/shake_action_title"
            app:iconSpaceReserved="false"  />

        <com.android.deskclock.settings.SimpleMenuPreference
        <ListPreference
            android:dialogTitle="@string/week_start_title"
            android:entries="@array/week_start_entries"
            android:entryValues="@array/week_start_values"
+6 −5
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.os.Bundle;
import android.text.format.DateFormat;
import android.view.MenuItem;

import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.SeekBarPreference;
@@ -97,14 +98,14 @@ public final class ScreensaverSettingsActivity extends ToolbarBaseActivity {
        public boolean onPreferenceChange(Preference pref, Object newValue) {
            switch (pref.getKey()) {
                case KEY_CLOCK_STYLE:
                    final SimpleMenuPreference clockStylePref = (SimpleMenuPreference) pref;
                    final ListPreference clockStylePref = (ListPreference) pref;
                    final int clockStyleindex = clockStylePref.findIndexOfValue((String) newValue);
                    clockStylePref.setSummary(clockStylePref.getEntries()[clockStyleindex]);
                    setVisibility(newValue.equals(CLOCK_STYLE_DIGITAL));
                    break;
                case KEY_NIGHT_MODE_COLOR:
                case KEY_CLOCK_COLOR:
                    final SimpleMenuPreference clockColorPref = (SimpleMenuPreference) pref;
                    final ListPreference clockColorPref = (ListPreference) pref;
                    final int clockColorindex = clockColorPref.findIndexOfValue((String) newValue);
                    clockColorPref.setSummary(clockColorPref.getEntries()[clockColorindex]);
                    break;
@@ -119,9 +120,9 @@ public final class ScreensaverSettingsActivity extends ToolbarBaseActivity {
        }

        private void refresh() {
            final SimpleMenuPreference clockStylePref = findPreference(KEY_CLOCK_STYLE);
            final SimpleMenuPreference clockColorPref = findPreference(KEY_CLOCK_COLOR);
            final SimpleMenuPreference nightModeColorPref = findPreference(KEY_NIGHT_MODE_COLOR);
            final ListPreference clockStylePref = findPreference(KEY_CLOCK_STYLE);
            final ListPreference clockColorPref = findPreference(KEY_CLOCK_COLOR);
            final ListPreference nightModeColorPref = findPreference(KEY_NIGHT_MODE_COLOR);
            final SwitchPreferenceCompat nightModePref = findPreference(KEY_NIGHT_MODE);
            final SwitchPreferenceCompat nightModeDndPref = findPreference(KEY_NIGHT_MODE_DND);
            final SwitchPreferenceCompat showAmPmPref = findPreference(KEY_SHOW_AMPM);
Loading