[Android] Fix root displayed in empty folder in onboarding + bredcrumbs not clickable.

Nicolas Pomepuy git at videolan.org
Thu Feb 21 16:49:59 CET 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Thu Feb 21 13:47:31 2019 +0100| [283fd05c0197b07c0c15f17c36e32d0fdd8c47a3] | committer: Geoffrey Métais

Fix root displayed in empty folder in onboarding + bredcrumbs not clickable.

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

 vlc-android/res/layout/onboarding_folders.xml        |  8 ++++----
 .../vlc/gui/browser/StorageBrowserFragment.kt        |  4 +++-
 .../vlc/gui/onboarding/OnboardingFoldersFragment.kt  | 20 ++++++++++++++------
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/vlc-android/res/layout/onboarding_folders.xml b/vlc-android/res/layout/onboarding_folders.xml
index 36013d9aa..9178ee944 100644
--- a/vlc-android/res/layout/onboarding_folders.xml
+++ b/vlc-android/res/layout/onboarding_folders.xml
@@ -20,17 +20,17 @@
         app:layout_constraintTop_toTopOf="parent"
         app:layout_scrollFlags="scroll|enterAlways" />
 
+
     <FrameLayout
         android:id="@+id/fragment_placeholder"
         android:layout_width="0dp"
         android:layout_height="0dp"
         android:layout_marginTop="48dp"
-        android:gravity="center_vertical"
-        android:textAlignment="center"
-        android:textColor="@color/white"
+        android:keyboardNavigationCluster="true"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintTop_toTopOf="parent"
+        tools:targetApi="o" />
 
 </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
index 9de72af41..588cd9d37 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
@@ -55,6 +55,7 @@ import org.videolan.vlc.gui.helpers.ThreeStatesCheckbox
 import org.videolan.vlc.gui.helpers.UiTools
 import org.videolan.vlc.util.AndroidDevices
 import org.videolan.vlc.util.CTX_CUSTOM_REMOVE
+import org.videolan.vlc.util.FileUtils
 import org.videolan.vlc.viewmodels.browser.BrowserModel
 import org.videolan.vlc.viewmodels.browser.TYPE_STORAGE
 import java.io.File
@@ -136,7 +137,8 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb {
         args.putBoolean(KEY_IN_MEDIALIB, mScannedDirectory || scanned)
         next.arguments = args
         ft?.replace(R.id.fragment_placeholder, next, media.location)
-        ft?.addToBackStack(mrl)
+        ft?.addToBackStack(if (isRootDirectory) "root" else currentMedia?.title
+                ?: FileUtils.getFileNameFromPath(mrl))
         ft?.commit()
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingFoldersFragment.kt b/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingFoldersFragment.kt
index 6c003a0fe..cdd8807dd 100644
--- a/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingFoldersFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingFoldersFragment.kt
@@ -11,20 +11,28 @@ import org.videolan.vlc.gui.browser.StorageBrowserFragment
 class OnboardingFoldersFragment : Fragment() {
 
 
+    private lateinit var storageBrowserFragment: StorageBrowserFragment
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        storageBrowserFragment = StorageBrowserFragment()
+    }
+
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
         return inflater.inflate(R.layout.onboarding_folders, container, false)
     }
 
-    override fun onActivityCreated(savedInstanceState: Bundle?) {
-        super.onActivityCreated(savedInstanceState)
-        val storageBrowserFragment = StorageBrowserFragment()
-        //todo : when opening an empty directory, the root is shown again + ariane is not clickable
-        childFragmentManager.beginTransaction()
-                .replace(R.id.fragment_placeholder, storageBrowserFragment)
+    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+        super.onViewCreated(view, savedInstanceState)
+
+        requireActivity().supportFragmentManager.beginTransaction()
+                .add(R.id.fragment_placeholder, storageBrowserFragment)
                 .commit()
 
+
     }
 
+
     companion object {
         fun newInstance(): OnboardingFoldersFragment {
             return OnboardingFoldersFragment()



More information about the Android mailing list