diff options
4 files changed, 11 insertions, 1 deletions
diff --git a/NotificationShowcase/res/values/strings.xml b/NotificationShowcase/res/values/strings.xml index cd7239e..daf5445 100644 --- a/NotificationShowcase/res/values/strings.xml +++ b/NotificationShowcase/res/values/strings.xml @@ -79,6 +79,8 @@ <string name="pref_title_sms_buzzy">Vibration</string> <string name="pref_summary_sms_buzzy">Allow the SMS example to vibrate</string> <string name="pref_title_sms_priority">SMS Priority</string> + <string name="pref_title_sms_once">Alert Only Once</string> + <string name="pref_summary_sms_once">Updates should not interrupt the user.</string> <string name="pref_title_sms_person">SMS Person</string> <string name="pref_summary_sms_person">Add a person to the SMS notification</string> diff --git a/NotificationShowcase/res/xml/preferences.xml b/NotificationShowcase/res/xml/preferences.xml index 4d0efe2..4cc154f 100644 --- a/NotificationShowcase/res/xml/preferences.xml +++ b/NotificationShowcase/res/xml/preferences.xml @@ -61,6 +61,13 @@ android:entries="@array/priority_names" android:entryValues="@array/priority_values" android:defaultValue="0"/> + <CheckBoxPreference + android:persistent="true" + android:key="pref_key_sms_once" + android:dependency="pref_key_sms_enable" + android:summary="@string/pref_summary_sms_once" + android:title="@string/pref_title_sms_once" + android:defaultValue="true" /> <CheckBoxPreference android:persistent="true" android:dependency="pref_key_sms_enable" diff --git a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationService.java b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationService.java index 5fb2a2b..cbec648 100644 --- a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationService.java +++ b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationService.java @@ -143,7 +143,7 @@ public class NotificationService extends IntentService { .addAction(R.drawable.ic_media_next, context.getString(R.string.sms_reply), ai) .setSmallIcon(R.drawable.stat_notify_talk_text) .setStyle(bigTextStyle) - .setOnlyAlertOnce(true); + .setOnlyAlertOnce(sharedPref.getBoolean(SettingsActivity.KEY_SMS_ONCE, true)); if (TextUtils.isEmpty(personUri)) { Log.w(TAG, "failed to find contact for Mike Cleron"); diff --git a/NotificationShowcase/src/com/android/example/notificationshowcase/SettingsActivity.java b/NotificationShowcase/src/com/android/example/notificationshowcase/SettingsActivity.java index 5697f77..77936c7 100644 --- a/NotificationShowcase/src/com/android/example/notificationshowcase/SettingsActivity.java +++ b/NotificationShowcase/src/com/android/example/notificationshowcase/SettingsActivity.java @@ -26,6 +26,7 @@ public class SettingsActivity extends Activity { public static final String KEY_SMS_NOISY = "pref_key_sms_noisy"; public static final String KEY_SMS_SOUND = "pref_key_sms_sound"; public static final String KEY_SMS_BUZZY = "pref_key_sms_buzzy"; + public static final String KEY_SMS_ONCE = "pref_key_sms_once"; public static final String KEY_SMS_PRIORITY = "pref_key_sms_priority"; public static final String KEY_SMS_PERSON = "pref_key_sms_person"; public static final String KEY_PHONE_ENABLE = "pref_key_phone_enable"; |