mirror of
https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC.git
synced 2024-12-22 20:40:16 +02:00
commit
634d168378
@ -4,6 +4,7 @@ import android.os.Bundle
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
@ -36,10 +37,16 @@ class PinFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun goToNextFragment() {
|
private fun goToNextFragment() {
|
||||||
|
val enteredPin1 = binding!!.pinEditText.editText?.text.toString()
|
||||||
|
if (enteredPin1.length in 4..12) {
|
||||||
viewModel.setUserPin(
|
viewModel.setUserPin(
|
||||||
binding!!.pinEditText.text.toString()
|
binding!!.pinEditText.editText?.text.toString()
|
||||||
)
|
)
|
||||||
findNavController().navigate(R.id.action_pinFragment_to_canFragment)
|
findNavController().navigate(R.id.action_pinFragment_to_canFragment)
|
||||||
|
} else {
|
||||||
|
Toast.makeText(requireContext(), getString(R.string.length_pin), Toast.LENGTH_SHORT)
|
||||||
|
.show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun goToTheStart() {
|
private fun goToTheStart() {
|
||||||
|
@ -7,43 +7,73 @@
|
|||||||
android:padding="24dp"
|
android:padding="24dp"
|
||||||
tools:context=".PinFragment">
|
tools:context=".PinFragment">
|
||||||
|
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/card_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="20dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/pin_fragment_text"
|
android:id="@+id/pin_fragment_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/pin_fragment"
|
android:layout_margin="6dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:text="@string/pin_fragment" />
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
|
||||||
|
|
||||||
<EditText
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/pin_edit_text"
|
android:id="@+id/pin_edit_text"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="6dp"
|
||||||
android:hint="@string/enter_pin"
|
android:hint="@string/enter_pin"
|
||||||
|
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:inputType="numberPassword"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:textSize="14sp" />
|
||||||
app:layout_constraintTop_toBottomOf="@id/pin_fragment_text"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/next_button"
|
android:id="@+id/next_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/next_text"
|
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
app:layout_constraintTop_toBottomOf="@id/pin_edit_text"
|
android:text="@string/next_text"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/cancel_button"
|
android:id="@+id/cancel_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/cancel_text"
|
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
app:layout_constraintTop_toBottomOf="@id/pin_edit_text"
|
android:text="@string/cancel_text"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/next_button"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/next_button"/>
|
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,13 +1,16 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Mobile Authenticator</string>
|
<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="pin_fragment">This is pin fragment</string>
|
|
||||||
<string name="can_fragment">This is can fragment</string>
|
|
||||||
|
|
||||||
<string name="begin_text">ALUSTA</string>
|
<string name="begin_text">ALUSTA</string>
|
||||||
<string name="next_text">EDASI</string>
|
<string name="next_text">EDASI</string>
|
||||||
<string name="cancel_text">KATKESTA</string>
|
<string name="cancel_text">KATKESTA</string>
|
||||||
<string name="enter_pin">Sisesta PIN</string>
|
|
||||||
|
<!-- 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 resources for CanFragment -->
|
||||||
<string name="example_can">Näide. 123456</string>
|
<string name="example_can">Näide. 123456</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user