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

Commit 3b5277e5 authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

Merge remote-tracking branch 'origin/lineage-22.1' into a15

parents f88d0b55 296e428c
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2012-2016 The CyanogenMod Project
     Copyright (C) 2017-2024 The LineageOS Project
     Copyright (C) 2017-2025 The LineageOS Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -78,14 +78,10 @@
    <string name="night_mode_dnd_title">Follow DND state</string>
    <!-- Describes night mode follows do not disturb state -->
    <string name="night_mode_dnd_summary">Night mode follows Do Not Disturb state</string>
    <!-- Title for swtich to pick if the AM/PM is displayed on a 12 hour text clock -->
    <string name="show_ampm_title">Show AM/PM</string>
    <!-- Describes if the AM/PM on the screensaver is displayed on a 12 hour text clock -->
    <string name="show_ampm_summary">If the AM/PM descriptor is displayed in the digital clock</string>
    <!-- Title for the switch to pick if the AM/PM is displayed on a 12 hour text clock -->
    <string name="show_ampm_title">Show AM/PM indicator</string>
    <!-- Title for switch to pick if the clock text is displayed in bold -->
    <string name="bold_text_title">Bold clock text</string>
    <!-- Describes if the text on the screensaver is displayed in bold -->
    <string name="bold_text_summary">If the digital clock text should be in bold</string>
    <!-- Title for slider to pick if the brightness of the clock in night mode -->
    <string name="night_mode_brightness_text_title">Brightness</string>

+4 −5
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 The Android Open Source Project
     Copyright (C) 2023-2025 The LineageOS Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -17,7 +18,7 @@
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:title="@string/app_label">

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

    <ListPreference
    <com.android.deskclock.settings.SimpleMenuPreference
        android:defaultValue="@string/default_clock_color"
        android:entries="@array/clock_color_entries"
        android:entryValues="@array/clock_color_values"
@@ -39,7 +40,6 @@
        android:layout_height="wrap_content"
        android:defaultValue="@bool/default_clock_bold_text"
        android:key="screensaver_bold_text"
        android:summary="@string/bold_text_summary"
        android:title="@string/bold_text_title"
        app:iconSpaceReserved="false" />

@@ -48,7 +48,6 @@
        android:layout_height="wrap_content"
        android:defaultValue="@bool/default_clock_show_ampm"
        android:key="screensaver_show_ampm"
        android:summary="@string/show_ampm_summary"
        android:title="@string/show_ampm_title"
        app:iconSpaceReserved="false" />

@@ -71,7 +70,7 @@
            android:dependency="screensaver_night_mode"
            app:iconSpaceReserved="false" />

        <ListPreference
        <com.android.deskclock.settings.SimpleMenuPreference
            android:defaultValue="@string/default_clock_color"
            android:entries="@array/clock_color_entries"
            android:entryValues="@array/clock_color_values"
+26 −9
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 The Android Open Source Project
 * Copyright (C) 2023-2025 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -17,13 +18,13 @@
package com.android.deskclock.settings;

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.SwitchPreferenceCompat;
import androidx.preference.SeekBarPreference;
import androidx.preference.SwitchPreferenceCompat;

import com.android.deskclock.R;
import com.android.deskclock.data.DataModel;
@@ -44,6 +45,7 @@ public final class ScreensaverSettingsActivity extends CollapsingToolbarBaseActi
    public static final String KEY_SHOW_AMPM = "screensaver_show_ampm";
    public static final String KEY_BOLD_TEXT = "screensaver_bold_text";
    private static final String PREFS_FRAGMENT_TAG = "prefs_fragment";
    private static final String CLOCK_STYLE_DIGITAL = "digital";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
@@ -93,13 +95,14 @@ public final class ScreensaverSettingsActivity extends CollapsingToolbarBaseActi
        public boolean onPreferenceChange(Preference pref, Object newValue) {
            switch (pref.getKey()) {
                case KEY_CLOCK_STYLE:
                    final ListPreference clockStylePref = (ListPreference) pref;
                    final SimpleMenuPreference clockStylePref = (SimpleMenuPreference) 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 ListPreference clockColorPref = (ListPreference) pref;
                    final SimpleMenuPreference clockColorPref = (SimpleMenuPreference) pref;
                    final int clockColorindex = clockColorPref.findIndexOfValue((String) newValue);
                    clockColorPref.setSummary(clockColorPref.getEntries()[clockColorindex]);
                    break;
@@ -114,9 +117,9 @@ public final class ScreensaverSettingsActivity extends CollapsingToolbarBaseActi
        }

        private void refresh() {
            final ListPreference clockStylePref = findPreference(KEY_CLOCK_STYLE);
            final ListPreference clockColorPref = findPreference(KEY_CLOCK_COLOR);
            final ListPreference nightModeColorPref = findPreference(KEY_NIGHT_MODE_COLOR);
            final SimpleMenuPreference clockStylePref = findPreference(KEY_CLOCK_STYLE);
            final SimpleMenuPreference clockColorPref = findPreference(KEY_CLOCK_COLOR);
            final SimpleMenuPreference 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);
@@ -152,6 +155,7 @@ public final class ScreensaverSettingsActivity extends CollapsingToolbarBaseActi
            }
            if (showAmPmPref != null) {
                showAmPmPref.setChecked(DataModel.getDataModel().getScreensaverShowAmPmOn());
                showAmPmPref.setEnabled(!DateFormat.is24HourFormat(getContext()));
            }
            if (boldTextPref != null) {
                boldTextPref.setChecked(DataModel.getDataModel().getScreensaverBoldTextOn());
@@ -165,6 +169,19 @@ public final class ScreensaverSettingsActivity extends CollapsingToolbarBaseActi
                nightModeBrightness.setOnPreferenceChangeListener(this);
                nightModeBrightness.setUpdatesContinuously(true);
            }
            setVisibility(DataModel.getDataModel().getScreensaverClockStyle() ==
                    DataModel.ClockStyle.DIGITAL);
        }

        private void setVisibility(boolean isDigitalClock) {
            final SwitchPreferenceCompat showAmPmPref = findPreference(KEY_SHOW_AMPM);
            final SwitchPreferenceCompat boldTextPref = findPreference(KEY_BOLD_TEXT);
            if (showAmPmPref != null) {
                showAmPmPref.setVisible(isDigitalClock);
            }
            if (boldTextPref != null) {
                boldTextPref.setVisible(isDigitalClock);
            }
        }
    }
}