Commit b36a444d authored by Geoffrey Métais's avatar Geoffrey Métais

Add PIP option for video playback on app switch

parent b131e2a5
......@@ -25,6 +25,8 @@
<string name="play_from_start">Play from start</string>
<string name="play_as_audio">Play as audio</string>
<string name="play_as_video">Play as video</string>
<string name="play_pip_title">Play videos in Picture-in-picture mode</string>
<string name="play_pip_summary">Continue video playback in Picture-In-Picture mode when clicking HOME button or switching apps.</string>
<string name="play_as_audio_background">Play videos in background</string>
<string name="play_as_audio_background_summary">Continue video playback in background when turning device screen off or clicking HOME button.</string>
<string name="append">Append</string>
......
......@@ -15,12 +15,6 @@
android:summary="@string/hardware_acceleration_summary"
android:title="@string/hardware_acceleration" />
<CheckBoxPreference
android:defaultValue="false"
android:key="video_background"
android:summary="@string/play_as_audio_background_summary"
android:title="@string/play_as_audio_background" />
<ListPreference
android:defaultValue="99"
android:entries="@array/screen_orientation_list"
......
......@@ -29,6 +29,18 @@
android:summary="@string/save_audiodelay_summary"
android:title="@string/save_audiodelay_title" />
<CheckBoxPreference
android:defaultValue="false"
android:key="video_background"
android:summary="@string/play_as_audio_background_summary"
android:title="@string/play_as_audio_background" />
<CheckBoxPreference
android:defaultValue="false"
android:key="video_home_pip"
android:summary="@string/play_pip_summary"
android:title="@string/play_pip_title" />
<PreferenceCategory android:title="@string/controls_prefs_category">
<CheckBoxPreference
android:defaultValue="false"
......
......@@ -23,7 +23,10 @@
package org.videolan.vlc.gui.preferences;
import android.os.Bundle;
import android.support.v7.preference.CheckBoxPreference;
import android.support.v7.preference.Preference;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.R;
public class PreferencesVideo extends BasePreferenceFragment {
......@@ -46,6 +49,13 @@ public class PreferencesVideo extends BasePreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CheckBoxPreference pip = (CheckBoxPreference) findPreference("video_home_pip");
if (AndroidUtil.isOOrLater) {
CheckBoxPreference background = (CheckBoxPreference) findPreference("video_background");
pip.setEnabled(!background.isChecked());
background.setEnabled(!pip.isChecked());
}
pip.setVisible(AndroidUtil.isOOrLater);
}
@Override
......@@ -59,6 +69,14 @@ public class PreferencesVideo extends BasePreferenceFragment {
case "force_list_portrait":
((PreferencesActivity) getActivity()).setRestart();
return true;
case "video_home_pip":
findPreference("video_background").setEnabled(!((CheckBoxPreference)preference).isChecked());
return true;
case "video_background":
if (!AndroidUtil.isOOrLater)
return false;
findPreference("video_home_pip").setEnabled(!((CheckBoxPreference)preference).isChecked());
return true;
}
return super.onPreferenceTreeClick(preference);
}
......
......@@ -27,6 +27,7 @@ import android.os.Build;
import android.os.Bundle;
import android.support.v7.preference.Preference;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.R;
import org.videolan.vlc.util.AndroidDevices;
......@@ -54,6 +55,7 @@ public class PreferencesVideo extends BasePreferenceFragment {
findPreference("enable_volume_gesture").setVisible(AndroidDevices.hasTsp());
findPreference("enable_brightness_gesture").setVisible(AndroidDevices.hasTsp());
findPreference("popup_keepscreen").setVisible(false);
findPreference("video_home_pip").setVisible(AndroidUtil.isOOrLater);
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment