mirror of
https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC.git
synced 2024-11-16 10:50:59 +02:00
Merge pull request #14 from TanelOrumaa/iter4UI
UI/UX improvements for iteration 4
This commit is contained in:
commit
63bc89b0e4
@ -68,8 +68,4 @@ dependencies {
|
||||
'io.jsonwebtoken:jjwt-gson:0.11.2'
|
||||
|
||||
implementation 'com.koushikdutta.ion:ion:3.1.0'
|
||||
|
||||
// Retrofit + Moshi Converter
|
||||
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
|
||||
implementation 'com.squareup.moshi:moshi-kotlin:1.9.3'
|
||||
}
|
@ -4,6 +4,7 @@ import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.nfc.NfcAdapter
|
||||
import android.nfc.TagLostException
|
||||
import android.nfc.tech.IsoDep
|
||||
import android.os.Bundle
|
||||
import android.os.CountDownTimer
|
||||
@ -33,7 +34,7 @@ class AuthFragment : Fragment() {
|
||||
|
||||
private val viewModel: SmartCardViewModel by activityViewModels()
|
||||
|
||||
private val intentParameters: ParametersViewModel by activityViewModels()
|
||||
private val paramsModel: ParametersViewModel by activityViewModels()
|
||||
|
||||
private var binding: FragmentAuthBinding? = null
|
||||
|
||||
@ -66,15 +67,37 @@ class AuthFragment : Fragment() {
|
||||
|
||||
override fun onFinish() {
|
||||
Thread.sleep(750)
|
||||
goToTheStart()
|
||||
cancelAuth()
|
||||
}
|
||||
}.start()
|
||||
//binding!!.nextButton.visibility = View.INVISIBLE
|
||||
// The button exists in code for testing reasons, but not visible to the user anymore unless visibility is changed in the code.
|
||||
binding!!.nextButton.visibility = View.GONE
|
||||
binding!!.nextButton.setOnClickListener { goToNextFragment() }
|
||||
binding!!.cancelButton.setOnClickListener { goToTheStart() }
|
||||
binding!!.cancelButton.setOnClickListener { cancelAuth() }
|
||||
val adapter = NfcAdapter.getDefaultAdapter(activity)
|
||||
if (adapter != null)
|
||||
getInfoFromIdCard(adapter)
|
||||
else { // If NFC adapter can not be detected then end the auth process as it is not possible to read an ID card
|
||||
cancelAuth() // It would be a good idea to show user some notification as it might be confusing if the app suddenly closes
|
||||
}
|
||||
}
|
||||
|
||||
private fun goToNextFragment() {
|
||||
timer.cancel()
|
||||
val action = AuthFragmentDirections.actionAuthFragmentToResultFragment(mobile = args.mobile)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
|
||||
private fun cancelAuth() {
|
||||
viewModel.clearUserInfo()
|
||||
timer.cancel()
|
||||
if (args.mobile) {
|
||||
val resultIntent = Intent()
|
||||
requireActivity().setResult(AppCompatActivity.RESULT_CANCELED, resultIntent)
|
||||
requireActivity().finish()
|
||||
} else {
|
||||
requireActivity().finishAndRemoveTask()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getInfoFromIdCard(adapter: NfcAdapter) {
|
||||
@ -88,34 +111,35 @@ class AuthFragment : Fragment() {
|
||||
card.use {
|
||||
try {
|
||||
val comms = Comms(it, viewModel.userCan)
|
||||
if (args.auth) {
|
||||
val jws = Authenticator(comms).authenticate(
|
||||
intentParameters.challenge,
|
||||
intentParameters.origin,
|
||||
viewModel.userPin
|
||||
)
|
||||
intentParameters.setToken(jws)
|
||||
} else {
|
||||
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])
|
||||
}
|
||||
val jws = Authenticator(comms).authenticate(
|
||||
paramsModel.challenge,
|
||||
paramsModel.origin,
|
||||
viewModel.userPin
|
||||
)
|
||||
paramsModel.setToken(jws)
|
||||
requireActivity().runOnUiThread {
|
||||
binding!!.timeCounter.text = getString(R.string.data_read)
|
||||
goToNextFragment()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
requireActivity().runOnUiThread {
|
||||
binding!!.timeCounter.text = getString(R.string.no_success)
|
||||
when(e) {
|
||||
is TagLostException -> requireActivity().runOnUiThread { binding!!.timeCounter.text = getString(R.string.id_card_removed_early) }
|
||||
else -> {
|
||||
when ("invalid pin") {
|
||||
in e.message.toString().lowercase() -> requireActivity().runOnUiThread {
|
||||
val messagePieces = e.message.toString().split(" ")
|
||||
binding!!.timeCounter.text = getString(R.string.wrong_pin, messagePieces[messagePieces.size - 1])
|
||||
viewModel.deletePin(requireContext())
|
||||
}
|
||||
else -> requireActivity().runOnUiThread {
|
||||
binding!!.timeCounter.text = getString(R.string.wrong_can_text)
|
||||
viewModel.deleteCan(requireContext())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// If the CAN is wrong we will also delete the saved CAN so that the user won't use it again.
|
||||
viewModel.deleteCan(requireContext())
|
||||
// Gives user some time to read the error message
|
||||
Thread.sleep(1000)
|
||||
goToTheStart()
|
||||
// Give user some time to read the error message
|
||||
Thread.sleep(2000)
|
||||
cancelAuth()
|
||||
} finally {
|
||||
adapter.disableReaderMode(activity)
|
||||
}
|
||||
@ -123,33 +147,6 @@ class AuthFragment : Fragment() {
|
||||
}, NfcAdapter.FLAG_READER_NFC_A, null)
|
||||
}
|
||||
|
||||
private fun goToNextFragment() {
|
||||
timer.cancel()
|
||||
if (args.auth) {
|
||||
val action = AuthFragmentDirections.actionAuthFragmentToResultFragment(mobile = args.mobile)
|
||||
findNavController().navigate(action)
|
||||
} else {
|
||||
findNavController().navigate(R.id.action_authFragment_to_userFragment)
|
||||
}
|
||||
}
|
||||
|
||||
private fun goToTheStart() {
|
||||
viewModel.clearUserInfo()
|
||||
timer.cancel()
|
||||
if (args.reading) {
|
||||
findNavController().navigate(R.id.action_authFragment_to_homeFragment)
|
||||
} else {
|
||||
if (!args.mobile) {
|
||||
//Currently for some reason the activity is not killed entirely. Must be looked into further.
|
||||
requireActivity().finishAndRemoveTask()
|
||||
} else {
|
||||
val resultIntent = Intent()
|
||||
requireActivity().setResult(AppCompatActivity.RESULT_CANCELED, resultIntent)
|
||||
requireActivity().finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
binding = null
|
||||
|
@ -3,17 +3,22 @@ package com.tarkvaraprojekt.mobileauthapp
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentCanBinding
|
||||
import com.tarkvaraprojekt.mobileauthapp.model.SmartCardViewModel
|
||||
import org.w3c.dom.Text
|
||||
|
||||
/**
|
||||
* Fragment that deals with asking the user for a six digit CAN. If the CAN is already saved
|
||||
@ -28,8 +33,6 @@ class CanFragment : Fragment() {
|
||||
|
||||
// Navigation arguments:
|
||||
// saving = true means that we are navigating here from the settings menu and must return to the settings menu.
|
||||
// reading = true means that we are only reading the information from the ID card that does not need PIN 1,
|
||||
// this information is passed on to the next PinFragment.
|
||||
private val args: CanFragmentArgs by navArgs()
|
||||
|
||||
override fun onCreateView(
|
||||
@ -44,13 +47,10 @@ class CanFragment : Fragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
checkIfSkip()
|
||||
// If the user arrives from the settings menu then the button should say
|
||||
// save instead of continue.
|
||||
if (args.saving) {
|
||||
binding!!.nextButton.text = getString(R.string.save_text)
|
||||
binding!!.canTextField.editText?.addTextChangedListener {
|
||||
checkEnteredCan()
|
||||
}
|
||||
binding!!.nextButton.setOnClickListener { checkEnteredCan() }
|
||||
binding!!.cancelButton.setOnClickListener { goToTheStart() }
|
||||
binding!!.buttonCancel.setOnClickListener { goToTheStart() }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,66 +67,22 @@ class CanFragment : Fragment() {
|
||||
* Takes user to the next fragment, which is PinFragment.
|
||||
*/
|
||||
private fun goToTheNextFragment() {
|
||||
val action = CanFragmentDirections.actionCanFragmentToPinFragment(reading = args.reading, auth = args.auth, mobile = args.mobile)
|
||||
val action = CanFragmentDirections.actionCanFragmentToPinFragment(auth = args.auth, mobile = args.mobile)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the user has entered a 6 digit can to the input field.
|
||||
* If yes then the user is allowed to continue otherwise the user is
|
||||
* allowed to modify the entered can.
|
||||
*/
|
||||
private fun checkEnteredCan() {
|
||||
val enteredCan = binding!!.canEditText.editText?.text.toString()
|
||||
if (enteredCan.length == 6) {
|
||||
viewModel.setUserCan(enteredCan)
|
||||
if (args.saving) {
|
||||
viewModel.storeCan(requireContext())
|
||||
goToTheStart()
|
||||
} else {
|
||||
val storeCanQuestion = getDialog()
|
||||
storeCanQuestion?.show()
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(requireContext(), getString(R.string.length_can), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a dialog that asks the user whether the entered CAN should be saved
|
||||
* on the device or not.
|
||||
*/
|
||||
private fun getDialog(): AlertDialog? {
|
||||
return activity?.let { frag ->
|
||||
val builder = AlertDialog.Builder(frag)
|
||||
builder.apply {
|
||||
// If response is positive then save the CAN on the device.
|
||||
setPositiveButton(R.string.save_text) { _, _ ->
|
||||
viewModel.storeCan(
|
||||
requireContext()
|
||||
)
|
||||
goToTheNextFragment()
|
||||
}
|
||||
setNegativeButton(R.string.deny_text) { _, _ ->
|
||||
goToTheNextFragment()
|
||||
}
|
||||
}
|
||||
builder.setMessage(R.string.can_save_request)
|
||||
builder.setTitle(R.string.save_can_title)
|
||||
builder.create()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigates the user back to the start depending on where the user arrived.
|
||||
* If the user arrived from the settings menu then the start is the settings menu
|
||||
* not the HomeFragment.
|
||||
*/
|
||||
private fun goToTheStart() {
|
||||
// TODO: Needs special handling when the app is launched with intent. Temporary solution at the moment.
|
||||
if (args.saving) {
|
||||
findNavController().navigate(R.id.action_canFragment_to_settingsFragment)
|
||||
if (args.fromhome) {
|
||||
findNavController().navigate(R.id.action_canFragment_to_homeFragment)
|
||||
} else {
|
||||
findNavController().navigate(R.id.action_canFragment_to_settingsFragment)
|
||||
}
|
||||
} else if (args.auth || args.mobile) {
|
||||
if (args.mobile) {
|
||||
val resultIntent = Intent()
|
||||
@ -140,6 +96,35 @@ class CanFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that creates and shows a snackbar that tells the user that CAN has been saved
|
||||
*/
|
||||
private fun showSnackbar() {
|
||||
val snackbar = Snackbar.make(requireView(), R.string.can_status_saved, Snackbar.LENGTH_SHORT)
|
||||
val snackbarText: TextView = snackbar.view.findViewById(R.id.snackbar_text)
|
||||
snackbarText.setTextSize(TypedValue.COMPLEX_UNIT_SP, resources.getDimension(R.dimen.small_text))
|
||||
snackbar.show()
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the user has entered a 6 digit can to the input field.
|
||||
* If yes then the user is allowed to continue otherwise the user is
|
||||
* allowed to modify the entered can.
|
||||
*/
|
||||
private fun checkEnteredCan() {
|
||||
val enteredCan = binding!!.canTextField.editText?.text.toString()
|
||||
if (enteredCan.length == 6) {
|
||||
viewModel.setUserCan(enteredCan)
|
||||
viewModel.storeCan(requireContext()) //Maybe storeCan should always automatically call setUserCan method as well because these methods usually are used together
|
||||
showSnackbar()
|
||||
if (args.saving) {
|
||||
goToTheStart()
|
||||
} else {
|
||||
goToTheNextFragment()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
binding = null
|
||||
|
@ -1,20 +1,30 @@
|
||||
package com.tarkvaraprojekt.mobileauthapp
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.net.ConnectivityManager
|
||||
import android.nfc.NfcAdapter
|
||||
import android.nfc.TagLostException
|
||||
import android.nfc.tech.IsoDep
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.tarkvaraprojekt.mobileauthapp.NFC.Comms
|
||||
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentHomeBinding
|
||||
import com.tarkvaraprojekt.mobileauthapp.model.ParametersViewModel
|
||||
import com.tarkvaraprojekt.mobileauthapp.model.SmartCardViewModel
|
||||
import java.lang.Exception
|
||||
import java.net.URLDecoder
|
||||
|
||||
/**
|
||||
* HomeFragment is only shown to the user when then the user launches the application. When the application
|
||||
@ -31,6 +41,13 @@ class HomeFragment : Fragment() {
|
||||
|
||||
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
|
||||
|
||||
// Is the app used for authentication
|
||||
private var auth: Boolean = false
|
||||
|
||||
private var receiver: BroadcastReceiver? = null
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
@ -46,73 +63,63 @@ class HomeFragment : Fragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
initialChecks()
|
||||
var auth = false
|
||||
if (requireActivity().intent.data?.getQueryParameter("action") != null) {
|
||||
// Currently we only support authentication not signing.
|
||||
auth = true
|
||||
}
|
||||
val mobile = requireActivity().intent.getBooleanExtra("mobile", false)
|
||||
if (auth || mobile){
|
||||
try {
|
||||
if (mobile) {
|
||||
// We use !! because we want an exception when something is not right.
|
||||
intentParams.setChallenge(requireActivity().intent.getStringExtra("challenge")!!)
|
||||
intentParams.setAuthUrl(requireActivity().intent.getStringExtra("authUrl")!!)
|
||||
intentParams.setOrigin(requireActivity().intent.getStringExtra("originUrl")!!)
|
||||
} else { //Website
|
||||
var challenge = requireActivity().intent.data!!.getQueryParameter("challenge")!!
|
||||
// TODO: Since due to encoding plus gets converted to space, temporary solution is to replace it back.
|
||||
challenge = challenge.replace(" ", "+")
|
||||
intentParams.setChallenge(challenge)
|
||||
intentParams.setAuthUrl(requireActivity().intent.data!!.getQueryParameter("authUrl")!!)
|
||||
intentParams.setOrigin(requireActivity().intent.data!!.getQueryParameter("originUrl")!!)
|
||||
if (auth || mobile) {
|
||||
startAuthentication(mobile)
|
||||
} else {
|
||||
receiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(p0: Context?, p1: Intent?) {
|
||||
updateAction(canSaved)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// There was a problem with parameters, which means that authentication is not possible.
|
||||
val resultIntent = Intent()
|
||||
requireActivity().setResult(AppCompatActivity.RESULT_CANCELED, resultIntent)
|
||||
requireActivity().finish()
|
||||
}
|
||||
goToTheNextFragment(true, mobile)
|
||||
val filter = IntentFilter(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED)
|
||||
requireActivity().registerReceiver(receiver, filter)
|
||||
updateAction(canSaved)
|
||||
}
|
||||
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.
|
||||
*/
|
||||
private fun goToTheNextFragment(auth: Boolean = false, mobile: Boolean = false) {
|
||||
// Making settings menu inactive
|
||||
private fun goToTheNextFragment(mobile: Boolean = 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) {
|
||||
val action = HomeFragmentDirections.actionHomeFragmentToCanFragment(reading = false, auth = true, mobile = mobile)
|
||||
findNavController().navigate(action)
|
||||
} else {
|
||||
val action = HomeFragmentDirections.actionHomeFragmentToCanFragment(reading = true, auth = false, mobile = mobile)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
val action = HomeFragmentDirections.actionHomeFragmentToCanFragment(auth = true, mobile = mobile)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Method that starts the authentication use case.
|
||||
*
|
||||
* NOTE: Comment out try-catch block when testing without backend
|
||||
*/
|
||||
private fun displayStates() {
|
||||
canState()
|
||||
pinState()
|
||||
private fun startAuthentication(mobile: Boolean) {
|
||||
try {
|
||||
if (mobile) {
|
||||
// We use !! to get extras because we want an exception to be thrown when something is missing.
|
||||
intentParams.setChallenge(requireActivity().intent.getStringExtra("challenge")!!)
|
||||
intentParams.setAuthUrl(requireActivity().intent.getStringExtra("authUrl")!!)
|
||||
intentParams.setOrigin(requireActivity().intent.getStringExtra("originUrl")!!)
|
||||
} else { //Website
|
||||
var challenge = requireActivity().intent.data!!.getQueryParameter("challenge")!!
|
||||
// TODO: Since due to encoding plus gets converted to space, temporary solution is to replace it back.
|
||||
challenge = challenge.replace(" ", "+")
|
||||
intentParams.setChallenge(challenge)
|
||||
intentParams.setAuthUrl(requireActivity().intent.data!!.getQueryParameter("authUrl")!!)
|
||||
intentParams.setOrigin(requireActivity().intent.data!!.getQueryParameter("originUrl")!!)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// There was a problem with parameters, which means that authentication is not possible.
|
||||
// In that case we will cancel the authentication immediately as it would be waste of the user's time to carry on
|
||||
// before getting an inevitable error.
|
||||
val resultIntent = Intent()
|
||||
requireActivity().setResult(AppCompatActivity.RESULT_CANCELED, resultIntent)
|
||||
requireActivity().finish()
|
||||
}
|
||||
goToTheNextFragment(mobile)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,9 +129,11 @@ class HomeFragment : Fragment() {
|
||||
if (viewModel.userCan.length == 6) {
|
||||
binding!!.canStatusText.text = getString(R.string.can_status_saved)
|
||||
binding!!.canStatusLogo.setImageResource(R.drawable.ic_check_logo)
|
||||
canSaved = true
|
||||
} else {
|
||||
binding!!.canStatusText.text = getString(R.string.can_status_negative)
|
||||
binding!!.canStatusLogo.setImageResource(R.drawable.ic_info_logo)
|
||||
canSaved = false
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,8 +150,126 @@ 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()
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a help message to the user explaining what the CAN is
|
||||
*/
|
||||
private fun displayMessage() {
|
||||
val dialog = MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(getString(R.string.can_question))
|
||||
.setMessage(getString(R.string.can_explanation))
|
||||
.setPositiveButton(R.string.return_text){_, _ -> }
|
||||
.show()
|
||||
val title = dialog.findViewById<TextView>(R.id.alertTitle)
|
||||
title?.textSize = 24F
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()
|
||||
binding!!.homeActionButton.visibility = View.GONE
|
||||
binding!!.homeHelpButton.visibility = View.GONE
|
||||
} else {
|
||||
binding!!.detectionActionText.text = getString(R.string.action_detect_unavailable)
|
||||
binding!!.homeActionButton.text = getString(R.string.add_can_text)
|
||||
binding!!.homeActionButton.setOnClickListener {
|
||||
val action = HomeFragmentDirections.actionHomeFragmentToCanFragment(saving = true, fromhome = true)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
binding!!.homeHelpButton.setOnClickListener {
|
||||
displayMessage()
|
||||
}
|
||||
binding!!.homeActionButton.visibility = View.VISIBLE
|
||||
binding!!.homeHelpButton.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the error message and allows the user to try again
|
||||
*/
|
||||
private fun reset() {
|
||||
binding!!.homeActionButton.text = getString(R.string.try_again_text)
|
||||
binding!!.homeActionButton.setOnClickListener {
|
||||
updateAction(canSaved)
|
||||
}
|
||||
binding!!.homeActionButton.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that enables the NFC reader mode, which allows the app to communicate with the ID card and retrieve information.
|
||||
*/
|
||||
private fun enableReaderMode() {
|
||||
val adapter = NfcAdapter.getDefaultAdapter(activity)
|
||||
if (adapter == null || !adapter.isEnabled) {
|
||||
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)
|
||||
reset()
|
||||
}
|
||||
else -> requireActivity().runOnUiThread {
|
||||
binding!!.detectionActionText.text = getString(R.string.nfc_reading_error)
|
||||
viewModel.deleteCan(requireContext())
|
||||
canState()
|
||||
reset()
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
adapter.disableReaderMode(activity)
|
||||
}
|
||||
}
|
||||
}, NfcAdapter.FLAG_READER_NFC_A, null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
requireActivity().unregisterReceiver(receiver)
|
||||
binding = null
|
||||
}
|
||||
}
|
@ -20,6 +20,8 @@ class MainActivity : AppCompatActivity() {
|
||||
// If true the settings menu can be accessed from the toolbar in the upper part of the screen.
|
||||
var menuAvailable: Boolean = true
|
||||
|
||||
var inMenu: Boolean = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
@ -40,9 +42,13 @@ class MainActivity : AppCompatActivity() {
|
||||
R.id.menu_settings_option -> {
|
||||
if (menuAvailable) {
|
||||
navigationController.navigate(R.id.action_homeFragment_to_settingsFragment)
|
||||
menuAvailable = false
|
||||
inMenu = true
|
||||
true
|
||||
} else {
|
||||
Toast.makeText(this, getString(R.string.unavailable), Toast.LENGTH_SHORT).show()
|
||||
if (!inMenu) {
|
||||
Toast.makeText(this, getString(R.string.menu_unavailable_message), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,22 @@
|
||||
package com.tarkvaraprojekt.mobileauthapp
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentPinBinding
|
||||
import com.tarkvaraprojekt.mobileauthapp.model.SmartCardViewModel
|
||||
|
||||
@ -28,10 +33,10 @@ class PinFragment : Fragment() {
|
||||
|
||||
// Navigation arguments:
|
||||
// saving = true means that the user must be returned to the settings menu
|
||||
// reading = true means that we are reading information from the ID card that does
|
||||
// not require PIN 1 so it is not necessary to ask it.
|
||||
private val args: PinFragmentArgs by navArgs()
|
||||
|
||||
private var saveToggle = true
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
@ -44,90 +49,47 @@ class PinFragment : Fragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
checkIfSkip()
|
||||
// If the user arrives from the settings menu then the button says
|
||||
// save instead of continue.
|
||||
// Switch should be not visible when user is in savings mode
|
||||
if (args.saving) {
|
||||
binding!!.nextButton.text = getString(R.string.save_text)
|
||||
}
|
||||
binding!!.nextButton.setOnClickListener { checkEnteredPin() }
|
||||
binding!!.cancelButton.setOnClickListener { goToTheStart() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current fragment can be skipped or not.
|
||||
* If the user has PIN 1 saved on the device or PIN 1 is not required
|
||||
* then the PIN 1 won't be asked.
|
||||
*/
|
||||
private fun checkIfSkip() {
|
||||
if (args.reading) {
|
||||
goToTheNextFragment()
|
||||
} else if (viewModel.userPin.length in 4..12) {
|
||||
goToTheNextFragment()
|
||||
binding!!.savePinQuestion.visibility = View.GONE
|
||||
binding!!.saveLayout.visibility = View.GONE
|
||||
} else {
|
||||
saveToggle =
|
||||
activity?.getPreferences(Context.MODE_PRIVATE)?.getBoolean("saveToggle", true) == true //Android Studio recommendation to get rid of Boolean?.
|
||||
Log.i("myLogging", activity?.getPreferences(Context.MODE_PRIVATE)?.getBoolean("saveToggle", true).toString())
|
||||
if (!saveToggle) {
|
||||
binding!!.saveSwitch.isChecked = false
|
||||
}
|
||||
binding!!.saveSwitch.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
binding!!.saveStatus.text = getString(R.string.pin_save_on)
|
||||
activity?.getPreferences(Context.MODE_PRIVATE)?.edit()?.putBoolean("saveToggle", true)?.apply()
|
||||
} else {
|
||||
binding!!.saveStatus.text = getString(R.string.pin_save_off)
|
||||
activity?.getPreferences(Context.MODE_PRIVATE)?.edit()?.putBoolean("saveToggle", false)?.apply()
|
||||
}
|
||||
saveToggle = !saveToggle
|
||||
}
|
||||
}
|
||||
binding!!.buttonContinue.setOnClickListener { checkEnteredPin() }
|
||||
binding!!.buttonCancel.setOnClickListener { goToTheStart() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes user to the next fragment, which is AuthFragment.
|
||||
*/
|
||||
private fun goToTheNextFragment() {
|
||||
val action = PinFragmentDirections.actionPinFragmentToAuthFragment(reading = args.reading, auth = args.auth, mobile = args.mobile)
|
||||
val action = PinFragmentDirections.actionPinFragmentToAuthFragment(auth = args.auth, mobile = args.mobile)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the user has entered a PIN 1 with length between [4, 12] in the
|
||||
* input field. If yes then the user is allowed to continue otherwise the user is
|
||||
* allowed to modify the entered PIN 1.
|
||||
*/
|
||||
private fun checkEnteredPin() {
|
||||
val enteredPin = binding!!.pinEditText.editText?.text.toString()
|
||||
if (enteredPin.length in 4..12) {
|
||||
viewModel.setUserPin(enteredPin)
|
||||
if (args.saving) {
|
||||
viewModel.storePin(requireContext())
|
||||
goToTheStart()
|
||||
} else {
|
||||
val storePinQuestion = getDialog()
|
||||
storePinQuestion?.show()
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(requireContext(), getString(R.string.length_pin), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a dialog that asks the user whether the entered PIN 1 should be saved
|
||||
* on the device or not.
|
||||
*/
|
||||
private fun getDialog(): AlertDialog? {
|
||||
return activity?.let { frag ->
|
||||
val builder = AlertDialog.Builder(frag)
|
||||
builder.apply {
|
||||
// If response is positive save the PIN 1 on the device.
|
||||
setPositiveButton(R.string.save_text) { _, _ ->
|
||||
viewModel.storePin(
|
||||
requireContext()
|
||||
)
|
||||
goToTheNextFragment()
|
||||
}
|
||||
setNegativeButton(R.string.deny_text) { _, _ ->
|
||||
goToTheNextFragment()
|
||||
}
|
||||
}
|
||||
builder.setMessage(R.string.pin_save_request)
|
||||
builder.setTitle(R.string.save_pin_title)
|
||||
builder.create()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns user to the start. If the user arrived from the settings menu then the start is
|
||||
* settings menu not the HomeFragment.
|
||||
*/
|
||||
private fun goToTheStart() {
|
||||
if (args.saving) {
|
||||
findNavController().navigate(R.id.action_canFragment_to_settingsFragment)
|
||||
findNavController().navigate(R.id.action_pinFragment_to_settingsFragment)
|
||||
} else if (args.auth || args.mobile) {
|
||||
if (args.mobile) {
|
||||
val resultIntent = Intent()
|
||||
@ -141,6 +103,53 @@ class PinFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current fragment can be skipped or not.
|
||||
* If the user has PIN 1 saved on the device or PIN 1 is not required
|
||||
* then the PIN 1 won't be asked.
|
||||
*/
|
||||
private fun checkIfSkip() {
|
||||
if (viewModel.userPin.length in 4..12) {
|
||||
goToTheNextFragment()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that creates and shows a snackbar that tells the user that PIN 1 has been saved
|
||||
*/
|
||||
private fun showSnackbar() {
|
||||
val snackbar = Snackbar.make(requireView(), R.string.pin_status_saved, Snackbar.LENGTH_SHORT)
|
||||
val snackbarText: TextView = snackbar.view.findViewById(R.id.snackbar_text)
|
||||
snackbarText.setTextSize(TypedValue.COMPLEX_UNIT_SP, resources.getDimension(R.dimen.small_text))
|
||||
snackbar.show()
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the user has entered a PIN 1 with length between [4, 12] in the
|
||||
* input field. If yes then the user is allowed to continue otherwise the user is
|
||||
* allowed to modify the entered PIN 1.
|
||||
*/
|
||||
private fun checkEnteredPin() {
|
||||
val enteredPin = binding!!.pinTextField.editText?.text.toString()
|
||||
if (enteredPin.length in 4..12) {
|
||||
viewModel.setUserPin(enteredPin)
|
||||
if (args.saving) {
|
||||
viewModel.storePin(requireContext())
|
||||
showSnackbar()
|
||||
goToTheStart()
|
||||
} else {
|
||||
if (saveToggle) {
|
||||
viewModel.storePin(requireContext())
|
||||
showSnackbar()
|
||||
}
|
||||
goToTheNextFragment()
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(requireContext(), getString(R.string.pin_helper_text), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
binding = null
|
||||
|
@ -39,10 +39,21 @@ class ResultFragment : Fragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
binding!!.resultBackButton.visibility = View.GONE
|
||||
postToken()
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used when the MobileAuthApp was launched by an app. Not for website use.
|
||||
*/
|
||||
private fun createResponse(success: Boolean = true, result: String = "noResult", token: String = "noToken") {
|
||||
val responseCode = if (success) AppCompatActivity.RESULT_OK else AppCompatActivity.RESULT_CANCELED
|
||||
val resultIntent = Intent()
|
||||
resultIntent.putExtra("result", result)
|
||||
resultIntent.putExtra("token", token)
|
||||
requireActivity().setResult(responseCode, resultIntent)
|
||||
requireActivity().finish()
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a POST request to the backend server with a tokenItem
|
||||
*/
|
||||
@ -57,17 +68,13 @@ class ResultFragment : Fragment() {
|
||||
.setJsonObjectBody(json)
|
||||
.asJsonObject()
|
||||
.setCallback { e, result ->
|
||||
// do stuff with the result or error
|
||||
if (result == null) {
|
||||
// TODO: Set auth message failed and close the app
|
||||
Log.i("Log thingy fail", "result was null")
|
||||
if (args.mobile) {
|
||||
createResponse(false)
|
||||
} else {
|
||||
requireActivity().finishAndRemoveTask()
|
||||
}
|
||||
} else {
|
||||
Log.i("POST request response", result.toString())
|
||||
if (args.mobile) {
|
||||
createResponse(true, result.toString(), paramsModel.token)
|
||||
} else {
|
||||
@ -77,18 +84,6 @@ class ResultFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used when the MobileAuthApp was launched by an app. Not for website use.
|
||||
*/
|
||||
private fun createResponse(success: Boolean = true, result: String = "noResult", token: String = "noToken") {
|
||||
val responseCode = if (success) AppCompatActivity.RESULT_OK else AppCompatActivity.RESULT_CANCELED
|
||||
val resultIntent = Intent()
|
||||
resultIntent.putExtra("result", result)
|
||||
resultIntent.putExtra("token", token)
|
||||
requireActivity().setResult(responseCode, resultIntent)
|
||||
requireActivity().finish()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
binding = null
|
||||
|
@ -1,13 +1,17 @@
|
||||
package com.tarkvaraprojekt.mobileauthapp.menu
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.tarkvaraprojekt.mobileauthapp.MainActivity
|
||||
import com.tarkvaraprojekt.mobileauthapp.R
|
||||
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentSettingsBinding
|
||||
import com.tarkvaraprojekt.mobileauthapp.model.SmartCardViewModel
|
||||
@ -45,6 +49,16 @@ class SettingsFragment : Fragment() {
|
||||
binding!!.returnButton.setOnClickListener { backToHome() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for showing a snackbar with a message that is given as a parameter
|
||||
*/
|
||||
private fun showSnackbar(message: String) {
|
||||
val snackbar = Snackbar.make(requireView(), message, Snackbar.LENGTH_SHORT)
|
||||
val snackbarText: TextView = snackbar.view.findViewById(R.id.snackbar_text)
|
||||
snackbarText.setTextSize(TypedValue.COMPLEX_UNIT_SP, resources.getDimension(R.dimen.small_text))
|
||||
snackbar.show()
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for showing the CAN field to the user and can be used to refresh the field as well.
|
||||
*/
|
||||
@ -54,7 +68,7 @@ class SettingsFragment : Fragment() {
|
||||
binding!!.canMenuAction.text = getString(R.string.can_delete)
|
||||
} else {
|
||||
binding!!.canSaved.text = getString(R.string.saved_can, getString(R.string.missing))
|
||||
binding!!.canMenuAction.text = getString(R.string.can_add)
|
||||
binding!!.canMenuAction.text = getString(R.string.add_can_text)
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +80,9 @@ class SettingsFragment : Fragment() {
|
||||
if (viewModel.userCan.length == 6) {
|
||||
viewModel.deleteCan(requireContext())
|
||||
showCanField()
|
||||
showSnackbar(getString(R.string.can_deleted))
|
||||
} else {
|
||||
(activity as MainActivity).inMenu = false
|
||||
val action = SettingsFragmentDirections.actionSettingsFragmentToCanFragment(saving = true)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
@ -100,7 +116,9 @@ class SettingsFragment : Fragment() {
|
||||
if (viewModel.userPin.length in 4..12) {
|
||||
viewModel.deletePin(requireContext())
|
||||
showPinField()
|
||||
showSnackbar(getString(R.string.pin_deleted))
|
||||
} else {
|
||||
(activity as MainActivity).inMenu = false
|
||||
val action = SettingsFragmentDirections.actionSettingsFragmentToPinFragment(saving = true)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
@ -130,6 +148,7 @@ class SettingsFragment : Fragment() {
|
||||
* Navigates back to home fragment.
|
||||
*/
|
||||
private fun backToHome() {
|
||||
(activity as MainActivity).inMenu = false
|
||||
findNavController().navigate(R.id.action_settingsFragment_to_homeFragment)
|
||||
}
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
package com.tarkvaraprojekt.mobileauthapp.network
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import retrofit2.Response
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.moshi.MoshiConverterFactory
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Headers
|
||||
import retrofit2.http.POST
|
||||
|
||||
/**
|
||||
* Class for making HTTP requests
|
||||
* Based on https://developer.android.com/courses/pathways/android-basics-kotlin-unit-4-pathway-2
|
||||
*/
|
||||
const val BASE_URL =
|
||||
"https://6bb0-85-253-195-252.ngrok.io"
|
||||
|
||||
private val moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build()
|
||||
private val retrofit = Retrofit.Builder().addConverterFactory(MoshiConverterFactory.create(moshi))
|
||||
.baseUrl(BASE_URL).build()
|
||||
|
||||
interface TokenApiService {
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("/auth/authentication")
|
||||
suspend fun postToken(@Body data: String): Response<TokenItem>
|
||||
}
|
||||
|
||||
object TokenApi {
|
||||
val retrofitService : TokenApiService by lazy {
|
||||
retrofit.create(TokenApiService::class.java)
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package com.tarkvaraprojekt.mobileauthapp.network
|
||||
|
||||
/**
|
||||
* TokenItem for making POST request.
|
||||
*/
|
||||
data class TokenItem (
|
||||
val token: String,
|
||||
val challenge: String,
|
||||
)
|
@ -5,7 +5,7 @@
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:fillColor="#001970"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
|
@ -4,14 +4,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="24dp"
|
||||
android:padding="@dimen/padding"
|
||||
tools:context=".AuthFragment">
|
||||
|
||||
<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"
|
||||
android:layout_margin="@dimen/margin"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -23,31 +23,32 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="20sp">
|
||||
android:padding="@dimen/padding_small">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/auth_fragment_instruction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:gravity="center"
|
||||
android:layout_margin="@dimen/margin"
|
||||
android:gravity="left"
|
||||
android:text="@string/auth_instruction_text"
|
||||
android:textSize="20sp" />
|
||||
android:textSize="@dimen/regular_text" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nfc_logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="@dimen/logo_big"
|
||||
android:layout_height="@dimen/logo_big"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="6dp"
|
||||
android:layout_margin="@dimen/margin"
|
||||
android:padding="@dimen/margin_huge"
|
||||
android:src="@drawable/nfc_logo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time_counter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:textSize="14sp"
|
||||
android:layout_margin="@dimen/margin"
|
||||
android:textSize="@dimen/regular_text"
|
||||
app:layout_constraintTop_toBottomOf="@id/auth_fragment_instruction"
|
||||
tools:text="@string/time_left" />
|
||||
|
||||
@ -60,9 +61,9 @@
|
||||
android:id="@+id/next_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/next_text"
|
||||
android:textSize="15sp"
|
||||
android:layout_marginTop="@dimen/margin_big"
|
||||
android:text="@string/continue_button"
|
||||
android:textSize="@dimen/regular_text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
@ -71,10 +72,10 @@
|
||||
android:id="@+id/cancel_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginTop="@dimen/margin_big"
|
||||
android:layout_marginStart="@dimen/padding_tiny"
|
||||
android:text="@string/cancel_text"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/next_button"
|
||||
android:textSize="@dimen/regular_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
|
||||
|
@ -4,82 +4,57 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="24dp"
|
||||
tools:context=".CanFragment">
|
||||
android:padding="@dimen/padding"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/card_view"
|
||||
<TextView
|
||||
android:id="@+id/title_text"
|
||||
android:text="@string/can_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:textSize="@dimen/headline_text"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
android:fontFamily="sans-serif"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="@color/stroke_color"
|
||||
app:cardElevation="0dp">
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/canTextField"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
android:hint="@string/can_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_text"
|
||||
app:helperTextEnabled="true"
|
||||
app:helperText="@string/can_helper_text"
|
||||
app:helperTextTextAppearance="@style/helper"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="6"
|
||||
app:counterTextAppearance="@style/helper"
|
||||
app:counterOverflowTextAppearance="@style/helper"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20sp">
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:fontFamily="sans-serif"
|
||||
android:inputType="number"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/enter_can"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:text="@string/enter_can"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/can_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/text_can"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="6"
|
||||
app:endIconMode="password_toggle"
|
||||
app:errorEnabled="true"
|
||||
app:helperText="@string/example_can"
|
||||
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>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/next_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/next_text"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/cancel_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:id="@+id/button_cancel"
|
||||
android:text="@string/cancel_text"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/next_button"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
android:fontFamily="sans-serif"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
app:layout_constraintTop_toBottomOf="@id/canTextField" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="24dp"
|
||||
android:padding="@dimen/padding"
|
||||
tools:context=".HomeFragment">
|
||||
|
||||
<LinearLayout
|
||||
@ -20,7 +20,7 @@
|
||||
android:id="@+id/can_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="@color/stroke_color"
|
||||
app:cardElevation="0dp">
|
||||
@ -32,14 +32,14 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/can_status_logo"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginStart="@dimen/margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/can_status_text"
|
||||
android:textSize="20sp"
|
||||
android:padding="12dp"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:padding="@dimen/margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
android:id="@+id/pin_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="@color/stroke_color"
|
||||
app:cardElevation="0dp">
|
||||
@ -63,14 +63,14 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pin_status_logo"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginStart="@dimen/margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pin_status_text"
|
||||
android:textSize="20sp"
|
||||
android:padding="12dp"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:padding="@dimen/margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
@ -80,15 +80,49 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/id_card_detection"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintStart_toStartOf="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>
|
||||
|
||||
<Button
|
||||
android:id="@+id/begin_button"
|
||||
android:id="@+id/home_action_button"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:text="@string/try_again_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/begin_text"
|
||||
android:layout_marginTop="24dp"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintTop_toBottomOf="@id/saved_states"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:layout_marginStart="@dimen/margin_huge"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/id_card_detection"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/home_help_button"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:text="@string/help_text"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:layout_marginStart="@dimen/margin_huge"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="?attr/materialButtonOutlinedStyle"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/home_action_button"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -4,81 +4,111 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="24dp"
|
||||
tools:context=".PinFragment">
|
||||
android:padding="@dimen/padding"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/card_view"
|
||||
<TextView
|
||||
android:id="@+id/title_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="@string/pin_view"
|
||||
android:textSize="@dimen/headline_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="@color/stroke_color"
|
||||
app:cardElevation="0dp">
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/pinTextField"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
android:hint="@string/hint_pin"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="12"
|
||||
app:counterOverflowTextAppearance="@style/helper"
|
||||
app:counterTextAppearance="@style/helper"
|
||||
app:endIconMode="password_toggle"
|
||||
app:helperText="@string/pin_helper_text"
|
||||
app:helperTextEnabled="true"
|
||||
app:helperTextTextAppearance="@style/helper"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_text">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
android:fontFamily="sans-serif"
|
||||
android:inputType="numberPassword"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/regular_text" />
|
||||
|
||||
<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" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<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"
|
||||
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>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/next_button"
|
||||
<TextView
|
||||
android:id="@+id/save_pin_question"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/next_text"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/cancel_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/cancel_text"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/next_button"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
android:paddingTop="@dimen/padding"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="@string/save_pin"
|
||||
android:textSize="@dimen/regular_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
app:layout_constraintTop_toBottomOf="@id/pinTextField" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/save_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/save_pin_question">
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/save_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
android:checked="true"
|
||||
android:minWidth="48dp"
|
||||
android:minHeight="48dp"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/save_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="@string/pin_save_on"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_continue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="@string/continue_button"
|
||||
android:textSize="@dimen/regular_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/save_layout" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_big"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="@string/cancel_text"
|
||||
android:textSize="@dimen/regular_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/button_continue" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -64,7 +64,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/next_text"
|
||||
android:text="@string/continue_button"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
||||
|
@ -4,14 +4,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="24dp"
|
||||
android:padding="@dimen/padding"
|
||||
tools:context=".ResultFragment">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/can_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_margin="@dimen/margin"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@ -27,33 +27,23 @@
|
||||
<TextView
|
||||
android:id="@+id/result_text"
|
||||
android:text="@string/result_text"
|
||||
android:textSize="20sp"
|
||||
android:padding="12dp"
|
||||
android:layout_marginVertical="6dp"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:padding="@dimen/padding_small"
|
||||
android:layout_marginVertical="@dimen/margin_small"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_info_text"
|
||||
android:text="@string/result_info"
|
||||
android:padding="12dp"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginVertical="6dp"
|
||||
android:padding="@dimen/padding_small"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:layout_marginVertical="@dimen/margin_small"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/result_back_button"
|
||||
android:text="@string/return_text"
|
||||
android:layout_marginHorizontal="12dp"
|
||||
android:layout_marginVertical="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_margin="@dimen/padding"
|
||||
tools:context=".menu.SettingsFragment">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
@ -22,44 +22,46 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp">
|
||||
android:padding="@dimen/padding_small">
|
||||
<TextView
|
||||
android:id="@+id/can_saved"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:padding="12dp"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:padding="@dimen/margin_small"
|
||||
android:text="@string/saved_can" />
|
||||
<Button
|
||||
android:id="@+id/can_menu_action"
|
||||
android:layout_margin="12dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_margin="@dimen/margin_small"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:id="@+id/pin_saved"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:padding="12dp"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:padding="@dimen/margin_small"
|
||||
android:text="@string/saved_pin"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<Button
|
||||
android:id="@+id/pin_menu_action"
|
||||
android:layout_margin="12dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
android:orientation="vertical">
|
||||
<Button
|
||||
android:id="@+id/pin_menu_show"
|
||||
android:layout_margin="12dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_marginHorizontal="@dimen/margin"
|
||||
android:layout_marginVertical="@dimen/margin_small"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"/>
|
||||
<Button
|
||||
android:id="@+id/pin_menu_action"
|
||||
android:layout_marginHorizontal="@dimen/margin"
|
||||
android:layout_marginVertical="@dimen/margin_small"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
@ -69,8 +71,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/return_text"
|
||||
android:layout_margin="24dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_marginVertical="@dimen/margin"
|
||||
android:layout_marginStart="@dimen/padding"
|
||||
android:textSize="@dimen/regular_text"
|
||||
app:layout_constraintTop_toBottomOf="@id/settings_card"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
@ -1,123 +1,127 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="24dp"
|
||||
tools:context=".UserFragment">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/card_view"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
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"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="@color/stroke_color"
|
||||
app:cardElevation="0dp">
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/padding"
|
||||
tools:context=".UserFragment">
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/card_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20sp">
|
||||
android:layout_margin="@dimen/margin"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="@color/stroke_color"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_name_label"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/user_name_label"
|
||||
android:textSize="14sp" />
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/padding_tiny">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/user_name"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/user_name_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/user_name_label"
|
||||
android:textSize="@dimen/regular_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/identification_number_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/identification_number_label"
|
||||
android:textSize="14sp" />
|
||||
<TextView
|
||||
android:id="@+id/user_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:text="@string/user_name"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/identification_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/identification_number_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_big"
|
||||
android:text="@string/identification_number_label"
|
||||
android:textSize="@dimen/regular_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gender_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/gender_label"
|
||||
android:textSize="14sp" />
|
||||
<TextView
|
||||
android:id="@+id/identification_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gender"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/gender_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_big"
|
||||
android:text="@string/gender_label"
|
||||
android:textSize="@dimen/regular_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/expiration_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/expiration_label"
|
||||
android:textSize="14sp" />
|
||||
<TextView
|
||||
android:id="@+id/gender"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/expiration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/expiration_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_big"
|
||||
android:text="@string/expiration_label"
|
||||
android:textSize="@dimen/regular_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/citizenship_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/citizenship_label"
|
||||
android:textSize="14sp" />
|
||||
<TextView
|
||||
android:id="@+id/expiration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/citizenship"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/citizenship_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_big"
|
||||
android:text="@string/citizenship_label"
|
||||
android:textSize="@dimen/regular_text" />
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/citizenship"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:textSize="@dimen/regular_text"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/clear_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/clear_button"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<Button
|
||||
android:id="@+id/clear_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_big"
|
||||
android:text="@string/return_text"
|
||||
android:textSize="@dimen/regular_text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<foreground android:drawable="@drawable/ic_check_logo" />
|
||||
</adaptive-icon>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<foreground android:drawable="@drawable/ic_check_logo" />
|
||||
</adaptive-icon>
|
@ -18,6 +18,9 @@
|
||||
android:id="@+id/action_homeFragment_to_canFragment"
|
||||
app:destination="@id/canFragment"
|
||||
app:popUpTo="@id/homeFragment" />
|
||||
<action
|
||||
android:id="@+id/action_homeFragment_to_userFragment"
|
||||
app:destination="@id/userFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/pinFragment"
|
||||
@ -42,10 +45,6 @@
|
||||
android:id="@+id/action_pinFragment_to_authFragment"
|
||||
app:destination="@id/authFragment"
|
||||
app:popUpTo="@id/homeFragment" />
|
||||
<argument
|
||||
android:name="reading"
|
||||
app:argType="boolean"
|
||||
android:defaultValue="false" />
|
||||
<argument
|
||||
android:name="auth"
|
||||
app:argType="boolean"
|
||||
@ -78,10 +77,6 @@
|
||||
android:id="@+id/action_canFragment_to_pinFragment"
|
||||
app:destination="@id/pinFragment"
|
||||
app:popUpTo="@id/homeFragment" />
|
||||
<argument
|
||||
android:name="reading"
|
||||
app:argType="boolean"
|
||||
android:defaultValue="false" />
|
||||
<argument
|
||||
android:name="auth"
|
||||
app:argType="boolean"
|
||||
@ -90,6 +85,10 @@
|
||||
android:name="mobile"
|
||||
app:argType="boolean"
|
||||
android:defaultValue="false" />
|
||||
<argument
|
||||
android:name="fromhome"
|
||||
app:argType="boolean"
|
||||
android:defaultValue="false" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/authFragment"
|
||||
@ -113,10 +112,6 @@
|
||||
android:name="auth"
|
||||
app:argType="boolean"
|
||||
android:defaultValue="false" />
|
||||
<argument
|
||||
android:name="reading"
|
||||
app:argType="boolean"
|
||||
android:defaultValue="false" />
|
||||
<argument
|
||||
android:name="mobile"
|
||||
app:argType="boolean"
|
||||
|
@ -1,29 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Must translate to English, but should work now -->
|
||||
<string name="app_name">NFC authentication</string>
|
||||
<string name="home_fragment">Work in progress</string>
|
||||
<string name="app_name">NFC authenticator</string>
|
||||
|
||||
<!-- BUTTONS -->
|
||||
<string name="cancel_text">CANCEL</string>
|
||||
<string name="return_text">BACK</string>
|
||||
<string name="add_can_text">ADD CAN</string>
|
||||
<string name="try_again_text">TRY AGAIN</string>
|
||||
<string name="continue_button">CONTINUE</string>
|
||||
|
||||
<!-- Card Detection related -->
|
||||
<string name="card_detected">Card detected. Hold it against the phone.</string>
|
||||
<string name="data_read">Data read. You can continue.</string>
|
||||
<string name="wrong_can_text">Wrong CAN</string>
|
||||
<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 early</string>
|
||||
<string name="wrong_pin">Wrong PIN 1. Tries on the card left %s</string>
|
||||
|
||||
<!-- string resources for HomeFragment -->
|
||||
<string name="pin_status_saved">PIN 1 saved</string>
|
||||
<string name="pin_status_negative">PIN 1 not saved</string>
|
||||
<string name="can_status_saved">CAN saved</string>
|
||||
<string name="can_status_negative">CAN not saved</string>
|
||||
|
||||
<string name="begin_text">READ ID CARD</string>
|
||||
<string name="next_text">NEXT</string>
|
||||
<string name="cancel_text">CANCEL</string>
|
||||
<string name="save_text">SAVE</string>
|
||||
<string name="deny_text">NO</string>
|
||||
<string name="return_text">BACK</string>
|
||||
<string name="help_text">HELP</string>
|
||||
<string name="can_question">What is CAN?</string>
|
||||
<string name="can_explanation">CAN is a 6 digit code that is needed to communicate with an ID card. It can be found on the ID card under the card holder\'s picture with a title KASUTAJA ALLKIRI/HOLDER\'S SIGNATURE.</string>
|
||||
|
||||
<!-- string resources for PinFragment -->
|
||||
<string name="pin_fragment">Please enter PIN 1</string>
|
||||
<string name="enter_pin">PIN 1</string>
|
||||
<string name="example_pin">Example. 1234</string>
|
||||
<string name="length_pin">Allowed length for PIN 1 is 4..12</string>
|
||||
<string name="pin_save_request">PIN 1 is currently not saved. Do you wish to save the entered PIN 1? Saved PIN 1 will be entered automatically in the future. Saved PIN 1 can be changed and deleted in the settings menu.</string>
|
||||
<string name="save_pin_title">Save PIN 1</string>
|
||||
<string name="pin_view">Please enter PIN 1</string>
|
||||
<string name="hint_pin">PIN 1</string>
|
||||
<string name="pin_helper_text">PIN 1 must be 4–12 digits long</string>
|
||||
<string name="save_pin">Save PIN 1</string>
|
||||
<string name="pin_save_on">On</string>
|
||||
<string name="pin_save_off">Off</string>
|
||||
|
||||
<!-- string resources for Pin2Fragment -->
|
||||
<string name="pin2_fragment">Please enter PIN 2</string>
|
||||
@ -32,19 +45,14 @@
|
||||
<string name="length_pin2">Allowed length for PIN 2 is 5..12</string>
|
||||
|
||||
<!-- string resources for CanFragment -->
|
||||
<string name="example_can">Example. 123456</string>
|
||||
<string name="text_can">CAN</string>
|
||||
<string name="enter_can">Enter ID card\'s CAN (Card Access Number)</string>
|
||||
<string name="length_can">Length of the CAN is wrong</string>
|
||||
<string name="card_detected">Card detected. Hold it against the phone.</string>
|
||||
<string name="data_read">Data read. You can continue.</string>
|
||||
<string name="save_can_title">Save CAN</string>
|
||||
<string name="can_view">Please enter CAN</string>
|
||||
<string name="can_text">CAN</string>
|
||||
<string name="can_helper_text">CAN must be 6 digits long</string>
|
||||
|
||||
<!-- 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="no_time">No time left</string>
|
||||
<string name="no_success">Wrong CAN</string>
|
||||
|
||||
<!-- string resources for UserFragment layout -->
|
||||
<string name="user_name_label">NAME</string>
|
||||
@ -53,18 +61,14 @@
|
||||
<string name="expiration_label">DATE OF EXPIRY</string>
|
||||
<string name="citizenship_label">CITIZENSHIP</string>
|
||||
<string name="gender_label">SEX</string>
|
||||
<string name="clear_button">FORGET</string>
|
||||
|
||||
<!-- string resources for ResultFragment layout-->
|
||||
<string name="result_text">Controlling the created token</string>
|
||||
<string name="result_info">Wait for the app to close</string>
|
||||
<string name="result_info">The app will close automatically</string>
|
||||
|
||||
<!-- menu -->
|
||||
<string name="menu_settings_title">Settings</string>
|
||||
<string name="menu_language_title">Language</string>
|
||||
<string name="menu_action_unavailable">Currently unavailable</string>
|
||||
<string name="saved_can">CAN: %s</string>
|
||||
<string name="can_add">Add CAN</string>
|
||||
<string name="can_delete">Delete CAN</string>
|
||||
<string name="saved_pin">PIN1: %s</string>
|
||||
<string name="pin1_add">Add PIN1</string>
|
||||
@ -73,6 +77,7 @@
|
||||
<string name="show">SHOW</string>
|
||||
<string name="hide">HIDE</string>
|
||||
<string name="hidden_pin">****</string>
|
||||
<string name="unavailable">Settings currently unavailabe</string>
|
||||
<string name="can_save_request">CAN is currently not saved. Do you wish to save the CAN? Saved CAN will be entered automatically in the future. Saved CAN can be changed and deleted in the settings menu.</string>
|
||||
<string name="menu_unavailable_message">Settings are currently unavailable</string>
|
||||
<string name="can_deleted">CAN deleted</string>
|
||||
<string name="pin_deleted">PIN 1 deleted</string>
|
||||
</resources>
|
@ -1,28 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">NFC authentication</string>
|
||||
<string name="home_fragment">Work in progress</string>
|
||||
<string name="app_name">NFC autentija</string>
|
||||
|
||||
<string name="begin_text">LOE ID KAARTI</string>
|
||||
<string name="next_text">EDASI</string>
|
||||
<!-- Buttons -->
|
||||
<string name="cancel_text">KATKESTA</string>
|
||||
<string name="save_text">SALVESTA</string>
|
||||
<string name="deny_text">EI</string>
|
||||
<string name="return_text">TAGASI</string>
|
||||
<string name="add_can_text">LISA CAN</string>
|
||||
<string name="try_again_text">ÜRITA UUESTI</string>
|
||||
<string name="continue_button">JÄTKA</string>
|
||||
|
||||
<!-- Card Detection related -->
|
||||
<string name="card_detected">Kaart tuvastatud. Hoia kaarti vastu telefoni.</string>
|
||||
<string name="data_read">Andmed loetud, võid jätkata.</string>
|
||||
<string name="wrong_can_text">Vale CAN</string>
|
||||
<string name="action_detect">ID kaardi tuvastamiseks pane kaart vastu telefoni</string>
|
||||
<string name="action_detect_unavailable">ID kaardi tuvastamiseks peab olema CAN lisatud</string>
|
||||
<string name="nfc_not_available">NFC ei ole sisse lülitatud või puudub telefonil NFC võimekus</string>
|
||||
<string name="nfc_reading_error">Sisestatud CAN ei ole vastavuses ID kaardiga</string>
|
||||
<string name="id_card_removed_early">ID kaart eemaldati liiga vara</string>
|
||||
<string name="wrong_pin">Vale PIN 1. ID kaardil PIN 1 sisetamise kordi alles: %s</string>
|
||||
|
||||
<!-- string resources for HomeFragment -->
|
||||
<string name="pin_status_saved">PIN 1 on salvestatud</string>
|
||||
<string name="pin_status_negative">PIN 1 ei ole salvestatud</string>
|
||||
<string name="can_status_saved">CAN on salvestatud</string>
|
||||
<string name="can_status_negative">CAN ei ole salvestatud</string>
|
||||
<string name="help_text">INFO</string>
|
||||
<string name="can_question">Mis on CAN?</string>
|
||||
<string name="can_explanation">CAN on 6 kohaline numbritest koosnev kood, mida on vaja ID kaardiga suhtlemiseks. CAN-i leiab ID kaardilt omaniku pildi alt pealkirjaga KASUTAJA ALLKIRI/HOLDER\'S SIGNATURE.</string>
|
||||
|
||||
<!-- string resources for PinFragment -->
|
||||
<string name="pin_fragment">Palun sisesta PIN 1</string>
|
||||
<string name="enter_pin">PIN 1</string>
|
||||
<string name="example_pin">Näide. 1234</string>
|
||||
<string name="length_pin">PIN 1 lubatud pikkus on 4..12</string>
|
||||
<string name="pin_save_request">Praegu ei ole rakenduses PIN 1 salvestatud. Kas sa soovid sisestatud PIN 1-te salvestada? Sellisel juhul sisestatakse see järgmisel korral automaatselt. Salvestatud PIN 1-te saab alati menüüs muuta ja kustutada.</string>
|
||||
<string name="save_pin_title">Salvesta PIN 1</string>
|
||||
<string name="pin_view">Palun sisesta PIN 1</string>
|
||||
<string name="hint_pin">PIN 1</string>
|
||||
<string name="pin_helper_text">PIN 1 lubatud pikkus on 4..12</string>
|
||||
<string name="save_pin">Save PIN 1</string>
|
||||
<string name="pin_save_on">On</string>
|
||||
<string name="pin_save_off">Off</string>
|
||||
|
||||
<!-- string resources for Pin2Fragment -->
|
||||
<string name="pin2_fragment">Palun sisesta PIN 2</string>
|
||||
@ -31,25 +44,19 @@
|
||||
<string name="length_pin2">PIN 2 lubatud pikkus on 5..12</string>
|
||||
|
||||
<!-- string resources for CanFragment -->
|
||||
<string name="example_can">Näide. 123456</string>
|
||||
<string name="text_can">CAN</string>
|
||||
<string name="enter_can">Sisesta ID kaardi CAN (Card Access Number)</string>
|
||||
<string name="length_can">CANi pikkus on vale</string>
|
||||
<string name="card_detected">Kaart on tuvastatud. Hoia kaarti vastu telefoni.</string>
|
||||
<string name="data_read">Andmed loetud. Võid edasi minna.</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 name="can_view">Please enter CAN</string>
|
||||
<string name="can_text">CAN</string>
|
||||
<string name="can_helper_text">CAN must be 6 digits long</string>
|
||||
|
||||
<!-- 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="no_time">Aeg on otsas</string>
|
||||
<string name="no_success">Vale CAN</string>
|
||||
|
||||
<!-- string resources for UserFragment layout -->
|
||||
<string name="user_name_label">NIMI</string>
|
||||
<string name="user_name">%1$s %2$s</string>
|
||||
<string name="identification_number_label">ISIKUKOOD</string>
|
||||
<string name="clear_button">UNUSTA</string>
|
||||
<string name="expiration_label">KEHTIV KUNI</string>
|
||||
<string name="citizenship_label">KODAKONDSUS</string>
|
||||
<string name="gender_label">SUGU</string>
|
||||
@ -60,10 +67,7 @@
|
||||
|
||||
<!-- menu -->
|
||||
<string name="menu_settings_title">Seaded</string>
|
||||
<string name="menu_language_title">Keel</string>
|
||||
<string name="menu_action_unavailable">Toiming pole hetkel saadaval</string>
|
||||
<string name="saved_can">CAN: %s</string>
|
||||
<string name="can_add">Lisa CAN</string>
|
||||
<string name="can_delete">Kustuta CAN</string>
|
||||
<string name="saved_pin">PIN1: %s</string>
|
||||
<string name="pin1_add">Lisa PIN1</string>
|
||||
@ -72,5 +76,7 @@
|
||||
<string name="show">NÄITA</string>
|
||||
<string name="hide">PEIDA</string>
|
||||
<string name="hidden_pin">****</string>
|
||||
<string name="unavailable">Seaded pole hetkel saadaval</string>
|
||||
<string name="menu_unavailable_message">Seaded pole hetkel saadaval</string>
|
||||
<string name="can_deleted">CAN kustatud</string>
|
||||
<string name="pin_deleted">PIN 1 kustatud</string>
|
||||
</resources>
|
@ -8,9 +8,9 @@
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
|
||||
<color name="blue_200">#90caf9</color>
|
||||
<color name="blue_500">#2196f3</color>
|
||||
<color name="blue_700">#1976d2</color>
|
||||
<color name="orange_200">#ffcc80</color>
|
||||
<color name="blue_200">#d1d9ff</color>
|
||||
<color name="blue_500">#002984</color>
|
||||
<color name="blue_700">#001970</color>
|
||||
<color name="orange_200">#ffab91</color>
|
||||
<color name="orange_700">#f57c00</color>
|
||||
</resources>
|
15
MobileAuthApp/app/src/main/res/values/dimens.xml
Normal file
15
MobileAuthApp/app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="margin_small">4dp</dimen>
|
||||
<dimen name="margin">8dp</dimen>
|
||||
<dimen name="margin_big">16dp</dimen>
|
||||
<dimen name="margin_huge">32dp</dimen>
|
||||
<dimen name="padding_tiny">8dp</dimen>
|
||||
<dimen name="padding_small">16dp</dimen>
|
||||
<dimen name="padding">24dp</dimen>
|
||||
<dimen name="regular_text">24sp</dimen>
|
||||
<dimen name="headline_text">32sp</dimen>
|
||||
<dimen name="helper_text">16sp</dimen>
|
||||
<dimen name="small_text">8sp</dimen>
|
||||
<dimen name="logo_big">128dp</dimen>
|
||||
</resources>
|
@ -1,27 +1,40 @@
|
||||
<resources>
|
||||
<string name="app_name">NFC authentication</string>
|
||||
<string name="home_fragment">Work in progress</string>
|
||||
<string name="app_name">NFC authenticator</string>
|
||||
|
||||
<string name="begin_text">READ ID CARD</string>
|
||||
<string name="next_text">NEXT</string>
|
||||
<!-- BUTTONS -->
|
||||
<string name="cancel_text">CANCEL</string>
|
||||
<string name="save_text">SAVE</string>
|
||||
<string name="deny_text">NO</string>
|
||||
<string name="return_text">BACK</string>
|
||||
<string name="add_can_text">ADD CAN</string>
|
||||
<string name="try_again_text">TRY AGAIN</string>
|
||||
<string name="continue_button">CONTINUE</string>
|
||||
|
||||
<!-- Card Detection related -->
|
||||
<string name="card_detected">Card detected. Hold it against the phone.</string>
|
||||
<string name="data_read">Data read. You can continue.</string>
|
||||
<string name="wrong_can_text">Wrong CAN</string>
|
||||
<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 early</string>
|
||||
<string name="wrong_pin">Wrong PIN 1. Tries on the card left %s</string>
|
||||
|
||||
<!-- string resources for HomeFragment -->
|
||||
<string name="pin_status_saved">PIN 1 saved</string>
|
||||
<string name="pin_status_negative">PIN 1 not saved</string>
|
||||
<string name="can_status_saved">CAN saved</string>
|
||||
<string name="can_status_negative">CAN not saved</string>
|
||||
<string name="help_text">HELP</string>
|
||||
<string name="can_question">What is CAN?</string>
|
||||
<string name="can_explanation">CAN is a 6 digit code that is needed to communicate with an ID card. It can be found on the ID card under the card holder\'s picture with a title KASUTAJA ALLKIRI/HOLDER\'S SIGNATURE.</string>
|
||||
|
||||
<!-- string resources for PinFragment -->
|
||||
<string name="pin_fragment">Please enter PIN 1</string>
|
||||
<string name="enter_pin">PIN 1</string>
|
||||
<string name="example_pin">Example. 1234</string>
|
||||
<string name="length_pin">Allowed length for PIN 1 is 4..12</string>
|
||||
<string name="pin_save_request">PIN 1 is currently not saved. Do you wish to save the entered PIN 1? Saved PIN 1 will be entered automatically in the future. Saved PIN 1 can be changed and deleted in the settings menu.</string>
|
||||
<string name="save_pin_title">Save PIN 1</string>
|
||||
<string name="pin_view">Please enter PIN 1</string>
|
||||
<string name="hint_pin">PIN 1</string>
|
||||
<string name="pin_helper_text">PIN 1 must be 4–12 digits long</string>
|
||||
<string name="save_pin">Save PIN 1</string>
|
||||
<string name="pin_save_on">On</string>
|
||||
<string name="pin_save_off">Off</string>
|
||||
|
||||
<!-- string resources for Pin2Fragment -->
|
||||
<string name="pin2_fragment">Please enter PIN 2</string>
|
||||
@ -30,20 +43,14 @@
|
||||
<string name="length_pin2">Allowed length for PIN 2 is 5..12</string>
|
||||
|
||||
<!-- string resources for CanFragment -->
|
||||
<string name="example_can">Example. 123456</string>
|
||||
<string name="text_can">CAN</string>
|
||||
<string name="enter_can">Enter ID card\'s CAN (Card Access Number)</string>
|
||||
<string name="length_can">Length of the CAN is wrong</string>
|
||||
<string name="card_detected">Card detected. Hold it against the phone.</string>
|
||||
<string name="data_read">Data read. You can continue.</string>
|
||||
<string name="can_save_request">CAN is currently not saved. Do you wish to save the CAN? Saved CAN will be entered automatically in the future. Saved CAN can be changed and deleted in the settings menu.</string>
|
||||
<string name="save_can_title">Save CAN</string>
|
||||
<string name="can_view">Please enter CAN</string>
|
||||
<string name="can_text">CAN</string>
|
||||
<string name="can_helper_text">CAN must be 6 digits long</string>
|
||||
|
||||
<!-- 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="no_time">No time left</string>
|
||||
<string name="no_success">Wrong CAN</string>
|
||||
|
||||
<!-- string resources for UserFragment layout -->
|
||||
<string name="user_name_label">NAME</string>
|
||||
@ -52,18 +59,14 @@
|
||||
<string name="expiration_label">DATE OF EXPIRY</string>
|
||||
<string name="citizenship_label">CITIZENSHIP</string>
|
||||
<string name="gender_label">SEX</string>
|
||||
<string name="clear_button">FORGET</string>
|
||||
|
||||
<!-- string resources for ResultFragment layout-->
|
||||
<string name="result_text">Controlling the created token</string>
|
||||
<string name="result_info">Wait for the app to close</string>
|
||||
<string name="result_info">The app will close automatically</string>
|
||||
|
||||
<!-- menu -->
|
||||
<string name="menu_settings_title">Settings</string>
|
||||
<string name="menu_language_title">Language</string>
|
||||
<string name="menu_action_unavailable">Currently unavailable</string>
|
||||
<string name="saved_can">CAN: %s</string>
|
||||
<string name="can_add">Add CAN</string>
|
||||
<string name="can_delete">Delete CAN</string>
|
||||
<string name="saved_pin">PIN1: %s</string>
|
||||
<string name="pin1_add">Add PIN 1</string>
|
||||
@ -72,5 +75,7 @@
|
||||
<string name="show">SHOW</string>
|
||||
<string name="hide">HIDE</string>
|
||||
<string name="hidden_pin">****</string>
|
||||
<string name="unavailable">Settings currently unavailable</string>
|
||||
<string name="menu_unavailable_message">Settings are currently unavailable</string>
|
||||
<string name="can_deleted">CAN deleted</string>
|
||||
<string name="pin_deleted">PIN 1 deleted</string>
|
||||
</resources>
|
7
MobileAuthApp/app/src/main/res/values/styles.xml
Normal file
7
MobileAuthApp/app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="helper">
|
||||
<item name="android:fontFamily">sans-serif</item>
|
||||
<item name="android:textSize">@dimen/helper_text</item>
|
||||
</style>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user