[Android] Allow switching to video in the advanced options
Nicolas Pomepuy
git at videolan.org
Tue Feb 8 14:39:35 UTC 2022
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Feb 8 09:20:23 2022 +0100| [62d8c53d4957fbf59b600d71e0c24f2c11e671cb] | committer: Nicolas Pomepuy
Allow switching to video in the advanced options
> https://code.videolan.org/videolan/vlc-android/commit/62d8c53d4957fbf59b600d71e0c24f2c11e671cb
---
application/resources/src/main/res/drawable/ic_playasaudio_off.xml | 4 ++--
.../src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt | 7 +++++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/application/resources/src/main/res/drawable/ic_playasaudio_off.xml b/application/resources/src/main/res/drawable/ic_playasaudio_off.xml
index 727646d26..3f6ee4ea2 100644
--- a/application/resources/src/main/res/drawable/ic_playasaudio_off.xml
+++ b/application/resources/src/main/res/drawable/ic_playasaudio_off.xml
@@ -6,6 +6,6 @@
android:viewportHeight="48">
<path
android:pathData="M8,8C5.784,8 4,9.784 4,12L4,36C4,38.216 5.784,40 8,40L40,40C42.216,40 44,38.216 44,36L44,12C44,9.784 42.216,8 40,8L8,8zM8,12L40,12L40,36L8,36L8,12zM20,17C19.4477,17.0001 19.0001,17.4477 19,18L19,30C18.9998,30.7985 19.8799,31.2713 20.5547,30.832L29.5547,24.832C30.1483,24.4361 30.1483,23.5639 29.5547,23.168L20.5547,17.168C20.3904,17.0585 20.1974,17 20,17z"
- tools:fillColor="#ffffff"
- android:fillColor="?attr/player_icon_color"/>
+ tools:fillColor="#ffffff"
+ android:fillColor="?attr/player_icon_color"/>
</vector>
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
index e4532de07..7eb3fe330 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
@@ -41,6 +41,7 @@ private const val ACTION_SPU_DELAY = 3
private const val ID_PLAY_AS_AUDIO = 0L
private const val ID_SLEEP = 1L
private const val ID_JUMP_TO = 2L
+private const val ID_PLAY_AS_VIDEO = 3L
private const val ID_BOOKMARK = 4L
private const val ID_CHAPTER_TITLE = 5L
private const val ID_PLAYBACK_SPEED = 6L
@@ -97,6 +98,8 @@ class PlayerOptionsDelegate(val activity: FragmentActivity, val service: Playbac
options.add(PlayerOption(ID_REPEAT, R.drawable.ic_repeat, res.getString(R.string.repeat_title)))
if (service.canShuffle()) options.add(PlayerOption(ID_SHUFFLE, R.drawable.ic_shuffle, res.getString(R.string.shuffle_title)))
options.add(PlayerOption(ID_VIDEO_STATS, R.drawable.ic_video_stats, res.getString(R.string.video_information)))
+ } else {
+ if (service.videoTracksCount > 0) options.add(PlayerOption(ID_PLAY_AS_VIDEO, R.drawable.ic_playasaudio_off, res.getString(R.string.play_as_video)))
}
val chaptersCount = service.getChapters(-1)?.size ?: 0
if (chaptersCount > 1) options.add(PlayerOption(ID_CHAPTER_TITLE, R.drawable.ic_chapter, res.getString(R.string.go_to_chapter)))
@@ -153,6 +156,10 @@ class PlayerOptionsDelegate(val activity: FragmentActivity, val service: Playbac
showFragment(ID_SLEEP)
}
ID_PLAY_AS_AUDIO -> (activity as VideoPlayerActivity).switchToAudioMode(true)
+ ID_PLAY_AS_VIDEO -> {
+ val audioPlayerContainerActivity = activity as AudioPlayerContainerActivity
+ audioPlayerContainerActivity.audioPlayer.onResumeToVideoClick()
+ }
ID_POPUP_VIDEO -> {
(activity as VideoPlayerActivity).switchToPopup()
hide()
More information about the Android
mailing list