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

@@ -263,6 +263,12 @@ public class Preferences
for (Listener l : listeners) l.onNotificationsChanged();
}
public void setNotificationsLed(boolean enabled)
{
storage.putBoolean("pref_led_notifications", enabled);
for (Listener l : listeners) l.onNotificationsChanged();
}
public void setCheckmarkSequenceReversed(boolean reverse)
{
shouldReverseCheckmarks = reverse;
@@ -281,6 +287,11 @@ public class Preferences
return storage.getBoolean("pref_sticky_notifications", false);
}
public boolean shouldMakeNotificationsLed()
{
return storage.getBoolean("pref_led_notifications", false);
}
public boolean isCheckmarkSequenceReversed()
{
if (shouldReverseCheckmarks == null) shouldReverseCheckmarks =

View File

@@ -159,6 +159,10 @@ public class PreferencesTest extends BaseUnitTest
prefs.setNotificationsSticky(true);
assertTrue(prefs.shouldMakeNotificationsSticky());
assertFalse(prefs.shouldMakeNotificationsLed());
prefs.setNotificationsLed(true);
assertTrue(prefs.shouldMakeNotificationsLed());
assertThat(prefs.getSnoozeInterval(), equalTo(15L));
prefs.setSnoozeInterval(30);
assertThat(prefs.getSnoozeInterval(), equalTo(30L));