[Android] Fix breadcrumb visibility

Geoffrey Métais git at videolan.org
Wed Jun 13 14:31:44 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jun 13 14:31:19 2018 +0200| [be66e6af0ef19f7ad239188a07a0c8da5a78d4a4] | committer: Geoffrey Métais

Fix breadcrumb visibility

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

 .../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt        | 4 +++-
 .../src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java     | 7 +++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
index 31739c610..851161748 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
@@ -129,7 +129,9 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
         viewModel.dataset.observe(this, Observer<MutableList<MediaLibraryItem>> { mediaLibraryItems -> adapter.update(mediaLibraryItems!!) })
         viewModel.getDescriptionUpdate().observe(this, Observer { pair -> if (pair != null) adapter.notifyItemChanged(pair.first, pair.second) })
         initFavorites()
+    }
 
+    override fun setBreadcrumb() {
         val ariane = requireActivity().findViewById<RecyclerView>(R.id.ariane)
         currentMedia?.let {
             ariane.visibility = View.VISIBLE
@@ -140,7 +142,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
                 did.setDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.divider_grey_50_18dp)!!)
                 ariane.addItemDecoration(did)
             }
-            ariane.scrollToPosition(ariane.adapter.itemCount -1)
+            ariane.scrollToPosition(ariane.adapter.itemCount - 1)
         } ?: run { ariane.visibility = View.GONE }
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
index c29513c5e..c0cd3048d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
@@ -36,6 +36,7 @@ import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentActivity;
 import android.support.v7.app.AppCompatActivity;
 import android.support.v7.view.ActionMode;
+import android.support.v7.widget.RecyclerView;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
@@ -92,6 +93,12 @@ public abstract class MediaBrowserFragment<T extends BaseModel> extends Fragment
         mSwipeRefreshLayout = view.findViewById(R.id.swipeLayout);
         if (mSwipeRefreshLayout != null) mSwipeRefreshLayout.setColorSchemeResources(R.color.orange700);
             mFabPlay = getActivity().findViewById(R.id.fab);
+        setBreadcrumb();
+    }
+
+    protected void setBreadcrumb() {
+        final RecyclerView ariane = requireActivity().findViewById(R.id.ariane);
+        if (ariane != null) ariane.setVisibility(View.GONE);
     }
 
     public void onStart() {



More information about the Android mailing list