[Android] TV: Directly browse internal storage from VLC home
Geoffrey Métais
git at videolan.org
Tue May 21 14:41:05 CEST 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May 20 16:15:28 2019 +0200| [a60358723cdb0ff2af1258dcf315ff1de33eb95a] | committer: Geoffrey Métais
TV: Directly browse internal storage from VLC home
> https://code.videolan.org/videolan/vlc-android/commit/a60358723cdb0ff2af1258dcf315ff1de33eb95a
---
.../org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt | 8 +++++---
.../org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt | 11 +++++------
.../org/videolan/vlc/gui/tv/browser/VerticalGridActivity.kt | 2 +-
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt
index fd8da7d4c..ee88b1c52 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt
@@ -58,6 +58,7 @@ import org.videolan.vlc.gui.tv.*
import org.videolan.vlc.gui.tv.browser.interfaces.BrowserFragmentInterface
import org.videolan.vlc.gui.view.RecyclerSectionItemGridDecoration
import org.videolan.vlc.interfaces.IEventsHandler
+import org.videolan.vlc.util.AndroidDevices
import org.videolan.vlc.util.RefreshModel
import org.videolan.vlc.util.getScreenWidth
import org.videolan.vlc.viewmodels.SortableModel
@@ -117,9 +118,10 @@ abstract class BaseBrowserTvFragment : Fragment(), BrowserFragmentInterface, IEv
calculateNbColumns()
- title.text = if (viewModel.currentItem != null) {
- viewModel.currentItem!!.title
- } else getTitle()
+ title.text = viewModel.currentItem?.let {
+ if (it is MediaWrapper && it.uri.path == AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY) getString(R.string.internal_memory)
+ else it.title
+ } ?: getTitle()
val searchHeaderClick: (View) -> Unit = { animationDelegate.hideFAB() }
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
index 995d9fab6..9bb232aa1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
@@ -34,12 +34,11 @@ class FileBrowserTvFragment : BaseBrowserTvFragment() {
private var item: MediaLibraryItem? = null
override lateinit var adapter: TvItemAdapter
- override fun getTitle(): String =
- when (getCategory()) {
- TYPE_FILE -> getString(R.string.directories)
- TYPE_NETWORK -> getString(R.string.network_browsing)
- else -> getString(R.string.video)
- }
+ override fun getTitle() = when (getCategory()) {
+ TYPE_FILE -> getString(R.string.directories)
+ TYPE_NETWORK -> getString(R.string.network_browsing)
+ else -> getString(R.string.video)
+ }
override fun getColumnNumber(): Int =
resources.getInteger(R.integer.tv_songs_col_count)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.kt
index bc1f9c387..cec5dbfcb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.kt
@@ -72,7 +72,7 @@ class VerticalGridActivity : BaseTvActivity(), BrowserActivityInterface {
fragment = FileBrowserTvFragment.newInstance(TYPE_NETWORK, item)
} else if (type == HEADER_DIRECTORIES) {
- fragment = FileBrowserTvFragment.newInstance(TYPE_FILE, null)
+ fragment = FileBrowserTvFragment.newInstance(TYPE_FILE, intent.data?.let { MediaWrapper(it) })
} else {
finish()
return
More information about the Android
mailing list