Disable shared holders for now

This commit is contained in:
len 2016-08-01 00:09:34 +02:00
parent 4200409f79
commit 97454ca162
2 changed files with 8 additions and 8 deletions

View file

@ -94,7 +94,7 @@ class LibraryCategoryFragment : BaseFragment(), FlexibleViewHolder.OnListItemCli
// This crashes when opening a manga after changing categories, but then viewholders aren't // This crashes when opening a manga after changing categories, but then viewholders aren't
// recycled between pages. It may be fixed if this fragment is replaced with a custom view. // recycled between pages. It may be fixed if this fragment is replaced with a custom view.
//(recycler.layoutManager as LinearLayoutManager).recycleChildrenOnDetach = true //(recycler.layoutManager as LinearLayoutManager).recycleChildrenOnDetach = true
recycler.recycledViewPool = libraryFragment.pool //recycler.recycledViewPool = libraryFragment.pool
recycler.setHasFixedSize(true) recycler.setHasFixedSize(true)
recycler.adapter = adapter recycler.adapter = adapter
swipe_refresh.addView(recycler) swipe_refresh.addView(recycler)

View file

@ -7,7 +7,6 @@ import android.os.Bundle
import android.support.design.widget.TabLayout import android.support.design.widget.TabLayout
import android.support.v4.view.ViewPager import android.support.v4.view.ViewPager
import android.support.v7.view.ActionMode import android.support.v7.view.ActionMode
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.SearchView import android.support.v7.widget.SearchView
import android.view.* import android.view.*
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
@ -94,10 +93,11 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
/** /**
* A pool to share view holders between all the registered categories (fragments). * A pool to share view holders between all the registered categories (fragments).
*/ */
var pool = RecyclerView.RecycledViewPool().apply { setMaxRecycledViews(0, 20) } // TODO find out why this breaks sometimes
private set(value) { // var pool = RecyclerView.RecycledViewPool().apply { setMaxRecycledViews(0, 20) }
field = value.apply { setMaxRecycledViews(0, 20) } // private set(value) {
} // field = value.apply { setMaxRecycledViews(0, 20) }
// }
private var numColumnsSubscription: Subscription? = null private var numColumnsSubscription: Subscription? = null
@ -278,8 +278,8 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
* Reattaches the adapter to the view pager to recreate fragments * Reattaches the adapter to the view pager to recreate fragments
*/ */
private fun reattachAdapter() { private fun reattachAdapter() {
pool.clear() // pool.clear()
pool = RecyclerView.RecycledViewPool() // pool = RecyclerView.RecycledViewPool()
val position = view_pager.currentItem val position = view_pager.currentItem
view_pager.adapter = adapter view_pager.adapter = adapter
view_pager.currentItem = position view_pager.currentItem = position