Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @JvmStatic
- fun setLayoutManagerProduct(recyclerView: RecyclerView, adapter: ProductAdapter?, displayProduct: DisplayProduct)
- {
- try
- {
- log("Utilities - setLayoutManagerProduct()")
- if (adapter != null && adapter.displayType == displayProduct && recyclerView.layoutManager != null)
- {
- return
- }
- when(displayProduct)
- {
- DisplayProduct.CARD ->
- {
- recyclerView.layoutManager = GridLayoutManager(MainActivity.getInstance(), 2)
- }
- DisplayProduct.LIST ->
- {
- recyclerView.layoutManager = LinearLayoutManager(MainActivity.getInstance(), RecyclerView.VERTICAL,false)
- }
- DisplayProduct.LIST_PLUS ->
- {
- recyclerView.layoutManager = LinearLayoutManager(MainActivity.getInstance(), RecyclerView.VERTICAL,false)
- }
- else ->{}
- }
- }
- catch (ex: Exception)
- {
- logError("Utilities - setLayoutManagerProduct()", ex)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment