Skip to content

Commit

Permalink
detekt fix9
Browse files Browse the repository at this point in the history
  • Loading branch information
Logomann committed Aug 21, 2024
1 parent b4a8d00 commit 2b1f787
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class FilterPlaceOfWorkFragment : Fragment() {
val json = bundle.getString(REGION_BUNDLE_KEY).toString()
val type = object : TypeToken<Region>() {}.type
region = Gson().fromJson(json, type)
getCountryName(region)
viewModel.getCountryName(region, false)
viewModel.setRegionName(region)
}

Expand Down Expand Up @@ -173,15 +173,11 @@ class FilterPlaceOfWorkFragment : Fragment() {

private fun initButtonListeners() {
binding.selectPlaceOfWorkToolbar.setNavigationOnClickListener { findNavController().navigateUp() }
binding.applyButton.setOnClickListener { saveFilters() }
binding.applyButton.setOnClickListener { viewModel.saveFields(country, region) }
binding.countryTextInput.setOnClickListener { navigateToCountrySelection() }
binding.regionTextInput.setOnClickListener { navigateToRegionSelection() }
}

private fun getCountryName(region: Region) {
viewModel.getCountryName(region, false)
}

private fun initTextBehaviour() {
binding.countryTextInput.doOnTextChanged { text, _, _, _ ->
updateCountryHintAppearance(text?.isNotEmpty() == true)
Expand All @@ -191,10 +187,6 @@ class FilterPlaceOfWorkFragment : Fragment() {
}
}

private fun saveFilters() {
viewModel.saveFields(country, region)
}

private fun setNoCountryEndIcon() {
binding.countryLayout.apply {
setEndIconDrawable(R.drawable.ic_arrow_forward_14px)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import ru.practicum.android.diploma.R
import ru.practicum.android.diploma.databinding.FragmentSearchBinding
import ru.practicum.android.diploma.domain.models.Vacancy
import ru.practicum.android.diploma.presentation.viewmodels.SearchViewModel
import ru.practicum.android.diploma.ui.fragments.FilterFragment.Companion.FILTER_REQUEST_KEY
import ru.practicum.android.diploma.ui.state.SearchScreenState
import ru.practicum.android.diploma.util.FILTER_REQUEST_KEY
import ru.practicum.android.diploma.util.ResponseData
import ru.practicum.android.diploma.util.adapter.VacancyAdapter

Expand Down

0 comments on commit 2b1f787

Please sign in to comment.