[Android] Potential fix for IllegalArgumentException in RecyclerView recycling
Nicolas Pomepuy
git at videolan.org
Thu Feb 20 15:17:14 CET 2020
vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Feb 20 15:16:26 2020 +0100| [b2cc7b8930dcdfe500c6fbfa480a7b51d1d1a792] | committer: Geoffrey Métais
Potential fix for IllegalArgumentException in RecyclerView recycling
> https://code.videolan.org/videolan/vlc-android/commit/b2cc7b8930dcdfe500c6fbfa480a7b51d1d1a792
---
.../src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt
index 684e8b015..b08a342c2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.kt
@@ -30,12 +30,14 @@ import android.util.SparseBooleanArray
import android.view.Menu
import android.view.MenuItem
import android.view.View
+import android.view.animation.AccelerateDecelerateInterpolator
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.view.ActionMode
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.RecyclerView
+import androidx.transition.ChangeBounds
import androidx.transition.TransitionManager
import com.google.android.material.floatingactionbutton.FloatingActionButton
import kotlinx.coroutines.*
@@ -49,7 +51,6 @@ import org.videolan.vlc.R
import org.videolan.vlc.gui.AudioPlayerContainerActivity
import org.videolan.vlc.gui.ContentActivity
import org.videolan.vlc.gui.InfoActivity
-import org.videolan.vlc.gui.MainActivity
import org.videolan.vlc.gui.helpers.SparseBooleanArrayParcelable
import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.gui.helpers.UiTools.snackerConfirm
@@ -76,6 +77,10 @@ abstract class MediaBrowserFragment<T : SortableModel> : Fragment(), ActionMode.
var actionMode: ActionMode? = null
var fabPlay: FloatingActionButton? = null
private var savedSelection = SparseBooleanArray()
+ private val transition = ChangeBounds().apply {
+ interpolator = AccelerateDecelerateInterpolator()
+ duration = 300
+ }
open lateinit var viewModel: T
protected set
@@ -359,7 +364,8 @@ abstract class MediaBrowserFragment<T : SortableModel> : Fragment(), ActionMode.
val cs = ConstraintSet()
cs.clone(cl)
cs.setVisibility(R.id.searchButton, if (visible) ConstraintSet.VISIBLE else ConstraintSet.GONE)
- TransitionManager.beginDelayedTransition(cl)
+ transition.excludeChildren(RecyclerView::class.java, true)
+ TransitionManager.beginDelayedTransition(cl, transition)
cs.applyTo(cl)
} else
searchButtonView.visibility = if (visible) View.VISIBLE else View.GONE
More information about the Android
mailing list