Skip to content

Commit

Permalink
feat: pokemones 가 변경되었을 때 스크롤 최상단으로 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
murjune committed Oct 27, 2024
1 parent 7217209 commit b8a7784
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package poke.rogue.helper.presentation.dex
import android.content.res.Configuration
import android.os.Bundle
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.GridLayoutManager
import org.koin.androidx.viewmodel.ext.android.viewModel
import poke.rogue.helper.R
Expand Down Expand Up @@ -65,15 +64,17 @@ class PokemonListActivity :
private fun initObservers() {
repeatOnStarted {
viewModel.uiState.collect { uiState ->
pokemonAdapter.submitList(uiState.pokemons)
pokemonAdapter.submitList(uiState.pokemons) {
binding.rvPokemonList.scrollToPosition(0)
}

binding.chipPokeFiter.bindPokeChip(
PokeChip.Spec(
label =
stringOf(
R.string.dex_filter_chip,
if (uiState.isFiltered) uiState.filterCount.toString() else "",
),
stringOf(
R.string.dex_filter_chip,
if (uiState.isFiltered) uiState.filterCount.toString() else "",
),
trailingIconRes = R.drawable.ic_filter,
isSelected = uiState.isFiltered,
padding = PaddingValues(horizontal = 10.dp, vertical = 8.dp),
Expand Down

0 comments on commit b8a7784

Please sign in to comment.