Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.1.1/AN-feat] PokemonList 화면에서 필터링, 정렬, 검색 시 Scroll 최상단으로 올리기 #433

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,7 +64,9 @@ 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(
Expand Down Expand Up @@ -111,15 +112,14 @@ class PokemonListActivity :
startActivity(PokemonDetailActivity.intent(this, pokemonId))
}
}
val fm: FragmentManager = supportFragmentManager

fm.setFragmentResultListener(FILTER_RESULT_KEY, this) { key, bundle ->
supportFragmentManager.setFragmentResultListener(FILTER_RESULT_KEY, this) { key, bundle ->
val filterArgs: PokeFilterUiModel =
PokemonFilterBottomSheetFragment.argsFrom(bundle)
?: return@setFragmentResultListener
viewModel.filterPokemon(filterArgs)
}
fm.setFragmentResultListener(SORT_RESULT_KEY, this) { key, bundle ->
supportFragmentManager.setFragmentResultListener(SORT_RESULT_KEY, this) { key, bundle ->
val sortArgs: PokemonSortUiModel =
PokemonSortBottomSheetFragment.argsFrom(bundle)
?: return@setFragmentResultListener
Expand Down
Loading