Implemented keeping screen on when using the remote activity (#280)
This commit is contained in:
parent
43edbfa8e9
commit
6ab8b2b604
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue