mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Fix: Product Adapter cleanup
This commit is contained in:
parent
4f31854876
commit
83a9efcfd7
@ -59,12 +59,8 @@ import java.lang.ref.WeakReference
|
||||
import java.util.*
|
||||
import kotlin.math.*
|
||||
|
||||
class ProductAdapter(private val callbacks: Callbacks, private val columns: Int) :
|
||||
class ProductAdapter(private val callbacks: Callbacks) :
|
||||
StableRecyclerAdapter<ProductAdapter.ViewType, RecyclerView.ViewHolder>() {
|
||||
companion object {
|
||||
private const val GRID_SPACING_OUTER_DP = 16
|
||||
private const val GRID_SPACING_INNER_DP = 8
|
||||
}
|
||||
|
||||
interface Callbacks {
|
||||
fun onActionClick(action: Action)
|
||||
|
@ -108,11 +108,10 @@ class ProductFragment() : ScreenFragment(), ProductAdapter.Callbacks {
|
||||
val content = fragmentBinding.fragmentContent
|
||||
content.addView(RecyclerView(content.context).apply {
|
||||
id = android.R.id.list
|
||||
val columns = (resources.configuration.screenWidthDp / 120).coerceIn(3, 5)
|
||||
this.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
isMotionEventSplittingEnabled = false
|
||||
isVerticalScrollBarEnabled = false
|
||||
val adapter = ProductAdapter(this@ProductFragment, columns)
|
||||
val adapter = ProductAdapter(this@ProductFragment)
|
||||
this.adapter = adapter
|
||||
addOnScrollListener(scrollListener)
|
||||
savedInstanceState?.getParcelable<ProductAdapter.SavedState>(STATE_ADAPTER)
|
||||
|
Loading…
x
Reference in New Issue
Block a user