Loading res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -246,6 +246,10 @@ respond. This is a sign of an error; if the weather widget is not present on the device, we show nothing at all. --> <string name="weather_fetch_failure">Weather information currently unavailable.</string> <string name="alarm_requires_unlock_title">Alarm requires unlock</string> <string name="alarm_requires_unlock_summary">Must unlock phone to disable or snooze alarm</string> </resources> res/xml/settings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,11 @@ android:title="@string/alarm_in_silent_mode_title" android:summary="@string/alarm_in_silent_mode_summary" /> <CheckBoxPreference android:key="alarm_requires_unlock" android:title="@string/alarm_requires_unlock_title" android:summary="@string/alarm_requires_unlock_summary" /> <VolumePreference android:title="@string/alarm_volume_title" android:summary="@string/alarm_volume_summary" Loading src/com/android/deskclock/AlarmAlert.java +14 −11 Original line number Diff line number Diff line Loading @@ -16,29 +16,26 @@ package com.android.deskclock; import java.util.Calendar; import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.Settings; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.view.LayoutInflater; import android.view.Window; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.Toast; import android.widget.TextView; import java.util.Calendar; import android.widget.Toast; /** * Alarm Clock alarm alert: pops visible indicator and plays alarm Loading Loading @@ -77,11 +74,17 @@ public class AlarmAlert extends Activity { DEFAULT_VOLUME_BEHAVIOR); mVolumeBehavior = Integer.parseInt(vol); final boolean requireUnlock = Settings.System.getInt(getContentResolver(), SettingsActivity.KEY_ALARM_REQUIRES_UNLOCK, 0) == 1; requestWindowFeature(android.view.Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); if (!requireUnlock) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); } updateLayout(); // Register to get the alarm killed intent. Loading src/com/android/deskclock/SettingsActivity.java +9 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,9 @@ public class SettingsActivity extends PreferenceActivity "snooze_duration"; static final String KEY_VOLUME_BEHAVIOR = "volume_button_setting"; static final String KEY_ALARM_REQUIRES_UNLOCK = "alarm_requires_unlock"; @Override protected void onCreate(Bundle savedInstanceState) { Loading Loading @@ -73,6 +76,11 @@ public class SettingsActivity extends PreferenceActivity ringerModeStreamTypes); return true; } else if (KEY_ALARM_REQUIRES_UNLOCK.equals(preference.getKey())) { CheckBoxPreference pref = (CheckBoxPreference) preference; Settings.System.putInt(getContentResolver(), KEY_ALARM_REQUIRES_UNLOCK, pref.isChecked() ? 1 : 0); return true; } return super.onPreferenceTreeClick(preferenceScreen, preference); Loading Loading
res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -246,6 +246,10 @@ respond. This is a sign of an error; if the weather widget is not present on the device, we show nothing at all. --> <string name="weather_fetch_failure">Weather information currently unavailable.</string> <string name="alarm_requires_unlock_title">Alarm requires unlock</string> <string name="alarm_requires_unlock_summary">Must unlock phone to disable or snooze alarm</string> </resources>
res/xml/settings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,11 @@ android:title="@string/alarm_in_silent_mode_title" android:summary="@string/alarm_in_silent_mode_summary" /> <CheckBoxPreference android:key="alarm_requires_unlock" android:title="@string/alarm_requires_unlock_title" android:summary="@string/alarm_requires_unlock_summary" /> <VolumePreference android:title="@string/alarm_volume_title" android:summary="@string/alarm_volume_summary" Loading
src/com/android/deskclock/AlarmAlert.java +14 −11 Original line number Diff line number Diff line Loading @@ -16,29 +16,26 @@ package com.android.deskclock; import java.util.Calendar; import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.Settings; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.view.LayoutInflater; import android.view.Window; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.Toast; import android.widget.TextView; import java.util.Calendar; import android.widget.Toast; /** * Alarm Clock alarm alert: pops visible indicator and plays alarm Loading Loading @@ -77,11 +74,17 @@ public class AlarmAlert extends Activity { DEFAULT_VOLUME_BEHAVIOR); mVolumeBehavior = Integer.parseInt(vol); final boolean requireUnlock = Settings.System.getInt(getContentResolver(), SettingsActivity.KEY_ALARM_REQUIRES_UNLOCK, 0) == 1; requestWindowFeature(android.view.Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); if (!requireUnlock) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); } updateLayout(); // Register to get the alarm killed intent. Loading
src/com/android/deskclock/SettingsActivity.java +9 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,9 @@ public class SettingsActivity extends PreferenceActivity "snooze_duration"; static final String KEY_VOLUME_BEHAVIOR = "volume_button_setting"; static final String KEY_ALARM_REQUIRES_UNLOCK = "alarm_requires_unlock"; @Override protected void onCreate(Bundle savedInstanceState) { Loading Loading @@ -73,6 +76,11 @@ public class SettingsActivity extends PreferenceActivity ringerModeStreamTypes); return true; } else if (KEY_ALARM_REQUIRES_UNLOCK.equals(preference.getKey())) { CheckBoxPreference pref = (CheckBoxPreference) preference; Settings.System.putInt(getContentResolver(), KEY_ALARM_REQUIRES_UNLOCK, pref.isChecked() ? 1 : 0); return true; } return super.onPreferenceTreeClick(preferenceScreen, preference); Loading