Skip to content

Commit

Permalink
Merge pull request #132 from AntaOtk/filter128
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
MaxCanon authored Nov 15, 2023
2 parents ad7b0c3 + 849f5c7 commit 9722ee6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class FilterInteractorImpl(
}

override fun setSelectedCountry(country: Country?) {
val lastCountry = repository.getSelectedCountry()
if (lastCountry != country) setSelectedArea(null)
repository.setSelectedCountry(country)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class SettingsFilterFragment : Fragment() {
private fun showFilters(filters: Filters) {
val countryName = filters.country?.name ?: ""
val areaName = filters.area?.name ?: ""
if (countryName.isNotEmpty()) binding.workPlaceEt.setText("$countryName, $areaName")
if (areaName.isNotEmpty()) binding.workPlaceEt.setText("$countryName, $areaName") else binding.workPlaceEt.setText(countryName)
binding.industryTextInputEditText.setText(filters.industry?.name ?: "")
binding.salaryEt.setText(filters.preferSalary)
binding.doNotShowWithoutSalaryCheckBox.isChecked = filters.isIncludeSalary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class SelectCountryFragment : Fragment() {
when (state) {
is CountryState.Display -> displayCountries(state.content)
is CountryState.Error -> displayError(state.errorText)
else -> {}
}
}
viewModel.getCountries()
Expand All @@ -54,7 +55,7 @@ class SelectCountryFragment : Fragment() {
}
if (countryAdapter == null) {
countryAdapter = CountryAdapter(countries) { country ->
viewModel.onAreaClicked(country)
viewModel.onClicked(country)
findNavController().popBackStack()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class SelectCountryViewModel(
}
}

fun onAreaClicked(area: Country) {
interactor.setSelectedCountry(area)
fun onClicked(country: Country) {
interactor.setSelectedCountry(country)
}

fun loadSelectedCountry() {
Expand Down

0 comments on commit 9722ee6

Please sign in to comment.