[Android] Do not show resume card if media is not found

Geoffrey Métais git at videolan.org
Fri Feb 21 14:34:07 CET 2020


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb 13 16:57:46 2020 +0100| [b8f296517e7c1c989b6b6665a0dde93a4f8ba714] | committer: Geoffrey Métais

Do not show resume card if media is not found

> https://code.videolan.org/videolan/vlc-android/commit/b8f296517e7c1c989b6b6665a0dde93a4f8ba714
---

 .../src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt        | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
index 9806c7b1e..6461a5bfe 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
@@ -63,7 +63,6 @@ import org.videolan.vlc.gui.helpers.BottomSheetBehavior
 import org.videolan.vlc.gui.helpers.UiTools
 import org.videolan.vlc.interfaces.IRefreshable
 import org.videolan.vlc.media.PlaylistManager
-import org.videolan.vlc.util.FileUtils
 
 private const val TAG = "VLC/APCActivity"
 
@@ -369,9 +368,8 @@ open class AudioPlayerContainerActivity : BaseActivity() {
         delay(1000L)
         if (PlaylistManager.showAudioPlayer.value == true) return at launchWhenStarted
         val song = settings.getString("current_song", null) ?: return at launchWhenStarted
-        val media = getFromMl { getMedia(Uri.parse(song)) }
-        val title = media?.title
-                ?: Uri.decode(FileUtils.getFileNameFromPath(song)).substringBeforeLast('.')
+        val media = getFromMl { getMedia(Uri.parse(song)) } ?: return at launchWhenStarted
+        val title = media.title
         resumeCard = Snackbar.make(appBarLayout, getString(R.string.resume_card_message, title), Snackbar.LENGTH_LONG)
                 .setAction(R.string.play) { PlaybackService.loadLastAudio(it.context) }
         resumeCard.show()



More information about the Android mailing list