[Android] Share RecycledViewPool between RecyclerViews

Geoffrey Métais git at videolan.org
Tue Jan 10 18:15:27 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 10 17:57:56 2017 +0100| [554c6e2a550ab9cd3d804161b547d19fa8b0b688] | committer: Geoffrey Métais

Share RecycledViewPool between RecyclerViews

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

 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java        | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index 45d85c5..4fdfbe8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -156,8 +156,12 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDis
     @Override
     public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
+        RecyclerView.RecycledViewPool rvp = new RecyclerView.RecycledViewPool();
         for (int i = 0; i< mLists.length; ++i) {
-            mLists[i].setLayoutManager(new LinearLayoutManager(getActivity()));
+            LinearLayoutManager llm = new LinearLayoutManager(getActivity());
+            llm.setRecycleChildrenOnDetach(true);
+            mLists[i].setLayoutManager(llm);
+            mLists[i].setRecycledViewPool(rvp);
             mLists[i].setAdapter(mAdapters[i]);
         }
         mViewPager.setOnTouchListener(mSwipeFilter);



More information about the Android mailing list