make LED blinking for notifications configurable

This commit is contained in:
Luboš Luňák
2017-09-11 15:18:42 +02:00
parent a680d57cac
commit 4d59783809
6 changed files with 29 additions and 3 deletions

View File

@@ -72,7 +72,7 @@ class AndroidNotificationTray
.addAction(checkAction)
.addAction(snoozeAction)
val notification = NotificationCompat.Builder(context)
val builder = NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle(habit.name)
.setContentText(habit.description)
@@ -85,8 +85,9 @@ class AndroidNotificationTray
.setWhen(reminderTime)
.setShowWhen(true)
.setOngoing(preferences.shouldMakeNotificationsSticky())
.setLights(Color.RED, 1000, 1000)
.build()
if (preferences.shouldMakeNotificationsLed())
builder.setLights(Color.RED, 1000, 1000)
val notification = builder.build()
val notificationManager = context.getSystemService(
Activity.NOTIFICATION_SERVICE) as NotificationManager

View File

@@ -85,6 +85,8 @@ class SharedPreferencesStorage
preferences.isCheckmarkSequenceReversed = getBoolean(key, false)
"pref_sticky_notifications" ->
preferences.setNotificationsSticky(getBoolean(key, false))
"pref_led_notifications" ->
preferences.setNotificationsLed(getBoolean(key, false))
"pref_feature_sync" ->
preferences.isSyncEnabled = getBoolean(key, false)
}

View File

@@ -188,6 +188,8 @@
<string name="sticky_notifications">Make notifications sticky</string>
<string name="sticky_notifications_description">Prevents notifications from being swiped away.</string>
<string name="led_notifications">LED</string>
<string name="led_notifications_description">Notifications blinking light.</string>
<string name="repair_database">Repair database</string>
<string name="database_repaired">Database repaired.</string>

View File

@@ -68,6 +68,12 @@
android:title="@string/sticky_notifications"
android:summary="@string/sticky_notifications_description"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_led_notifications"
android:title="@string/led_notifications"
android:summary="@string/led_notifications_description"/>
</PreferenceCategory>
<PreferenceCategory