Guest User

Untitled

a guest
Jan 29th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. @JvmStatic
  2. fun setLayoutManagerProduct(recyclerView: RecyclerView, adapter: ProductAdapter?, displayProduct: DisplayProduct)
  3. {
  4. try
  5. {
  6. log("Utilities - setLayoutManagerProduct()")
  7.  
  8. if (adapter != null && adapter.displayType == displayProduct && recyclerView.layoutManager != null)
  9. {
  10. return
  11. }
  12.  
  13. when(displayProduct)
  14. {
  15. DisplayProduct.CARD ->
  16. {
  17. recyclerView.layoutManager = GridLayoutManager(MainActivity.getInstance(), 2)
  18. }
  19. DisplayProduct.LIST ->
  20. {
  21. recyclerView.layoutManager = LinearLayoutManager(MainActivity.getInstance(), RecyclerView.VERTICAL,false)
  22. }
  23. DisplayProduct.LIST_PLUS ->
  24. {
  25. recyclerView.layoutManager = LinearLayoutManager(MainActivity.getInstance(), RecyclerView.VERTICAL,false)
  26. }
  27. else ->{}
  28. }
  29. }
  30. catch (ex: Exception)
  31. {
  32. logError("Utilities - setLayoutManagerProduct()", ex)
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment