Implemented keeping screen on when using the remote activity (#280)

This commit is contained in:
Martijn Brekhof 2016-09-07 20:33:58 +02:00 committed by Synced Synapse
parent 43edbfa8e9
commit 6ab8b2b604
3 changed files with 20 additions and 0 deletions

View File

@ -65,6 +65,10 @@ public class Settings {
public static final String KEY_PREF_KEEP_REMOTE_ABOVE_LOCKSCREEN = "pref_keep_remote_above_lockscreen";
public static final boolean DEFAULT_KEY_PREF_KEEP_REMOTE_ABOVE_LOCKSCREEN = false;
// Keep screen on when on the remote activity
public static final String KEY_PREF_KEEP_SCREEN_ON = "pref_keep_screen_on";
public static final boolean DEFAULT_KEY_PREF_KEEP_SCREEN_ON = false;
// Show notifications
public static final String KEY_PREF_SHOW_NOTIFICATION = "pref_show_notification";
public static final boolean DEFAULT_PREF_SHOW_NOTIFICATION = false;

View File

@ -179,6 +179,17 @@ public class RemoteActivity extends BaseActivity
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
}
// Check whether we should keep the screen on
boolean keepScreenOn = PreferenceManager
.getDefaultSharedPreferences(this)
.getBoolean(Settings.KEY_PREF_KEEP_SCREEN_ON,
Settings.DEFAULT_KEY_PREF_KEEP_SCREEN_ON);
if (keepScreenOn) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
checkPVREnabledAndSetMenuItems();
}

View File

@ -34,6 +34,11 @@
android:title="@string/keep_remote_above_lockscreen"
android:defaultValue="false"/>
<CheckBoxPreference
android:key="pref_keep_screen_on"
android:title="Keep screen on when using remote"
android:defaultValue="false"/>
<CheckBoxPreference
android:key="pref_show_notification"
android:title="@string/show_notification"