[Android] Switch to popup mode option in video player
Geoffrey Métais
git at videolan.org
Fri Apr 1 12:03:58 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 30 10:07:40 2016 +0200| [f68215b26f1bd7cc39c2b9c665c702cfb54f3088] | committer: Geoffrey Métais
Switch to popup mode option in video player
> https://code.videolan.org/videolan/vlc-android/commit/f68215b26f1bd7cc39c2b9c665c702cfb54f3088
---
.../src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java | 9 ++++++++-
.../org/videolan/vlc/gui/video/VideoPlayerActivity.java | 14 +++++++++++++-
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
index c4d22bd..7c56ba2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -84,6 +84,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
private static final int ID_PLAYBACK_SPEED = 6 ;
private static final int ID_EQUALIZER = 7 ;
private static final int ID_SAVE_PLAYLIST = 8 ;
+ private static final int ID_POPUP_VIDEO = 9 ;
private Activity mActivity;
private int mTheme;
@@ -399,6 +400,9 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
case ID_PLAY_AS_AUDIO:
((VideoPlayerActivity)getActivity()).switchToAudioMode(true);
break;
+ case ID_POPUP_VIDEO:
+ ((VideoPlayerActivity)getActivity()).switchToPopupMode();
+ break;
case ID_EQUALIZER:
Intent i = new Intent(getActivity(), SecondaryActivity.class);
i.putExtra("fragment", SecondaryActivity.EQUALIZER);
@@ -467,16 +471,19 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
public void onConnected(PlaybackService service) {
mService = service;
int large_items = 0;
+ boolean tvUi = VLCApplication.showTvUi();
mAdapter.addOption(new Option(ID_SLEEP, R.attr.ic_sleep_normal_style));
mAdapter.addOption(new Option(ID_PLAYBACK_SPEED, R.attr.ic_speed_normal_style));
mAdapter.addOption(new Option(ID_JUMP_TO, R.attr.ic_jumpto_normal_style));
if (mMode == MODE_VIDEO) {
- if (!VLCApplication.showTvUi())
+ if (!tvUi)
mAdapter.addOption(new Option(ID_PLAY_AS_AUDIO, R.attr.ic_playasaudio_on));
mAdapter.addOption(new Option(ID_SPU_DELAY, R.attr.ic_subtitledelay));
mAdapter.addOption(new Option(ID_AUDIO_DELAY, R.attr.ic_audiodelay));
+ if (!tvUi)
+ mAdapter.addOption(new Option(ID_POPUP_VIDEO, R.attr.ic_playasaudio_on));
final MediaPlayer.Chapter[] chapters = mService.getChapters(-1);
final int chaptersCount = chapters != null ? chapters.length : 0;
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index f6fd00a..aa27a79 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -249,6 +249,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
* For uninterrupted switching between audio and video mode
*/
private boolean mSwitchingView;
+ private boolean mSwitchToPopup;
private boolean mHardwareAccelerationError;
private boolean mHasSubItems = false;
@@ -813,7 +814,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if(mSwitchingView && mService != null) {
Log.d(TAG, "mLocation = \"" + mUri + "\"");
- mService.showWithoutParse(mService.getCurrentMediaPosition());
+ if (mSwitchToPopup)
+ mService.switchToPopup(mService.getCurrentMediaPosition());
+ else
+ mService.showWithoutParse(mService.getCurrentMediaPosition());
return;
}
@@ -1640,6 +1644,14 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
}
}
+ public void switchToPopupMode() {
+ if (mHardwareAccelerationError || mService == null)
+ return;
+ mSwitchingView = true;
+ mSwitchToPopup = true;
+ exitOK();
+ }
+
public void switchToAudioMode(boolean showUI) {
if (mHardwareAccelerationError || mService == null)
return;
More information about the Android
mailing list