Added option to keep the remote above the lockscreen (issue #61)

This commit is contained in:
Jörn-Thorben Hinz 2016-02-19 22:20:18 +01:00
parent 5eebb93b2f
commit df7e896c48
5 changed files with 23 additions and 0 deletions

View File

@ -61,6 +61,10 @@ public class Settings {
public static final String KEY_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START = "pref_switch_to_remote_after_media_start";
public static final boolean DEFAULT_PREF_SWITCH_TO_REMOTE_AFTER_MEDIA_START = true;
// Keep remote activity above lockscreen
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;
// Show notifications
public static final String KEY_PREF_SHOW_NOTIFICATION = "pref_show_notification";
public static final boolean DEFAULT_PREF_SHOW_NOTIFICATION = false;

View File

@ -32,6 +32,7 @@ import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
@ -161,6 +162,17 @@ public class RemoteActivity extends BaseActivity
// Force a refresh, mainly to update the time elapsed on the fragments
hostConnectionObserver.forceRefreshResults();
// Check whether we should keep the remote activity above the lockscreen
boolean keepAboveLockscreen = PreferenceManager
.getDefaultSharedPreferences(this)
.getBoolean(Settings.KEY_PREF_KEEP_REMOTE_ABOVE_LOCKSCREEN,
Settings.DEFAULT_KEY_PREF_KEEP_REMOTE_ABOVE_LOCKSCREEN);
if (keepAboveLockscreen) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
}
checkPVREnabledAndSetMenuItems();
}

View File

@ -312,6 +312,7 @@
<string name="theme_solarized_dark">Solarized dunkel</string>
<string name="switch_to_remote">Nach dem Abspielen eines Mediums zur Fernbedienung wechseln</string>
<string name="keep_remote_above_lockscreen">Fernbedienung auf dem Sperrbildschirm anzeigen</string>
<string name="show_notification">Nachricht mit aktueller Wiedergabe anzeigen</string>
<string name="use_hardware_volume_keys">Lautstärketasten verwenden</string>
<string name="vibrate_on_remote">Auf Fernbedienungs-Knopfdruck vibrieren</string>

View File

@ -319,6 +319,7 @@
<string name="theme_solarized_dark">Solarized Dark</string>
<string name="switch_to_remote">Switch to remote after media start</string>
<string name="keep_remote_above_lockscreen">Keep remote above lockscreen</string>
<string name="show_notification">Show notification while playing</string>
<string name="use_hardware_volume_keys">Use volume keys to control volume</string>
<string name="vibrate_on_remote">Vibrate on remote button press</string>

View File

@ -29,6 +29,11 @@
android:title="@string/switch_to_remote"
android:defaultValue="true"/>
<SwitchPreference
android:key="pref_keep_remote_above_lockscreen"
android:title="@string/keep_remote_above_lockscreen"
android:defaultValue="false"/>
<SwitchPreference
android:key="pref_show_notification"
android:title="@string/show_notification"