Skip to content

Instantly share code, notes, and snippets.

@gastsail
Created June 27, 2020 18:35
Show Gist options
  • Save gastsail/95a376e704a74ff919726a46cf58c7db to your computer and use it in GitHub Desktop.
Save gastsail/95a376e704a74ff919726a46cf58c7db to your computer and use it in GitHub Desktop.
val animalAdapter = AnimalAdapter(this)
animalAdapter.setAnimals(mutableListOf(Animal("Dog","DogImgUrl"),Animal("Cat","CatImgUrl"),Animal("Hamster","HamsterImgUrl"),Animal("Shark","SharkImgUrl"))
val breedAdapter = DogBreedAdapter(this)
breedAdapter.setBreeds(mutableListOf(Breed("Bulldog"),Breed("Beagle"),Breed("Bulldog"),Breed("Golden retriever"))
//Lets create now the ConcatAdapter with these adapters ready
val concatAdapter = ConcatAdapter(GridConcatAdapter(this,animalAdapter,4),breedAdapter)
animal_rv.layoutManager = LinearLayoutManager(requireContext())
animal_rv.adapter = concatAdapter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment