Loading AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ <!-- It is also required to display user-friendly names for custom ringtones in the UI. --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.SHUTDOWN" /> <uses-permission android:name="cyanogenmod.permission.WRITE_SETTINGS" /> <application android:label="@string/app_label" android:name=".DeskClockApplication" android:allowBackup="true" Loading res/values/cm_strings.xml 0 → 100644 +23 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012-2015 The CyanogenMod 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. --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Setting title for showing/hiding the alarm status bar icon --> <string name="show_status_bar_icon_title">Show icon</string> <!-- Setting summary for showing/hiding the alarm statusbar icon --> <string name="show_status_bar_icon_summary">Show an icon in the status bar when an alarm is set</string> </resources> res/xml/settings.xml +7 −0 Original line number Diff line number Diff line Loading @@ -70,5 +70,12 @@ android:dialogTitle="@string/week_start_title" android:entries="@array/week_start_entries" android:entryValues="@array/week_start_values" /> <SwitchPreference android:key="show_status_bar_icon" android:title="@string/show_status_bar_icon_title" android:summary="@string/show_status_bar_icon_summary" android:persistent="false" android:defaultValue="true" /> </PreferenceCategory> </PreferenceScreen> src/com/android/deskclock/SettingsActivity.java +17 −0 Original line number Diff line number Diff line /* * Copyright (C) 2009 The Android Open Source Project * Copyright (C) 2012-2015 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading @@ -26,12 +27,15 @@ import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceFragment; import android.preference.SwitchPreference; import android.text.format.DateUtils; import android.view.Menu; import android.view.MenuItem; import com.android.deskclock.worldclock.Cities; import cyanogenmod.providers.CMSettings; import java.util.ArrayList; import java.util.Collections; import java.util.List; Loading @@ -51,6 +55,7 @@ public class SettingsActivity extends BaseActivity { public static final String KEY_AUTO_HOME_CLOCK = "automatic_home_clock"; public static final String KEY_VOLUME_BUTTONS = "volume_button_setting"; public static final String KEY_WEEK_START = "week_start"; public static final String KEY_SHOW_ALARM_ICON = "show_status_bar_icon"; public static final String DEFAULT_VOLUME_BEHAVIOR = "0"; public static final String VOLUME_BEHAVIOR_SNOOZE = "1"; Loading Loading @@ -108,6 +113,11 @@ public class SettingsActivity extends BaseActivity { homeTimezonePref.setEntries(mTimezones[1]); homeTimezonePref.setSummary(homeTimezonePref.getEntry()); homeTimezonePref.setOnPreferenceChangeListener(this); final SwitchPreference showAlarmIconPref = (SwitchPreference) findPreference(KEY_SHOW_ALARM_ICON); showAlarmIconPref.setChecked(CMSettings.System.getInt( getActivity().getContentResolver(), CMSettings.System.SHOW_ALARM_ICON, 1) == 1); } @Override Loading Loading @@ -146,6 +156,9 @@ public class SettingsActivity extends BaseActivity { final ListPreference weekStartPref = (ListPreference) findPreference(KEY_WEEK_START); final int idx = weekStartPref.findIndexOfValue((String) newValue); weekStartPref.setSummary(weekStartPref.getEntries()[idx]); } else if (KEY_SHOW_ALARM_ICON.equals(pref.getKey())) { CMSettings.System.putInt(getActivity().getContentResolver(), CMSettings.System.SHOW_ALARM_ICON, (Boolean) newValue ? 1 : 0); } // Set result so DeskClock knows to refresh itself getActivity().setResult(RESULT_OK); Loading Loading @@ -242,6 +255,10 @@ public class SettingsActivity extends BaseActivity { weekStartPref.setValueIndex(idx); weekStartPref.setSummary(weekStartPref.getEntries()[idx]); weekStartPref.setOnPreferenceChangeListener(this); final SwitchPreference showAlarmIconPref = (SwitchPreference) findPreference(KEY_SHOW_ALARM_ICON); showAlarmIconPref.setOnPreferenceChangeListener(this); } private void updateAutoSnoozeSummary(ListPreference listPref, String delay) { Loading Loading
AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ <!-- It is also required to display user-friendly names for custom ringtones in the UI. --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.SHUTDOWN" /> <uses-permission android:name="cyanogenmod.permission.WRITE_SETTINGS" /> <application android:label="@string/app_label" android:name=".DeskClockApplication" android:allowBackup="true" Loading
res/values/cm_strings.xml 0 → 100644 +23 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012-2015 The CyanogenMod 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. --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Setting title for showing/hiding the alarm status bar icon --> <string name="show_status_bar_icon_title">Show icon</string> <!-- Setting summary for showing/hiding the alarm statusbar icon --> <string name="show_status_bar_icon_summary">Show an icon in the status bar when an alarm is set</string> </resources>
res/xml/settings.xml +7 −0 Original line number Diff line number Diff line Loading @@ -70,5 +70,12 @@ android:dialogTitle="@string/week_start_title" android:entries="@array/week_start_entries" android:entryValues="@array/week_start_values" /> <SwitchPreference android:key="show_status_bar_icon" android:title="@string/show_status_bar_icon_title" android:summary="@string/show_status_bar_icon_summary" android:persistent="false" android:defaultValue="true" /> </PreferenceCategory> </PreferenceScreen>
src/com/android/deskclock/SettingsActivity.java +17 −0 Original line number Diff line number Diff line /* * Copyright (C) 2009 The Android Open Source Project * Copyright (C) 2012-2015 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading @@ -26,12 +27,15 @@ import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceFragment; import android.preference.SwitchPreference; import android.text.format.DateUtils; import android.view.Menu; import android.view.MenuItem; import com.android.deskclock.worldclock.Cities; import cyanogenmod.providers.CMSettings; import java.util.ArrayList; import java.util.Collections; import java.util.List; Loading @@ -51,6 +55,7 @@ public class SettingsActivity extends BaseActivity { public static final String KEY_AUTO_HOME_CLOCK = "automatic_home_clock"; public static final String KEY_VOLUME_BUTTONS = "volume_button_setting"; public static final String KEY_WEEK_START = "week_start"; public static final String KEY_SHOW_ALARM_ICON = "show_status_bar_icon"; public static final String DEFAULT_VOLUME_BEHAVIOR = "0"; public static final String VOLUME_BEHAVIOR_SNOOZE = "1"; Loading Loading @@ -108,6 +113,11 @@ public class SettingsActivity extends BaseActivity { homeTimezonePref.setEntries(mTimezones[1]); homeTimezonePref.setSummary(homeTimezonePref.getEntry()); homeTimezonePref.setOnPreferenceChangeListener(this); final SwitchPreference showAlarmIconPref = (SwitchPreference) findPreference(KEY_SHOW_ALARM_ICON); showAlarmIconPref.setChecked(CMSettings.System.getInt( getActivity().getContentResolver(), CMSettings.System.SHOW_ALARM_ICON, 1) == 1); } @Override Loading Loading @@ -146,6 +156,9 @@ public class SettingsActivity extends BaseActivity { final ListPreference weekStartPref = (ListPreference) findPreference(KEY_WEEK_START); final int idx = weekStartPref.findIndexOfValue((String) newValue); weekStartPref.setSummary(weekStartPref.getEntries()[idx]); } else if (KEY_SHOW_ALARM_ICON.equals(pref.getKey())) { CMSettings.System.putInt(getActivity().getContentResolver(), CMSettings.System.SHOW_ALARM_ICON, (Boolean) newValue ? 1 : 0); } // Set result so DeskClock knows to refresh itself getActivity().setResult(RESULT_OK); Loading Loading @@ -242,6 +255,10 @@ public class SettingsActivity extends BaseActivity { weekStartPref.setValueIndex(idx); weekStartPref.setSummary(weekStartPref.getEntries()[idx]); weekStartPref.setOnPreferenceChangeListener(this); final SwitchPreference showAlarmIconPref = (SwitchPreference) findPreference(KEY_SHOW_ALARM_ICON); showAlarmIconPref.setOnPreferenceChangeListener(this); } private void updateAutoSnoozeSummary(ListPreference listPref, String delay) { Loading