[Android] MediaWrapper util ext functions
Geoffrey Métais
git at videolan.org
Tue Oct 16 10:53:38 CEST 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Oct 16 10:51:10 2018 +0200| [044ed8c250f0a109650bdc1337c929de02ba8aa1] | committer: Geoffrey Métais
MediaWrapper util ext functions
> https://code.videolan.org/videolan/vlc-android/commit/044ed8c250f0a109650bdc1337c929de02ba8aa1
---
vlc-android/src/org/videolan/vlc/util/Kextensions.kt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
index 14565a5ab..b7e49a11d 100644
--- a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+++ b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
@@ -8,10 +8,12 @@ import android.support.v4.app.Fragment
import android.support.v4.app.FragmentActivity
import android.support.v7.preference.PreferenceManager
import kotlinx.coroutines.experimental.Dispatchers
+import kotlinx.coroutines.experimental.IO
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.withContext
import org.videolan.libvlc.Media
import org.videolan.medialibrary.Medialibrary
+import org.videolan.medialibrary.media.MediaWrapper
import org.videolan.tools.SingletonHolder
import org.videolan.vlc.startMedialibrary
import java.io.File
@@ -58,6 +60,8 @@ suspend fun retry (
}
fun Media?.canExpand() = this != null && (type == Media.Type.Directory || type == Media.Type.Playlist)
+fun MediaWrapper?.isMedia() = this != null && (type == MediaWrapper.TYPE_AUDIO || type == MediaWrapper.TYPE_VIDEO)
+fun MediaWrapper?.isBrowserMedia() = this != null && (isMedia() || type == MediaWrapper.TYPE_DIR || type == MediaWrapper.TYPE_PLAYLIST)
fun Context.getAppSystemService(name: String) = applicationContext.getSystemService(name)!!
More information about the Android
mailing list