Skip to content

Commit

Permalink
Merge pull request #122 from NiranjanNlc/duplicatecodeShopFragment
Browse files Browse the repository at this point in the history
 refactored duplicate code items of assighning adapter
  • Loading branch information
hieuwu authored Oct 2, 2022
2 parents 55b8499 + 6df8af9 commit cc6bdb5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
1 change: 0 additions & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ShopFragment : Fragment() {
private lateinit var viewModel: ShopViewModel
private lateinit var dots: Array<ImageView>
private lateinit var binding: FragmentShopBinding

private lateinit var gridListItemAdapter: GridListItemAdapter
private lateinit var nonActiveDot: Drawable
private lateinit var activeDot: Drawable
private var dotCount: Int = 0
Expand Down Expand Up @@ -122,34 +122,25 @@ class ShopFragment : Fragment() {
}

private fun setUpRecyclerView() {
binding.exclusiveOfferRecyclerview.adapter =
GridListItemAdapter(
GridListItemAdapter.OnClickListener(
clickListener = { viewModel.displayPropertyDetails(it) },
addToCartListener = { addToCart(it) }
)
gridListItemAdapter = GridListItemAdapter(
GridListItemAdapter.OnClickListener(
clickListener = { viewModel.displayPropertyDetails(it) },
addToCartListener = { addToCart(it) }
)
)
binding.exclusiveOfferRecyclerview.adapter =
gridListItemAdapter

binding.exclusiveOfferRecyclerview.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)

binding.bestSellingRecyclerview.adapter =
GridListItemAdapter(
GridListItemAdapter.OnClickListener(
clickListener = { viewModel.displayPropertyDetails(it) },
addToCartListener = { addToCart(it) }
)
)
gridListItemAdapter

binding.bestSellingRecyclerview.layoutManager =
LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)

binding.recommendedRecyclerview.adapter =
GridListItemAdapter(
GridListItemAdapter.OnClickListener(
clickListener = { viewModel.displayPropertyDetails(it) },
addToCartListener = { addToCart(it) }
)
)
gridListItemAdapter

binding.recommendedRecyclerview.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
}
Expand Down

0 comments on commit cc6bdb5

Please sign in to comment.