mirror of
https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC.git
synced 2024-12-22 12:30:16 +02:00
MOB-12 PIN1 view layout changed + pin length check
This commit is contained in:
parent
67ad5296da
commit
c4d7da07ad
@ -4,6 +4,7 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
@ -36,10 +37,16 @@ class PinFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun goToNextFragment() {
|
||||
viewModel.setUserPin(
|
||||
binding!!.pinEditText.text.toString()
|
||||
)
|
||||
findNavController().navigate(R.id.action_pinFragment_to_canFragment)
|
||||
val enteredPin1 = binding!!.pinEditText.editText?.text.toString()
|
||||
if (enteredPin1.length in 4..12) {
|
||||
viewModel.setUserPin(
|
||||
binding!!.pinEditText.editText?.text.toString()
|
||||
)
|
||||
findNavController().navigate(R.id.action_pinFragment_to_canFragment)
|
||||
} else {
|
||||
Toast.makeText(requireContext(), getString(R.string.length_pin), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun goToTheStart() {
|
||||
|
@ -19,20 +19,38 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pin_fragment_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:text="@string/pin_fragment" />
|
||||
|
||||
<EditText
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/pin_edit_text"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:hint="@string/enter_pin"
|
||||
android:inputType="numberPassword" />
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="12"
|
||||
app:endIconMode="password_toggle"
|
||||
app:errorEnabled="true"
|
||||
app:helperText="@string/example_pin"
|
||||
app:helperTextEnabled="true"
|
||||
app:startIconDrawable="@drawable/can_logo">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberPassword"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -42,20 +60,20 @@
|
||||
android:id="@+id/next_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/next_text"
|
||||
android:layout_marginTop="24dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view"
|
||||
android:text="@string/next_text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/cancel_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/cancel_text"
|
||||
android:layout_marginTop="24dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view"
|
||||
android:text="@string/cancel_text"
|
||||
app:layout_constraintEnd_toStartOf="@id/next_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/next_button"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,6 +1,6 @@
|
||||
<resources>
|
||||
<string name="app_name">Mobile Authenticator</string>
|
||||
<string name="home_fragment">This is home fragment</string>
|
||||
<string name="home_fragment">Work in progress</string>
|
||||
|
||||
<string name="begin_text">ALUSTA</string>
|
||||
<string name="next_text">EDASI</string>
|
||||
@ -9,6 +9,8 @@
|
||||
<!-- string resources for PinFragment -->
|
||||
<string name="pin_fragment">Palun sisesta PIN1</string>
|
||||
<string name="enter_pin">PIN1</string>
|
||||
<string name="example_pin">Näide. 1234</string>
|
||||
<string name="length_pin">PIN1 lubatud pikkus on 4-12</string>
|
||||
|
||||
<!-- string resources for CanFragment -->
|
||||
<string name="example_can">Näide. 123456</string>
|
||||
|
Loading…
Reference in New Issue
Block a user