Commit 1ce96762 authored by Geoffrey Métais's avatar Geoffrey Métais

Merge options for video playback in multitasking

parent 0b227fbc
......@@ -176,4 +176,16 @@
<item>65280</item>
</string-array>
<string-array name="video_app_switch_action_titles" translatable="false">
<item>@string/stop</item>
<item>@string/play_as_audio_background</item>
<item>@string/play_pip_title</item>
</string-array>
<string-array name="video_app_switch_action_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
</resources>
\ No newline at end of file
......@@ -25,10 +25,10 @@
<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="video_app_switch_title">Action on application switching</string>
<string name="video_app_switch_summary">Select VLC behavior when you switch to other application from video playback</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>
<string name="insert_next">Insert next</string>
<string name="play_all">Play all</string>
......
......@@ -29,18 +29,13 @@
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" />
<ListPreference
android:key="video_action_switch"
android:defaultValue="0"
android:entries="@array/video_app_switch_action_titles"
android:entryValues="@array/video_app_switch_action_values"
android:summary="@string/video_app_switch_summary"
android:title="@string/video_app_switch_title" />
<PreferenceCategory android:title="@string/controls_prefs_category">
<CheckBoxPreference
android:defaultValue="false"
......
......@@ -42,7 +42,6 @@ public class PreferencesActivity extends AppCompatActivity implements PlaybackSe
public final static String VIDEO_PAUSED = "VideoPaused";
public final static String VIDEO_SUBTITLE_FILES = "VideoSubtitleFiles";
public final static String VIDEO_SPEED = "VideoSpeed";
public final static String VIDEO_BACKGROUND = "video_background";
public final static String VIDEO_RESTORE = "video_restore";
public final static String VIDEO_RATE = "video_rate";
public final static String VIDEO_RATIO = "video_ratio";
......@@ -50,6 +49,7 @@ public class PreferencesActivity extends AppCompatActivity implements PlaybackSe
public final static String LOGIN_STORE = "store_login";
public static final String KEY_AUDIO_PLAYBACK_RATE = "playback_rate";
public static final String KEY_AUDIO_PLAYBACK_SPEED_PERSIST = "playback_speed";
public final static String KEY_VIDEO_APP_SWITCH = "video_action_switch";
public final static int RESULT_RESCAN = RESULT_FIRST_USER + 1;
public final static int RESULT_RESTART = RESULT_FIRST_USER + 2;
public final static int RESULT_RESTART_APP = RESULT_FIRST_USER + 3;
......
......@@ -22,11 +22,8 @@
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 {
......@@ -41,20 +38,6 @@ public class PreferencesVideo extends BasePreferenceFragment {
return R.string.video_prefs_category;
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CheckBoxPreference pip = (CheckBoxPreference) findPreference("video_home_pip");
CheckBoxPreference background = (CheckBoxPreference) findPreference("video_background");
pip.setEnabled(!background.isChecked());
background.setEnabled(!pip.isChecked());
}
@Override
public boolean onPreferenceTreeClick(Preference preference) {
if (preference.getKey() == null)
......@@ -66,14 +49,6 @@ 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);
}
......
......@@ -54,7 +54,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(AndroidDevices.isAndroidTv());
findPreference("video_action_switch").setVisible(AndroidDevices.hasPiP);
}
@Override
......
......@@ -592,7 +592,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
(AndroidUtil.isNougatOrLater && !AndroidUtil.isOOrLater //Video on background on Nougat Android TVs
&& AndroidDevices.isAndroidTv() && !requestVisibleBehind(true)))
stopPlayback();
else if (mSettings.getBoolean("video_home_pip", false) && isInteractive()) {
else if ("2".equals(mSettings.getString(PreferencesActivity.KEY_VIDEO_APP_SWITCH, "0")) && isInteractive()) {
switchToPopup();
}
}
......@@ -695,7 +695,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (mAlertDialog != null && mAlertDialog.isShowing())
mAlertDialog.dismiss();
if (!isFinishing() && mService != null && mService.isPlaying() &&
mSettings.getBoolean(PreferencesActivity.VIDEO_BACKGROUND, false)) {
"1".equals(mSettings.getString(PreferencesActivity.KEY_VIDEO_APP_SWITCH, "0"))) {
switchToAudioMode(false);
}
......
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