[Android] Fix TV breadcrumb layout and animation issues
Nicolas Pomepuy
git at videolan.org
Fri May 28 08:46:00 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu May 27 09:07:50 2021 +0200| [acb3376319104dc3ac2a52e1e6f4f1d2990d57d7] | committer: Nicolas Pomepuy
Fix TV breadcrumb layout and animation issues
> https://code.videolan.org/videolan/vlc-android/commit/acb3376319104dc3ac2a52e1e6f4f1d2990d57d7
---
.../television/ui/MediaBrowserAnimatorDelegate.kt | 6 ++---
.../television/ui/browser/FileBrowserTvFragment.kt | 18 +++++++-------
.../src/main/res/layout/song_browser.xml | 28 +++++++++++-----------
.../org/videolan/vlc/gui/browser/PathAdapter.kt | 2 --
4 files changed, 24 insertions(+), 30 deletions(-)
diff --git a/application/television/src/main/java/org/videolan/television/ui/MediaBrowserAnimatorDelegate.kt b/application/television/src/main/java/org/videolan/television/ui/MediaBrowserAnimatorDelegate.kt
index e1e9a405b..47687a85b 100644
--- a/application/television/src/main/java/org/videolan/television/ui/MediaBrowserAnimatorDelegate.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/MediaBrowserAnimatorDelegate.kt
@@ -231,10 +231,8 @@ internal class MediaBrowserAnimatorDelegate(val binding: SongBrowserBinding, pri
scrolledDownFABCollapsedConstraintSet.connect(R.id.favoriteDescription, ConstraintSet.BOTTOM, R.id.imageButtonFavorite, ConstraintSet.BOTTOM)
// Title escapes by the top of the screen
- scrolledDownFABCollapsedConstraintSet.constrainMaxHeight(R.id.title, ConstraintSet.TOP)
- scrolledDownFABCollapsedConstraintSet.constrainMaxHeight(R.id.ariane, ConstraintSet.TOP)
- scrolledDownFABCollapsedConstraintSet.connect(R.id.title, ConstraintSet.BOTTOM, 0, ConstraintSet.TOP)
- scrolledDownFABCollapsedConstraintSet.connect(R.id.ariane, ConstraintSet.BOTTOM, 0, ConstraintSet.TOP)
+ scrolledDownFABCollapsedConstraintSet.connect(R.id.title, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.TOP)
+ scrolledDownFABCollapsedConstraintSet.connect(R.id.ariane, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.TOP)
scrolledDownFABCollapsedConstraintSet.clear(R.id.ariane, ConstraintSet.TOP)
//FAB showing
diff --git a/application/television/src/main/java/org/videolan/television/ui/browser/FileBrowserTvFragment.kt b/application/television/src/main/java/org/videolan/television/ui/browser/FileBrowserTvFragment.kt
index 5f1f0c40b..edebe7721 100644
--- a/application/television/src/main/java/org/videolan/television/ui/browser/FileBrowserTvFragment.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/browser/FileBrowserTvFragment.kt
@@ -136,13 +136,11 @@ class FileBrowserTvFragment : BaseBrowserTvFragment<MediaLibraryItem>(), PathAda
private fun MediaWrapper?.setBreadcrumb() {
if (this == null) return
- val ariane = requireActivity().findViewById<RecyclerView>(R.id.ariane)
- ?: return
if (isSchemeSupported(uri?.scheme)) {
- ariane.visibility = View.VISIBLE
- ariane.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
- ariane.adapter = PathAdapter(this at FileBrowserTvFragment, this)
- if (ariane.itemDecorationCount == 0) {
+ binding.ariane.visibility = View.VISIBLE
+ binding.ariane.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
+ binding.ariane.adapter = PathAdapter(this at FileBrowserTvFragment, this)
+ if (binding.ariane.itemDecorationCount == 0) {
val did = object : VLCDividerItemDecoration(requireActivity(), HORIZONTAL, VectorDrawableCompat.create(requireActivity().resources, R.drawable.ic_divider, requireActivity().theme)!!) {
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
val position = parent.getChildAdapterPosition(view)
@@ -155,11 +153,11 @@ class FileBrowserTvFragment : BaseBrowserTvFragment<MediaLibraryItem>(), PathAda
}
}
did.setDrawable(VectorDrawableCompat.create(requireActivity().resources, R.drawable.ic_divider, requireActivity().theme)!!)
- ariane.addItemDecoration(did)
+ binding.ariane.addItemDecoration(did)
}
- ariane.scrollToPosition(ariane.adapter!!.itemCount - 1)
- } else ariane.visibility = View.GONE
- animationDelegate.setVisibility(binding.title, if (ariane.visibility == View.GONE) View.VISIBLE else View.GONE)
+ binding.ariane.scrollToPosition(binding.ariane.adapter!!.itemCount - 1)
+ } else binding.ariane.visibility = View.GONE
+ animationDelegate.setVisibility(binding.title, if (binding.ariane.visibility == View.GONE) View.VISIBLE else View.GONE)
}
override fun backTo(tag: String) {
diff --git a/application/television/src/main/res/layout/song_browser.xml b/application/television/src/main/res/layout/song_browser.xml
index 13f034aa3..227da2b86 100644
--- a/application/television/src/main/res/layout/song_browser.xml
+++ b/application/television/src/main/res/layout/song_browser.xml
@@ -48,20 +48,20 @@
app:layout_constraintTop_toTopOf="parent"
tools:text="Tracks" />
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/ariane"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/tv_overscan_horizontal"
- android:layout_marginTop="@dimen/tv_overscan_vertical"
- android:layout_marginEnd="8dp"
- android:clipToPadding="false"
- android:paddingLeft="16dp"
- android:paddingRight="16dp"
- app:layout_constraintEnd_toStartOf="@+id/favoriteButton"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- tools:layout_height="48dp" />
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/ariane"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/tv_overscan_horizontal"
+ android:layout_marginTop="@dimen/tv_overscan_vertical"
+ android:layout_marginEnd="8dp"
+ android:clipToPadding="false"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ app:layout_constraintEnd_toStartOf="@+id/favoriteButton"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ tools:layout_height="48dp" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/displayButton"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/PathAdapter.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/PathAdapter.kt
index b3f106da4..d27b2dc0b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/PathAdapter.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/PathAdapter.kt
@@ -83,8 +83,6 @@ class PathAdapter(val browser: PathAdapterListener, media: MediaWrapper) : Recyc
for (i in 0..index) pathOperationDelegate.appendPathToUri(pathParts[i], currentPathUri)
list.add(currentPathUri.toString())
}
- if (BuildConfig.DEBUG) list.forEach { Log.d(this::class.java.simpleName, "Added in breadcrumb: $it") }
-
if (browser.showRoot()) list.add(0, browserTitle)
return list
}
More information about the Android
mailing list