mirror of
https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC.git
synced 2024-12-22 12:30:16 +02:00
MOB-40 home fragment logic changed
This commit is contained in:
parent
f085076631
commit
1138abcb11
@ -1,6 +1,9 @@
|
|||||||
package com.tarkvaraprojekt.mobileauthapp
|
package com.tarkvaraprojekt.mobileauthapp
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.nfc.NfcAdapter
|
||||||
|
import android.nfc.TagLostException
|
||||||
|
import android.nfc.tech.IsoDep
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@ -10,6 +13,7 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
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
|
||||||
|
import com.tarkvaraprojekt.mobileauthapp.NFC.Comms
|
||||||
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentHomeBinding
|
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentHomeBinding
|
||||||
import com.tarkvaraprojekt.mobileauthapp.model.ParametersViewModel
|
import com.tarkvaraprojekt.mobileauthapp.model.ParametersViewModel
|
||||||
import com.tarkvaraprojekt.mobileauthapp.model.SmartCardViewModel
|
import com.tarkvaraprojekt.mobileauthapp.model.SmartCardViewModel
|
||||||
@ -31,6 +35,9 @@ class HomeFragment : Fragment() {
|
|||||||
|
|
||||||
private var binding: FragmentHomeBinding? = null
|
private var binding: FragmentHomeBinding? = null
|
||||||
|
|
||||||
|
// The ID card reader mode is enabled on the home fragment when can is saved.
|
||||||
|
private var canSaved: Boolean = false
|
||||||
|
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
@ -43,9 +50,11 @@ class HomeFragment : Fragment() {
|
|||||||
return binding!!.root
|
return binding!!.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Split the contents of onViewCreated methods into smaller separate methods
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
initialChecks()
|
initialChecks()
|
||||||
|
updateAction(canSaved) // Should be called later
|
||||||
var auth = false
|
var auth = false
|
||||||
if (requireActivity().intent.data?.getQueryParameter("action") != null) {
|
if (requireActivity().intent.data?.getQueryParameter("action") != null) {
|
||||||
// Currently we only support authentication not signing.
|
// Currently we only support authentication not signing.
|
||||||
@ -53,7 +62,6 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
val mobile = requireActivity().intent.getBooleanExtra("mobile", false)
|
val mobile = requireActivity().intent.getBooleanExtra("mobile", false)
|
||||||
if (auth || mobile){
|
if (auth || mobile){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (mobile) {
|
if (mobile) {
|
||||||
// We use !! because we want an exception when something is not right.
|
// We use !! because we want an exception when something is not right.
|
||||||
@ -77,27 +85,15 @@ class HomeFragment : Fragment() {
|
|||||||
|
|
||||||
goToTheNextFragment(true, mobile)
|
goToTheNextFragment(true, mobile)
|
||||||
}
|
}
|
||||||
binding!!.beginButton.setOnClickListener { goToTheNextFragment() }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method where all the initial checks that should be done before any user input is accepted should be added.
|
|
||||||
*/
|
|
||||||
private fun initialChecks() {
|
|
||||||
viewModel.checkCan(requireContext())
|
|
||||||
viewModel.checkPin(requireContext())
|
|
||||||
displayStates()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the process of interacting with the ID card by sending user to the CAN fragment.
|
* Starts the process of interacting with the ID card by sending user to the CAN fragment.
|
||||||
|
*
|
||||||
|
* NOTE: This method should only be used for authentication flow in the future.
|
||||||
*/
|
*/
|
||||||
private fun goToTheNextFragment(auth: Boolean = false, mobile: Boolean = false) {
|
private fun goToTheNextFragment(auth: Boolean = false, mobile: Boolean = false) {
|
||||||
// Making settings menu inactive
|
|
||||||
(activity as MainActivity).menuAvailable = false
|
(activity as MainActivity).menuAvailable = false
|
||||||
// Currently saving is true because the application is not yet integrated with
|
|
||||||
// other applications or websites.
|
|
||||||
// TODO: Check the navigation action default values. Not everything has to be declared explicitly.
|
|
||||||
if (auth) {
|
if (auth) {
|
||||||
val action = HomeFragmentDirections.actionHomeFragmentToCanFragment(reading = false, auth = true, mobile = mobile)
|
val action = HomeFragmentDirections.actionHomeFragmentToCanFragment(reading = false, auth = true, mobile = mobile)
|
||||||
findNavController().navigate(action)
|
findNavController().navigate(action)
|
||||||
@ -107,16 +103,6 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays texts that inform the user whether the CAN and PIN 1 are saved on the device or not.
|
|
||||||
* This might help the user to save some time as checking menu is not necessary unless the user
|
|
||||||
* wishes to make changes to the saved CAN or PIN 1.
|
|
||||||
*/
|
|
||||||
private fun displayStates() {
|
|
||||||
canState()
|
|
||||||
pinState()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the state of the CAN, saved or not saved. Updates the text and logo.
|
* Checks the state of the CAN, saved or not saved. Updates the text and logo.
|
||||||
*/
|
*/
|
||||||
@ -124,9 +110,11 @@ class HomeFragment : Fragment() {
|
|||||||
if (viewModel.userCan.length == 6) {
|
if (viewModel.userCan.length == 6) {
|
||||||
binding!!.canStatusText.text = getString(R.string.can_status_saved)
|
binding!!.canStatusText.text = getString(R.string.can_status_saved)
|
||||||
binding!!.canStatusLogo.setImageResource(R.drawable.ic_check_logo)
|
binding!!.canStatusLogo.setImageResource(R.drawable.ic_check_logo)
|
||||||
|
canSaved = true
|
||||||
} else {
|
} else {
|
||||||
binding!!.canStatusText.text = getString(R.string.can_status_negative)
|
binding!!.canStatusText.text = getString(R.string.can_status_negative)
|
||||||
binding!!.canStatusLogo.setImageResource(R.drawable.ic_info_logo)
|
binding!!.canStatusLogo.setImageResource(R.drawable.ic_info_logo)
|
||||||
|
canSaved = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,6 +131,78 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays texts that inform the user whether the CAN and PIN 1 are saved on the device or not.
|
||||||
|
* This might help the user to save some time as checking menu is not necessary unless the user
|
||||||
|
* wishes to make changes to the saved CAN or PIN 1.
|
||||||
|
*/
|
||||||
|
private fun displayStates() {
|
||||||
|
canState()
|
||||||
|
pinState()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method where all the initial checks that should be completed before any user input is accepted should be conducted.
|
||||||
|
*/
|
||||||
|
private fun initialChecks() {
|
||||||
|
viewModel.checkCan(requireContext())
|
||||||
|
viewModel.checkPin(requireContext())
|
||||||
|
displayStates()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informs user whether the ID card can be detected or not.
|
||||||
|
*/
|
||||||
|
private fun updateAction(canIsSaved: Boolean) {
|
||||||
|
if (canIsSaved) {
|
||||||
|
binding!!.detectionActionText.text = getString(R.string.action_detect)
|
||||||
|
enableReaderMode()
|
||||||
|
} else {
|
||||||
|
binding!!.detectionActionText.text = getString(R.string.action_detect_unavailable)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: When error occurs it should be cleared within a reasonable timeframe and it should be possible to detect cards again
|
||||||
|
// TODO: Listen to system broadcasts to detect if NFC is turned on/off during when the app is working
|
||||||
|
private fun enableReaderMode() {
|
||||||
|
val adapter = NfcAdapter.getDefaultAdapter(activity)
|
||||||
|
if (adapter == null) {
|
||||||
|
binding!!.detectionActionText.text = getString(R.string.nfc_not_available)
|
||||||
|
} else {
|
||||||
|
adapter.enableReaderMode(activity, { tag ->
|
||||||
|
requireActivity().runOnUiThread {
|
||||||
|
binding!!.detectionActionText.text = getString(R.string.card_detected)
|
||||||
|
}
|
||||||
|
val card = IsoDep.get(tag)
|
||||||
|
card.timeout = 32768
|
||||||
|
card.use {
|
||||||
|
try {
|
||||||
|
val comms = Comms(it, viewModel.userCan)
|
||||||
|
val response = comms.readPersonalData(byteArrayOf(1, 2, 6, 3, 4, 8))
|
||||||
|
viewModel.setUserFirstName(response[1])
|
||||||
|
viewModel.setUserLastName(response[0])
|
||||||
|
viewModel.setUserIdentificationNumber(response[2])
|
||||||
|
viewModel.setGender(response[3])
|
||||||
|
viewModel.setCitizenship(response[4])
|
||||||
|
viewModel.setExpiration(response[5])
|
||||||
|
requireActivity().runOnUiThread {
|
||||||
|
val action = HomeFragmentDirections.actionHomeFragmentToUserFragment()
|
||||||
|
findNavController().navigate(action)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
when(e) {
|
||||||
|
is TagLostException -> requireActivity().runOnUiThread { binding!!.detectionActionText.text = getString(R.string.id_card_removed_early)}
|
||||||
|
else -> requireActivity().runOnUiThread { binding!!.detectionActionText.text = getString(R.string.nfc_reading_error) }
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
adapter.disableReaderMode(activity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, NfcAdapter.FLAG_READER_NFC_A, null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
binding = null
|
binding = null
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="24dp"
|
android:padding="@dimen/padding"
|
||||||
tools:context=".AuthFragment">
|
tools:context=".AuthFragment">
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/card_view"
|
android:id="@+id/card_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="@dimen/margin"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
@ -23,31 +23,31 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="20sp">
|
android:padding="@dimen/padding">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/auth_fragment_instruction"
|
android:id="@+id/auth_fragment_instruction"
|
||||||
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:layout_margin="@dimen/margin"
|
||||||
android:gravity="center"
|
android:gravity="left"
|
||||||
android:text="@string/auth_instruction_text"
|
android:text="@string/auth_instruction_text"
|
||||||
android:textSize="20sp" />
|
android:textSize="@dimen/regular_text" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/nfc_logo"
|
android:id="@+id/nfc_logo"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_margin="6dp"
|
android:layout_margin="@dimen/margin"
|
||||||
android:src="@drawable/nfc_logo" />
|
android:src="@drawable/nfc_logo" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/time_counter"
|
android:id="@+id/time_counter"
|
||||||
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:layout_margin="@dimen/margin"
|
||||||
android:textSize="14sp"
|
android:textSize="@dimen/helper_text"
|
||||||
app:layout_constraintTop_toBottomOf="@id/auth_fragment_instruction"
|
app:layout_constraintTop_toBottomOf="@id/auth_fragment_instruction"
|
||||||
tools:text="@string/time_left" />
|
tools:text="@string/time_left" />
|
||||||
|
|
||||||
@ -60,9 +60,9 @@
|
|||||||
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:layout_marginTop="24dp"
|
android:layout_marginTop="@dimen/margin_big"
|
||||||
android:text="@string/next_text"
|
android:text="@string/next_text"
|
||||||
android:textSize="15sp"
|
android:textSize="@dimen/regular_text"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
||||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||||
@ -71,9 +71,9 @@
|
|||||||
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:layout_marginTop="24dp"
|
android:layout_marginTop="@dimen/margin_big"
|
||||||
android:text="@string/cancel_text"
|
android:text="@string/cancel_text"
|
||||||
android:textSize="15sp"
|
android:textSize="@dimen/regular_text"
|
||||||
app:layout_constraintEnd_toStartOf="@id/next_button"
|
app:layout_constraintEnd_toStartOf="@id/next_button"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="24dp"
|
android:padding="@dimen/padding"
|
||||||
tools:context=".HomeFragment">
|
tools:context=".HomeFragment">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -20,7 +20,7 @@
|
|||||||
android:id="@+id/can_status"
|
android:id="@+id/can_status"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="12dp"
|
android:layout_margin="@dimen/margin_big"
|
||||||
app:strokeWidth="1dp"
|
app:strokeWidth="1dp"
|
||||||
app:strokeColor="@color/stroke_color"
|
app:strokeColor="@color/stroke_color"
|
||||||
app:cardElevation="0dp">
|
app:cardElevation="0dp">
|
||||||
@ -32,14 +32,14 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/can_status_logo"
|
android:id="@+id/can_status_logo"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="@dimen/margin"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/can_status_text"
|
android:id="@+id/can_status_text"
|
||||||
android:textSize="20sp"
|
android:textSize="@dimen/regular_text"
|
||||||
android:padding="12dp"
|
android:padding="@dimen/margin"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
@ -51,7 +51,7 @@
|
|||||||
android:id="@+id/pin_status"
|
android:id="@+id/pin_status"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="12dp"
|
android:layout_margin="@dimen/margin_big"
|
||||||
app:strokeWidth="1dp"
|
app:strokeWidth="1dp"
|
||||||
app:strokeColor="@color/stroke_color"
|
app:strokeColor="@color/stroke_color"
|
||||||
app:cardElevation="0dp">
|
app:cardElevation="0dp">
|
||||||
@ -63,14 +63,14 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/pin_status_logo"
|
android:id="@+id/pin_status_logo"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="@dimen/margin"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/pin_status_text"
|
android:id="@+id/pin_status_text"
|
||||||
android:textSize="20sp"
|
android:textSize="@dimen/regular_text"
|
||||||
android:padding="12dp"
|
android:padding="@dimen/margin"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
@ -80,15 +80,24 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:id="@+id/begin_button"
|
android:id="@+id/id_card_detection"
|
||||||
android:layout_width="wrap_content"
|
android:layout_margin="@dimen/margin_big"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/begin_text"
|
android:orientation="vertical"
|
||||||
android:layout_marginTop="24dp"
|
|
||||||
android:textSize="15sp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/saved_states"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/saved_states"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/detection_action_text"
|
||||||
|
android:layout_margin="@dimen/margin_big"
|
||||||
|
android:textSize="@dimen/regular_text"
|
||||||
|
android:text="@string/action_detect"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -4,14 +4,14 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="24dp"
|
android:padding="@dimen/padding"
|
||||||
tools:context=".UserFragment">
|
tools:context=".UserFragment">
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/card_view"
|
android:id="@+id/card_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="@dimen/margin"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
@ -23,86 +23,86 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="20sp">
|
android:padding="@dimen/padding_tiny">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/user_name_label"
|
android:id="@+id/user_name_label"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/user_name_label"
|
android:text="@string/user_name_label"
|
||||||
android:textSize="14sp" />
|
android:textSize="@dimen/regular_text" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/user_name"
|
android:id="@+id/user_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="@dimen/margin_small"
|
||||||
android:text="@string/user_name"
|
android:text="@string/user_name"
|
||||||
android:textSize="20sp"
|
android:textSize="@dimen/regular_text"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/identification_number_label"
|
android:id="@+id/identification_number_label"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="@dimen/margin_big"
|
||||||
android:text="@string/identification_number_label"
|
android:text="@string/identification_number_label"
|
||||||
android:textSize="14sp" />
|
android:textSize="@dimen/regular_text" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/identification_number"
|
android:id="@+id/identification_number"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="@dimen/margin_small"
|
||||||
android:textSize="20sp"
|
android:textSize="@dimen/regular_text"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/gender_label"
|
android:id="@+id/gender_label"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="@dimen/margin_big"
|
||||||
android:text="@string/gender_label"
|
android:text="@string/gender_label"
|
||||||
android:textSize="14sp" />
|
android:textSize="@dimen/regular_text" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/gender"
|
android:id="@+id/gender"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="@dimen/margin_small"
|
||||||
android:textSize="20sp"
|
android:textSize="@dimen/regular_text"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/expiration_label"
|
android:id="@+id/expiration_label"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="@dimen/margin_big"
|
||||||
android:text="@string/expiration_label"
|
android:text="@string/expiration_label"
|
||||||
android:textSize="14sp" />
|
android:textSize="@dimen/regular_text" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/expiration"
|
android:id="@+id/expiration"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="@dimen/margin_small"
|
||||||
android:textSize="20sp"
|
android:textSize="@dimen/regular_text"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/citizenship_label"
|
android:id="@+id/citizenship_label"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="@dimen/margin_big"
|
||||||
android:text="@string/citizenship_label"
|
android:text="@string/citizenship_label"
|
||||||
android:textSize="14sp" />
|
android:textSize="@dimen/regular_text" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/citizenship"
|
android:id="@+id/citizenship"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="@dimen/margin_small"
|
||||||
android:textSize="20sp"
|
android:textSize="@dimen/regular_text"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -113,9 +113,9 @@
|
|||||||
android:id="@+id/clear_button"
|
android:id="@+id/clear_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="@dimen/margin_big"
|
||||||
android:text="@string/clear_button"
|
android:text="@string/clear_button"
|
||||||
android:textSize="18sp"
|
android:textSize="@dimen/regular_text"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
android:id="@+id/action_homeFragment_to_canFragment"
|
android:id="@+id/action_homeFragment_to_canFragment"
|
||||||
app:destination="@id/canFragment"
|
app:destination="@id/canFragment"
|
||||||
app:popUpTo="@id/homeFragment" />
|
app:popUpTo="@id/homeFragment" />
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_homeFragment_to_userFragment"
|
||||||
|
app:destination="@id/userFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/pinFragment"
|
android:id="@+id/pinFragment"
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
<string name="save_can_title">Save CAN</string>
|
<string name="save_can_title">Save CAN</string>
|
||||||
|
|
||||||
<!-- string resources for AuthFragment layout -->
|
<!-- string resources for AuthFragment layout -->
|
||||||
<string name="auth_instruction_text">Put the ID card against the phone to establish connection</string>
|
<string name="auth_instruction_text">Put the ID card against the phone</string>
|
||||||
<string name="time_left">Time left %d sek</string>
|
<string name="time_left">Time left %d sek</string>
|
||||||
<string name="no_time">No time left</string>
|
<string name="no_time">No time left</string>
|
||||||
<string name="no_success">Wrong CAN</string>
|
<string name="no_success">Wrong CAN</string>
|
||||||
@ -91,4 +91,11 @@
|
|||||||
<string name="pin_save_on">On</string>
|
<string name="pin_save_on">On</string>
|
||||||
<string name="pin_save_off">Off</string>
|
<string name="pin_save_off">Off</string>
|
||||||
<string name="continue_button">CONTINUE</string>
|
<string name="continue_button">CONTINUE</string>
|
||||||
|
|
||||||
|
<!-- TEMPORARY HOME FRAGMENT STRINGS -->
|
||||||
|
<string name="action_detect">Put the ID card against the phone to detect it</string>
|
||||||
|
<string name="action_detect_unavailable">CAN must be added before ID card can be detected</string>
|
||||||
|
<string name="nfc_not_available">NFC is not turned on or is not supported by the phone</string>
|
||||||
|
<string name="nfc_reading_error">The provided CAN does not match the ID card</string>
|
||||||
|
<string name="id_card_removed_early">ID card was removed too eraly</string>
|
||||||
</resources>
|
</resources>
|
@ -40,7 +40,7 @@
|
|||||||
<string name="can_save_request">Praegu ei ole rakenduses CAN salvestatud. Kas sa soovid sisestatud CANi salvestada? Sellisel juhul sisestatakse see järgmisel korral automaatselt. Salvestatud CANi saab alati menüüs muuta ja kustutada.</string> <string name="save_can_title">Salvesta CAN</string>
|
<string name="can_save_request">Praegu ei ole rakenduses CAN salvestatud. Kas sa soovid sisestatud CANi salvestada? Sellisel juhul sisestatakse see järgmisel korral automaatselt. Salvestatud CANi saab alati menüüs muuta ja kustutada.</string> <string name="save_can_title">Salvesta CAN</string>
|
||||||
|
|
||||||
<!-- string resources for AuthFragment layout -->
|
<!-- string resources for AuthFragment layout -->
|
||||||
<string name="auth_instruction_text">ID kaardiga ühenduse loomiseks pane kaart vastu telefoni</string>
|
<string name="auth_instruction_text">Pane ID kaart vastu telefoni</string>
|
||||||
<string name="time_left">Aega on jäänud %d sek</string>
|
<string name="time_left">Aega on jäänud %d sek</string>
|
||||||
<string name="no_time">Aeg on otsas</string>
|
<string name="no_time">Aeg on otsas</string>
|
||||||
<string name="no_success">Vale CAN</string>
|
<string name="no_success">Vale CAN</string>
|
||||||
@ -89,4 +89,11 @@
|
|||||||
<string name="pin_save_on">On</string>
|
<string name="pin_save_on">On</string>
|
||||||
<string name="pin_save_off">Off</string>
|
<string name="pin_save_off">Off</string>
|
||||||
<string name="continue_button">CONTINUE</string>
|
<string name="continue_button">CONTINUE</string>
|
||||||
|
|
||||||
|
<!-- TEMPORARY HOME FRAGMENT STRINGS -->
|
||||||
|
<string name="action_detect">Put the ID card against the phone to detect it</string>
|
||||||
|
<string name="action_detect_unavailable">CAN must be added before ID card can be detected</string>
|
||||||
|
<string name="nfc_not_available">NFC is not turned on or is not supported by the phone</string>
|
||||||
|
<string name="nfc_reading_error">The provided CAN does not match the ID card</string>
|
||||||
|
<string name="id_card_removed_early">ID card was removed too eraly</string>
|
||||||
</resources>
|
</resources>
|
@ -1,7 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<dimen name="margin_small">4dp</dimen>
|
||||||
<dimen name="margin">8dp</dimen>
|
<dimen name="margin">8dp</dimen>
|
||||||
<dimen name="margin_big">16dp</dimen>
|
<dimen name="margin_big">16dp</dimen>
|
||||||
|
<dimen name="padding_tiny">8dp</dimen>
|
||||||
|
<dimen name="padding_small">16dp</dimen>
|
||||||
<dimen name="padding">24dp</dimen>
|
<dimen name="padding">24dp</dimen>
|
||||||
<dimen name="regular_text">24sp</dimen>
|
<dimen name="regular_text">24sp</dimen>
|
||||||
<dimen name="headline_text">32sp</dimen>
|
<dimen name="headline_text">32sp</dimen>
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<string name="save_can_title">Save CAN</string>
|
<string name="save_can_title">Save CAN</string>
|
||||||
|
|
||||||
<!-- string resources for AuthFragment layout -->
|
<!-- string resources for AuthFragment layout -->
|
||||||
<string name="auth_instruction_text">Put the ID card against the phone to establish connection</string>
|
<string name="auth_instruction_text">Put the ID card against the phone</string>
|
||||||
<string name="time_left">Time left %d sek</string>
|
<string name="time_left">Time left %d sek</string>
|
||||||
<string name="no_time">No time left</string>
|
<string name="no_time">No time left</string>
|
||||||
<string name="no_success">Wrong CAN</string>
|
<string name="no_success">Wrong CAN</string>
|
||||||
@ -89,4 +89,11 @@
|
|||||||
<string name="pin_save_on">On</string>
|
<string name="pin_save_on">On</string>
|
||||||
<string name="pin_save_off">Off</string>
|
<string name="pin_save_off">Off</string>
|
||||||
<string name="continue_button">CONTINUE</string>
|
<string name="continue_button">CONTINUE</string>
|
||||||
|
|
||||||
|
<!-- TEMPORARY HOME FRAGMENT STRINGS -->
|
||||||
|
<string name="action_detect">Put the ID card against the phone to detect it</string>
|
||||||
|
<string name="action_detect_unavailable">CAN must be added before ID card can be detected</string>
|
||||||
|
<string name="nfc_not_available">NFC is not turned on or is not supported by the phone</string>
|
||||||
|
<string name="nfc_reading_error">The provided CAN does not match the ID card</string>
|
||||||
|
<string name="id_card_removed_early">ID card was removed too eraly</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user