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,22 +32,21 @@ import dagger.hilt.android.AndroidEntryPoint
class EditTextPinInputFragment : Fragment() {
private val viewModel: EditTextPinInputViewModel by viewModels({ requireParentFragment() })
private lateinit var binding: EditTextPinInputBinding
private var binding: EditTextPinInputBinding? = null
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View =
EditTextPinInputBinding.inflate(inflater, container, false).apply {
binding = this
}.root
): View = EditTextPinInputBinding.inflate(inflater, container, false).apply {
binding = this
}.root
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// to have the text entered in the text field
val enterPinEditText: TextInputEditText = view.findViewById(R.id.enter_pin)
val startingAt: Int = 17
val startingAt = 17
enterPinEditText.doOnTextChanged { pin, _, _, _ ->
viewModel.checkPin(pin.toString()).let {
// 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() {
}
}
private fun showErrorPanel() {
binding.enterPin.error = getString(R.string.error_format_not_supported)
binding.enterPin.requestFocus()
override fun onDestroyView() {
super.onDestroyView()
binding = null
}
companion object {
private val TAG = EditTextPinInputFragment::class.simpleName!!
private fun showErrorPanel() {
binding?.enterPin?.error = getString(R.string.error_format_not_supported)
binding?.enterPin?.requestFocus()
}
}
}
\ No newline at end of file
......@@ -19,8 +19,6 @@
android:id="@+id/enter_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/password_24"
android:drawablePadding="5dp"
android:hint="@string/account_link_prompt_pin_manually"
android:imeOptions="actionNext"
android:inputType="textNoSuggestions" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment