diff --git a/app/src/main/java/app/nexd/android/ui/seeker/create/SeekerCreateRequestViewModel.kt b/app/src/main/java/app/nexd/android/ui/seeker/create/SeekerCreateRequestViewModel.kt index 66ade17..ba8bb2c 100644 --- a/app/src/main/java/app/nexd/android/ui/seeker/create/SeekerCreateRequestViewModel.kt +++ b/app/src/main/java/app/nexd/android/ui/seeker/create/SeekerCreateRequestViewModel.kt @@ -10,6 +10,7 @@ import app.nexd.android.api.model.CreateHelpRequestArticleDto import app.nexd.android.api.model.HelpRequestCreateDto import app.nexd.android.api.model.User import app.nexd.android.ui.common.HelpRequestCreateArticleBinder +import app.nexd.android.ui.utils.SingleLiveEvent import io.reactivex.android.schedulers.AndroidSchedulers.mainThread import io.reactivex.disposables.CompositeDisposable @@ -17,11 +18,12 @@ class SeekerCreateRequestViewModel(private val api: Api) : ViewModel() { sealed class Progress { object Idle : Progress() - object Loading : Progress() class Error(@StringRes val message: Int? = null) : Progress() object Finished : Progress() } + val navigateToConfirmAddress = SingleLiveEvent() + val progress = MutableLiveData(Progress.Idle) val firstName = MutableLiveData() @@ -90,7 +92,7 @@ class SeekerCreateRequestViewModel(private val api: Api) : ViewModel() { selectedArticles.clear() setSelectedArticles() if (selectedArticles.isNotEmpty()) { - progress.value = Progress.Loading + navigateToConfirmAddress.call() } else { progress.value = Progress.Error(R.string.seeker_request_create_no_articles) } diff --git a/app/src/main/java/app/nexd/android/ui/seeker/create/address/SeekerCreateRequestConfirmAddressFragment.kt b/app/src/main/java/app/nexd/android/ui/seeker/create/address/SeekerCreateRequestConfirmAddressFragment.kt index d5bc41e..484ff64 100644 --- a/app/src/main/java/app/nexd/android/ui/seeker/create/address/SeekerCreateRequestConfirmAddressFragment.kt +++ b/app/src/main/java/app/nexd/android/ui/seeker/create/address/SeekerCreateRequestConfirmAddressFragment.kt @@ -61,9 +61,6 @@ class SeekerCreateRequestConfirmAddressFragment : Fragment() { is Idle -> { // nothing to do } - is Loading -> { - // - } is Error -> { it.message?.let { errorMessageId -> DefaultSnackbar(binding.root, errorMessageId, Snackbar.LENGTH_SHORT) diff --git a/app/src/main/java/app/nexd/android/ui/seeker/create/articles/SeekerCreateRequestEnterArticlesFragment.kt b/app/src/main/java/app/nexd/android/ui/seeker/create/articles/SeekerCreateRequestEnterArticlesFragment.kt index e05a574..67eb4ef 100644 --- a/app/src/main/java/app/nexd/android/ui/seeker/create/articles/SeekerCreateRequestEnterArticlesFragment.kt +++ b/app/src/main/java/app/nexd/android/ui/seeker/create/articles/SeekerCreateRequestEnterArticlesFragment.kt @@ -79,13 +79,14 @@ class SeekerCreateRequestEnterArticlesFragment : Fragment() { } }) + vm.navigateToConfirmAddress.observe(viewLifecycleOwner, Observer { + findNavController().navigate(SeekerCreateRequestEnterArticlesFragmentDirections.toSeekerCreateRequestConfirmAddressFragment()) + }) + vm.progress.observe(viewLifecycleOwner, Observer { when (it) { is Idle -> { - //nothing to do - } - is Loading -> { - findNavController().navigate(SeekerCreateRequestEnterArticlesFragmentDirections.toSeekerCreateRequestConfirmAddressFragment()) + // nothing to do } is Finished -> { // state not reachable diff --git a/app/src/main/res/layout/fragment_transcript_info.xml b/app/src/main/res/layout/fragment_transcript_info.xml index e9fce1b..4084895 100644 --- a/app/src/main/res/layout/fragment_transcript_info.xml +++ b/app/src/main/res/layout/fragment_transcript_info.xml @@ -192,7 +192,7 @@ android:autofillHints="postal-code" android:background="@drawable/rounded_white" android:error="@{viewModel.zipCodeError}" - android:inputType="number" + android:inputType="textPostalAddress" android:nextFocusDown="@id/editText_city_value" android:padding="10dp" android:text="@={viewModel.zipCode}"