[Android] VideoInBackground: add restore tip shown count
Duncan McNamara
git at videolan.org
Mon Feb 13 12:34:20 UTC 2023
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Fri Feb 10 11:44:50 2023 +0100| [0c280087f913d7a91a20c9a4d45b4cac5de62f71] | committer: Nicolas Pomepuy
VideoInBackground: add restore tip shown count
Everytime the audio player is created, if a video is playing only audio,
ie a user left the app with video playing in the background, it will
show a snacker tip to restore to video by long pressing the cover.
This should only be shown a few times. Four in this case.
> https://code.videolan.org/videolan/vlc-android/commit/0c280087f913d7a91a20c9a4d45b4cac5de62f71
---
application/tools/src/main/java/org/videolan/tools/Settings.kt | 1 +
.../vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/application/tools/src/main/java/org/videolan/tools/Settings.kt b/application/tools/src/main/java/org/videolan/tools/Settings.kt
index 1e6a10fbb8..890cb5b8f2 100644
--- a/application/tools/src/main/java/org/videolan/tools/Settings.kt
+++ b/application/tools/src/main/java/org/videolan/tools/Settings.kt
@@ -113,6 +113,7 @@ const val ML_SCAN_OFF = 1
const val PREF_TIPS_SHOWN = "video_player_tips_shown"
const val PREF_WIDGETS_TIPS_SHOWN = "widgets_tips_shown"
+const val PREF_RESTORE_VIDEO_TIPS_SHOWN = "pref_restore_video_tips_shown"
const val PREF_TV_UI = "tv_ui"
const val FORCE_PLAY_ALL_VIDEO = "force_play_all_video"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index d87311d5cd..0e93d2395c 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -127,9 +127,12 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
playlistAdapter = PlaylistAdapter(this)
settings = Settings.getInstance(requireContext())
playlistModel = PlaylistModel.get(this)
+ val restoreVideoTipCount = settings.getInt(PREF_RESTORE_VIDEO_TIPS_SHOWN, 0)
playlistModel.service?.let {
- if (!it.isVideoPlaying && it.videoTracksCount > 0)
+ if (!it.isVideoPlaying && it.videoTracksCount > 0 && restoreVideoTipCount < 4) {
UiTools.snacker(requireActivity(), R.string.return_to_video)
+ settings.putSingle(PREF_RESTORE_VIDEO_TIPS_SHOWN, restoreVideoTipCount + 1)
+ }
}
playlistModel.progress.observe(this at AudioPlayer) { it?.let { updateProgress(it) } }
playlistModel.speed.observe(this at AudioPlayer) { showChips() }
More information about the Android
mailing list