diff --git a/CHANGELOG.md b/CHANGELOG.md index 56951fb39..17cbc03d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ Changes: - Support importing [Voucher Vault](https://github.com/tim-smart/vouchervault/) exports +- Option to keep the screen on while viewing a loyalty card +- Option to suspend the lock screen while viewing a loyalty card ## v1.9.2 (2021-02-24) diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java index 9c8943506..6ae355190 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java @@ -245,10 +245,12 @@ public class LoyaltyCardViewActivity extends AppCompatActivity attributes.screenBrightness = 1F; } - if (settings.getKeepScreenOn()) - { - window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| - WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD| + if (settings.getKeepScreenOn()) { + window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + + if (settings.getDisableLockscreenWhileViewingCard()) { + window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); } diff --git a/app/src/main/java/protect/card_locker/preferences/Settings.java b/app/src/main/java/protect/card_locker/preferences/Settings.java index 7cb0aa715..ab5bc96cb 100644 --- a/app/src/main/java/protect/card_locker/preferences/Settings.java +++ b/app/src/main/java/protect/card_locker/preferences/Settings.java @@ -93,6 +93,11 @@ public class Settings public boolean getKeepScreenOn() { - return getBoolean(R.string.settings_key_keep_screen_on, false); + return getBoolean(R.string.settings_key_keep_screen_on, true); + } + + public boolean getDisableLockscreenWhileViewingCard() + { + return getBoolean(R.string.settings_key_disable_lockscreen_while_viewing_card, true); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f0ffec37c..3181ac81d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -104,8 +104,10 @@ pref_display_card_max_brightness Lock barcode orientation pref_lock_barcode_orientation - Keep screen on + Keep screen on while viewing a card pref_keep_screen_on + Disable lock screen while viewing a card + pref_disable_lockscreen_while_viewing_card sharedpreference_active_tab diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 654949865..e8b14331d 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -60,10 +60,16 @@ app:iconSpaceReserved="false" /> + + \ No newline at end of file