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

Commit a3b2e477 authored by Daria Evdokimova's avatar Daria Evdokimova
Browse files

Add 'Change date&time settings' to Clock settings

Now there's a setting in Clock 'Change date&time settings'
that if tapped takes you to Date & Time settings
(phone settings, not the app).

Bug: 17553954
Change-Id: I64c7588481e4427d952ac48312784a2716cbcc4d
parent 65542e8f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -596,6 +596,9 @@
    <!-- Header for a Clock Dream Setting referring to choosing analog or digital style -->
    <string name="clock_style">Style</string>

    <!-- Title for preference to change date & time -->
    <string name="open_date_settings">Change Date \u0026 time</string>

    <!-- Entries listed in the ListPreference when invoking the clock style
         preference. -->
    <string-array name="clock_style_entries">
+6 −0
Original line number Diff line number Diff line
@@ -24,17 +24,23 @@
            android:entryValues="@array/clock_style_values"
            android:defaultValue="@string/default_clock_style"
            android:dialogTitle="@string/clock_style" />

        <SwitchPreference
            android:key="automatic_home_clock"
            android:title="@string/automatic_home_clock"
            android:summary="@string/automatic_home_clock_summary"
            android:defaultValue="true" />

        <ListPreference
            android:key="home_time_zone"
            android:entries="@array/timezone_labels"
            android:entryValues="@array/timezone_values"
            android:dialogTitle="@string/home_time_zone_title"
            android:title="@string/home_time_zone" />

        <Preference
            android:key="date_time"
            android:title="@string/open_date_settings" />
    </PreferenceCategory>

    <PreferenceCategory
+20 −8
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.RingtonePreference;
import android.preference.SwitchPreference;
import android.provider.Settings;
import android.text.format.DateUtils;
import android.view.Menu;
import android.view.MenuItem;
@@ -55,6 +56,7 @@ public class SettingsActivity extends BaseActivity {
    public static final String KEY_CLOCK_STYLE = "clock_style";
    public static final String KEY_HOME_TZ = "home_time_zone";
    public static final String KEY_AUTO_HOME_CLOCK = "automatic_home_clock";
    public static final String KEY_DATE_TIME = "date_time";
    public static final String KEY_VOLUME_BUTTONS = "volume_button_setting";
    public static final String KEY_WEEK_START = "week_start";

@@ -181,15 +183,22 @@ public class SettingsActivity extends BaseActivity {
                return false;
            }

            if (KEY_ALARM_VOLUME.equals(pref.getKey())) {
            switch (pref.getKey()) {
                case KEY_DATE_TIME:
                    Intent dialogIntent = new Intent(Settings.ACTION_DATE_SETTINGS);
                    dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(dialogIntent);
                    return true;
                case KEY_ALARM_VOLUME:
                    final AudioManager audioManager =
                            (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
                    audioManager.adjustStreamVolume(AudioManager.STREAM_ALARM,
                            AudioManager.ADJUST_SAME, AudioManager.FLAG_SHOW_UI);
                    return true;
            }
                default:
                    return false;
            }
        }

        /**
         * Reconstruct the timezone list. We don't want to do this unnecessary, so proceed only if
@@ -282,6 +291,9 @@ public class SettingsActivity extends BaseActivity {
                    (CrescendoLengthDialog) findPreference(KEY_TIMER_CRESCENDO);
            timerCrescendoPref.setSummary();

            final Preference dateAndTimeSetting = findPreference(KEY_DATE_TIME);
            dateAndTimeSetting.setOnPreferenceClickListener(this);

            final ListPreference weekStartPref = (ListPreference) findPreference(KEY_WEEK_START);
            // Set the default value programmatically
            final String value = weekStartPref.getValue();