diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java
index 3d103c5f5..3ab695250 100644
--- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java
+++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java
@@ -233,10 +233,22 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
// '1' is the brightest. We attempt to maximize the brightness
// to help barcode readers scan the barcode.
Window window = getWindow();
- if(window != null && settings.useMaxBrightnessDisplayingBarcode())
+ if(window != null)
{
WindowManager.LayoutParams attributes = window.getAttributes();
- attributes.screenBrightness = 1F;
+
+ if (settings.useMaxBrightnessDisplayingBarcode())
+ {
+ attributes.screenBrightness = 1F;
+ }
+
+ if (settings.getKeepScreenOn())
+ {
+ window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
+ WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
+ WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
+ }
+
window.setAttributes(attributes);
}
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 b6808f352..7cb0aa715 100644
--- a/app/src/main/java/protect/card_locker/preferences/Settings.java
+++ b/app/src/main/java/protect/card_locker/preferences/Settings.java
@@ -90,4 +90,9 @@ public class Settings
{
return getBoolean(R.string.settings_key_lock_barcode_orientation, false);
}
+
+ public boolean getKeepScreenOn()
+ {
+ return getBoolean(R.string.settings_key_keep_screen_on, false);
+ }
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a0f2510d8..20dbf76bc 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -104,6 +104,8 @@
pref_display_card_max_brightness
Lock barcode orientation
pref_lock_barcode_orientation
+ Keep screen on
+ pref_keep_screen_on
sharedpreference_active_tab
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index b176a17a7..654949865 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -58,6 +58,12 @@
android:key="@string/settings_key_lock_barcode_orientation"
android:title="@string/settings_lock_barcode_orientation"
app:iconSpaceReserved="false" />
+
+
\ No newline at end of file