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

Option to always keep screen ON in Pop-Up mode

parent 8cb68587
......@@ -301,6 +301,8 @@
<string name="enable_seek_buttons_summary">Show rewind and forward buttons on the video interface</string>
<string name="enable_double_tap_seek_title">Double tap to seek</string>
<string name="enable_double_tap_seek_summary">Double tap on screen edges to seek by 10 seconds</string>
<string name="popup_keepscreen_title">Keep screen ON in Pop-Up mode</string>
<string name="popup_keepscreen_summary">Always keep screen ON while Pop-Up is displayed, even if video is paused.</string>
<string name="subtitles_prefs_category">Subtitles</string>
<string name="subtitles_size_title">Subtitles Size</string>
......
......@@ -60,6 +60,11 @@
android:key="enable_seek_buttons"
android:summary="@string/enable_seek_buttons_summary"
android:title="@string/enable_seek_buttons" />
<CheckBoxPreference
android:defaultValue="false"
android:key="popup_keepscreen"
android:summary="@string/popup_keepscreen_summary"
android:title="@string/popup_keepscreen_title" />
</PreferenceCategory>
</PreferenceScreen>
......@@ -53,6 +53,7 @@ public class PreferencesVideo extends BasePreferenceFragment {
findPreference("enable_double_tap_seek").setVisible(false);
findPreference("enable_volume_gesture").setVisible(AndroidDevices.hasTsp());
findPreference("enable_brightness_gesture").setVisible(AndroidDevices.hasTsp());
findPreference("popup_keepscreen").setVisible(false);
}
@Override
......
......@@ -33,10 +33,10 @@ import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.view.GestureDetectorCompat;
import android.support.v7.preference.PreferenceManager;
import android.util.Log;
import android.view.GestureDetector;
import android.view.LayoutInflater;
......@@ -71,9 +71,11 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
private ImageView mExpandButton;
private ImageView mCloseButton;
private ImageView mPlayPauseButton;
private final boolean mAlwaysOn;
public PopupManager(PlaybackService service) {
mService = service;
mAlwaysOn = PreferenceManager.getDefaultSharedPreferences(service).getBoolean("popup_keepscreen", false);
}
public void removePopup() {
......@@ -92,6 +94,8 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
mService.addCallback(this);
LayoutInflater li = (LayoutInflater) VLCApplication.getAppContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mRootView = (PopupLayout) li.inflate(R.layout.video_popup, null);
if (mAlwaysOn)
mRootView.setKeepScreenOn(true);
mPlayPauseButton = (ImageView) mRootView.findViewById(R.id.video_play_pause);
mCloseButton = (ImageView) mRootView.findViewById(R.id.popup_close);
mExpandButton = (ImageView) mRootView.findViewById(R.id.popup_expand);
......@@ -225,12 +229,14 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
mService.removePopup();
break;
case MediaPlayer.Event.Playing:
mRootView.setKeepScreenOn(true);
if (!mAlwaysOn)
mRootView.setKeepScreenOn(true);
mPlayPauseButton.setImageResource(R.drawable.ic_popup_pause);
showNotification();
break;
case MediaPlayer.Event.Paused:
mRootView.setKeepScreenOn(false);
if (!mAlwaysOn)
mRootView.setKeepScreenOn(false);
mPlayPauseButton.setImageResource(R.drawable.ic_popup_play);
showNotification();
break;
......
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