diff --git a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/PinFragment.kt b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/PinFragment.kt
index 99c9e21..ec3e69b 100644
--- a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/PinFragment.kt
+++ b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/PinFragment.kt
@@ -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() {
diff --git a/MobileAuthApp/app/src/main/res/layout/fragment_pin.xml b/MobileAuthApp/app/src/main/res/layout/fragment_pin.xml
index b8019fe..a2668b8 100644
--- a/MobileAuthApp/app/src/main/res/layout/fragment_pin.xml
+++ b/MobileAuthApp/app/src/main/res/layout/fragment_pin.xml
@@ -7,43 +7,73 @@
android:padding="24dp"
tools:context=".PinFragment">
-
-
-
+ app:layout_constraintTop_toTopOf="parent">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@id/card_view" />
+ app:layout_constraintTop_toBottomOf="@id/card_view" />
\ No newline at end of file
diff --git a/MobileAuthApp/app/src/main/res/values/strings.xml b/MobileAuthApp/app/src/main/res/values/strings.xml
index 8bd3167..b82e7fe 100644
--- a/MobileAuthApp/app/src/main/res/values/strings.xml
+++ b/MobileAuthApp/app/src/main/res/values/strings.xml
@@ -1,15 +1,18 @@
Mobile Authenticator
- This is home fragment
- This is pin fragment
- This is can fragment
+ Work in progress
ALUSTA
EDASI
KATKESTA
- Sisesta PIN
-
+
+ Palun sisesta PIN1
+ PIN1
+ Näide. 1234
+ PIN1 lubatud pikkus on 4-12
+
+
Näide. 123456
CAN
Sisesta ID kaardi CAN (Card Access Number)