From 21833a5ab059c951337b008591036769acdb9e30 Mon Sep 17 00:00:00 2001 From: skydoves Date: Wed, 2 Sep 2020 00:09:02 +0900 Subject: [PATCH] Use notifyItemRangeChanged instead of notifyDataSetChanged in PokemonAdapter --- .../java/com/skydoves/pokedex/ui/adapter/PokemonAdapter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/skydoves/pokedex/ui/adapter/PokemonAdapter.kt b/app/src/main/java/com/skydoves/pokedex/ui/adapter/PokemonAdapter.kt index 82ae0f398..fcd5aab43 100644 --- a/app/src/main/java/com/skydoves/pokedex/ui/adapter/PokemonAdapter.kt +++ b/app/src/main/java/com/skydoves/pokedex/ui/adapter/PokemonAdapter.kt @@ -49,8 +49,9 @@ class PokemonAdapter : RecyclerView.Adapter() } fun addPokemonList(pokemonList: List) { + val previous = items.size items.addAll(pokemonList) - notifyDataSetChanged() + notifyItemRangeChanged(previous, pokemonList.size) } override fun onBindViewHolder(holder: PokemonViewHolder, position: Int) {