Skip to content
Snippets Groups Projects
Commit 637ae192 authored by Vitalii Nikitchyn's avatar Vitalii Nikitchyn
Browse files

PinInput fragment: minor updates

Change-Id: Ifa6fd4afadb06182b2c3b2acdfa94ddcdc2afb29
parent c6b587a1
No related branches found
No related tags found
No related merge requests found
...@@ -32,14 +32,13 @@ import dagger.hilt.android.AndroidEntryPoint ...@@ -32,14 +32,13 @@ import dagger.hilt.android.AndroidEntryPoint
class EditTextPinInputFragment : Fragment() { class EditTextPinInputFragment : Fragment() {
private val viewModel: EditTextPinInputViewModel by viewModels({ requireParentFragment() }) private val viewModel: EditTextPinInputViewModel by viewModels({ requireParentFragment() })
private lateinit var binding: EditTextPinInputBinding private var binding: EditTextPinInputBinding? = null
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
container: ViewGroup?, container: ViewGroup?,
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View = ): View = EditTextPinInputBinding.inflate(inflater, container, false).apply {
EditTextPinInputBinding.inflate(inflater, container, false).apply {
binding = this binding = this
}.root }.root
...@@ -47,7 +46,7 @@ class EditTextPinInputFragment : Fragment() { ...@@ -47,7 +46,7 @@ class EditTextPinInputFragment : Fragment() {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
// to have the text entered in the text field // to have the text entered in the text field
val enterPinEditText: TextInputEditText = view.findViewById(R.id.enter_pin) val enterPinEditText: TextInputEditText = view.findViewById(R.id.enter_pin)
val startingAt: Int = 17 val startingAt = 17
enterPinEditText.doOnTextChanged { pin, _, _, _ -> enterPinEditText.doOnTextChanged { pin, _, _, _ ->
viewModel.checkPin(pin.toString()).let { viewModel.checkPin(pin.toString()).let {
// if the pin is not valid and it is at length 17 (format of the pin) there is an // if the pin is not valid and it is at length 17 (format of the pin) there is an
...@@ -59,12 +58,14 @@ class EditTextPinInputFragment : Fragment() { ...@@ -59,12 +58,14 @@ class EditTextPinInputFragment : Fragment() {
} }
} }
private fun showErrorPanel() { override fun onDestroyView() {
binding.enterPin.error = getString(R.string.error_format_not_supported) super.onDestroyView()
binding.enterPin.requestFocus() binding = null
} }
companion object { private fun showErrorPanel() {
private val TAG = EditTextPinInputFragment::class.simpleName!! binding?.enterPin?.error = getString(R.string.error_format_not_supported)
binding?.enterPin?.requestFocus()
} }
} }
\ No newline at end of file
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
android:id="@+id/enter_pin" android:id="@+id/enter_pin"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableStart="@drawable/password_24"
android:drawablePadding="5dp"
android:hint="@string/account_link_prompt_pin_manually" android:hint="@string/account_link_prompt_pin_manually"
android:imeOptions="actionNext" android:imeOptions="actionNext"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment