mirror of
https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC.git
synced 2024-12-22 12:30:16 +02:00
MOB-40 improved CAN and PIN views
This commit is contained in:
parent
edc444c027
commit
f085076631
@ -8,6 +8,7 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
@ -44,13 +45,10 @@ class CanFragment : Fragment() {
|
|||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
checkIfSkip()
|
checkIfSkip()
|
||||||
// If the user arrives from the settings menu then the button should say
|
binding!!.canTextField.editText?.addTextChangedListener {
|
||||||
// save instead of continue.
|
checkEnteredCan()
|
||||||
if (args.saving) {
|
|
||||||
binding!!.nextButton.text = getString(R.string.save_text)
|
|
||||||
}
|
}
|
||||||
binding!!.nextButton.setOnClickListener { checkEnteredCan() }
|
binding!!.buttonCancel.setOnClickListener { goToTheStart() }
|
||||||
binding!!.cancelButton.setOnClickListener { goToTheStart() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,60 +69,12 @@ class CanFragment : Fragment() {
|
|||||||
findNavController().navigate(action)
|
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.
|
* 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
|
* If the user arrived from the settings menu then the start is the settings menu
|
||||||
* not the HomeFragment.
|
* not the HomeFragment.
|
||||||
*/
|
*/
|
||||||
private fun goToTheStart() {
|
private fun goToTheStart() {
|
||||||
// TODO: Needs special handling when the app is launched with intent. Temporary solution at the moment.
|
|
||||||
if (args.saving) {
|
if (args.saving) {
|
||||||
findNavController().navigate(R.id.action_canFragment_to_settingsFragment)
|
findNavController().navigate(R.id.action_canFragment_to_settingsFragment)
|
||||||
} else if (args.auth || args.mobile) {
|
} else if (args.auth || args.mobile) {
|
||||||
@ -140,6 +90,24 @@ class CanFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
if (args.saving) {
|
||||||
|
goToTheStart()
|
||||||
|
} else {
|
||||||
|
goToTheNextFragment()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
binding = null
|
binding = null
|
||||||
|
@ -53,6 +53,7 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
val mobile = requireActivity().intent.getBooleanExtra("mobile", false)
|
val mobile = requireActivity().intent.getBooleanExtra("mobile", false)
|
||||||
if (auth || mobile){
|
if (auth || mobile){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (mobile) {
|
if (mobile) {
|
||||||
// We use !! because we want an exception when something is not right.
|
// We use !! because we want an exception when something is not right.
|
||||||
@ -73,6 +74,7 @@ class HomeFragment : Fragment() {
|
|||||||
requireActivity().setResult(AppCompatActivity.RESULT_CANCELED, resultIntent)
|
requireActivity().setResult(AppCompatActivity.RESULT_CANCELED, resultIntent)
|
||||||
requireActivity().finish()
|
requireActivity().finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
goToTheNextFragment(true, mobile)
|
goToTheNextFragment(true, mobile)
|
||||||
}
|
}
|
||||||
binding!!.beginButton.setOnClickListener { goToTheNextFragment() }
|
binding!!.beginButton.setOnClickListener { goToTheNextFragment() }
|
||||||
|
@ -40,6 +40,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
R.id.menu_settings_option -> {
|
R.id.menu_settings_option -> {
|
||||||
if (menuAvailable) {
|
if (menuAvailable) {
|
||||||
navigationController.navigate(R.id.action_homeFragment_to_settingsFragment)
|
navigationController.navigate(R.id.action_homeFragment_to_settingsFragment)
|
||||||
|
menuAvailable = false
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, getString(R.string.unavailable), Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, getString(R.string.unavailable), Toast.LENGTH_SHORT).show()
|
||||||
|
@ -32,6 +32,9 @@ class PinFragment : Fragment() {
|
|||||||
// not require PIN 1 so it is not necessary to ask it.
|
// not require PIN 1 so it is not necessary to ask it.
|
||||||
private val args: PinFragmentArgs by navArgs()
|
private val args: PinFragmentArgs by navArgs()
|
||||||
|
|
||||||
|
// TODO: Should be persistent and read when launching the app
|
||||||
|
private var saveToggle = true
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
@ -44,26 +47,22 @@ class PinFragment : Fragment() {
|
|||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
checkIfSkip()
|
checkIfSkip()
|
||||||
// If the user arrives from the settings menu then the button says
|
// Switch should be not visible when user is in savings mode
|
||||||
// save instead of continue.
|
|
||||||
if (args.saving) {
|
if (args.saving) {
|
||||||
binding!!.nextButton.text = getString(R.string.save_text)
|
binding!!.savePinQuestion.visibility = View.GONE
|
||||||
}
|
binding!!.saveLayout.visibility = View.GONE
|
||||||
binding!!.nextButton.setOnClickListener { checkEnteredPin() }
|
} else {
|
||||||
binding!!.cancelButton.setOnClickListener { goToTheStart() }
|
binding!!.saveSwitch.setOnCheckedChangeListener { _, isChecked ->
|
||||||
}
|
if (isChecked) {
|
||||||
|
binding!!.saveStatus.text = getString(R.string.pin_save_on)
|
||||||
/**
|
} else {
|
||||||
* Checks if the current fragment can be skipped or not.
|
binding!!.saveStatus.text = getString(R.string.pin_save_off)
|
||||||
* If the user has PIN 1 saved on the device or PIN 1 is not required
|
}
|
||||||
* then the PIN 1 won't be asked.
|
saveToggle = !saveToggle
|
||||||
*/
|
}
|
||||||
private fun checkIfSkip() {
|
|
||||||
if (args.reading) {
|
|
||||||
goToTheNextFragment()
|
|
||||||
} else if (viewModel.userPin.length in 4..12) {
|
|
||||||
goToTheNextFragment()
|
|
||||||
}
|
}
|
||||||
|
binding!!.buttonContinue.setOnClickListener { checkEnteredPin() }
|
||||||
|
binding!!.buttonCancel.setOnClickListener { goToTheStart() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,60 +73,13 @@ class PinFragment : Fragment() {
|
|||||||
findNavController().navigate(action)
|
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
|
* Returns user to the start. If the user arrived from the settings menu then the start is
|
||||||
* settings menu not the HomeFragment.
|
* settings menu not the HomeFragment.
|
||||||
*/
|
*/
|
||||||
private fun goToTheStart() {
|
private fun goToTheStart() {
|
||||||
if (args.saving) {
|
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) {
|
} else if (args.auth || args.mobile) {
|
||||||
if (args.mobile) {
|
if (args.mobile) {
|
||||||
val resultIntent = Intent()
|
val resultIntent = Intent()
|
||||||
@ -141,6 +93,45 @@ 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.
|
||||||
|
*
|
||||||
|
* NOTE: maybe args.reading can be removed after changing the nav_graph
|
||||||
|
*/
|
||||||
|
private fun checkIfSkip() {
|
||||||
|
if (args.reading) {
|
||||||
|
goToTheNextFragment()
|
||||||
|
} else if (viewModel.userPin.length in 4..12) {
|
||||||
|
goToTheNextFragment()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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())
|
||||||
|
goToTheStart()
|
||||||
|
} else {
|
||||||
|
if (saveToggle) {
|
||||||
|
viewModel.storePin(requireContext())
|
||||||
|
}
|
||||||
|
goToTheNextFragment()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(requireContext(), getString(R.string.length_pin), Toast.LENGTH_SHORT)
|
||||||
|
.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
binding = null
|
binding = null
|
||||||
|
@ -4,82 +4,57 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="24dp"
|
android:padding="@dimen/padding"
|
||||||
tools:context=".CanFragment">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<TextView
|
||||||
android:id="@+id/card_view"
|
android:id="@+id/title_text"
|
||||||
|
android:text="@string/can_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:textSize="@dimen/headline_text"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:layout_margin="@dimen/margin_big"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
app:strokeWidth="1dp"
|
|
||||||
app:strokeColor="@color/stroke_color"
|
|
||||||
app:cardElevation="0dp">
|
|
||||||
|
|
||||||
<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/hint"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/title_text"
|
||||||
|
app:helperTextEnabled="true"
|
||||||
|
app:helperText="@string/helper"
|
||||||
|
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_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:textSize="@dimen/regular_text"
|
||||||
android:padding="20sp">
|
android:fontFamily="sans-serif"
|
||||||
|
android:inputType="number"
|
||||||
|
android:singleLine="true"
|
||||||
|
/>
|
||||||
|
|
||||||
<TextView
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
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>
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/next_button"
|
android:id="@+id/button_cancel"
|
||||||
|
android:text="@string/button_cancel"
|
||||||
|
android:textSize="@dimen/regular_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_margin="@dimen/margin_big"
|
||||||
android:text="@string/next_text"
|
android:fontFamily="sans-serif"
|
||||||
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"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
app:layout_constraintTop_toBottomOf="@id/canTextField" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -4,81 +4,116 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="24dp"
|
android:padding="@dimen/padding"
|
||||||
tools:context=".PinFragment">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<TextView
|
||||||
android:id="@+id/card_view"
|
android:id="@+id/title_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="@dimen/margin_big"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:fontFamily="sans-serif"
|
||||||
|
android:text="@string/pin_view"
|
||||||
|
android:textSize="@dimen/headline_text"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
app:strokeWidth="1dp"
|
|
||||||
app:strokeColor="@color/stroke_color"
|
|
||||||
app:cardElevation="0dp">
|
|
||||||
|
|
||||||
<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/helper_pin"
|
||||||
|
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_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:fontFamily="sans-serif"
|
||||||
android:padding="20dp">
|
android:inputType="numberPassword"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textSize="@dimen/regular_text" />
|
||||||
|
|
||||||
<TextView
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
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
|
<TextView
|
||||||
android:id="@+id/pin_edit_text"
|
android:id="@+id/save_pin_question"
|
||||||
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"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_margin="@dimen/margin_big"
|
||||||
android:text="@string/next_text"
|
android:paddingTop="@dimen/padding"
|
||||||
android:textSize="15sp"
|
android:fontFamily="sans-serif"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:text="@string/save_pin"
|
||||||
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
android:textSize="@dimen/regular_text"
|
||||||
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"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
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_cancel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/margin_big"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:text="@string/button_cancel"
|
||||||
|
android:textSize="@dimen/regular_text"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/button_continue"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="spread"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/save_layout" />
|
||||||
|
|
||||||
|
<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_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/button_cancel"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/save_layout" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -75,4 +75,20 @@
|
|||||||
<string name="hidden_pin">****</string>
|
<string name="hidden_pin">****</string>
|
||||||
<string name="unavailable">Settings currently unavailabe</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="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>
|
||||||
|
|
||||||
|
<!-- TEMPORARY SOLUTION -->
|
||||||
|
<string name="can_view">Please enter CAN</string>
|
||||||
|
<string name="hint">CAN</string>
|
||||||
|
<string name="button_cancel">Cancel</string>
|
||||||
|
<string name="helper">CAN must be 6 digits long</string>
|
||||||
|
<string name="can_saved">CAN saved</string>
|
||||||
|
<string name="action_undo">UNDO</string>
|
||||||
|
<string name="pin_view">Please enter PIN 1</string>
|
||||||
|
<string name="hint_pin">PIN 1</string>
|
||||||
|
<string name="helper_pin">PIN 1 must be 4–12 digits long</string>
|
||||||
|
<string name="save_pin">Save PIN 1</string>
|
||||||
|
<string name="pin_saved">PIN saved</string>
|
||||||
|
<string name="pin_save_on">On</string>
|
||||||
|
<string name="pin_save_off">Off</string>
|
||||||
|
<string name="continue_button">CONTINUE</string>
|
||||||
</resources>
|
</resources>
|
@ -73,4 +73,20 @@
|
|||||||
<string name="hide">PEIDA</string>
|
<string name="hide">PEIDA</string>
|
||||||
<string name="hidden_pin">****</string>
|
<string name="hidden_pin">****</string>
|
||||||
<string name="unavailable">Seaded pole hetkel saadaval</string>
|
<string name="unavailable">Seaded pole hetkel saadaval</string>
|
||||||
|
|
||||||
|
<!-- TEMPORARY SOLUTION -->
|
||||||
|
<string name="can_view">Please enter CAN</string>
|
||||||
|
<string name="hint">CAN</string>
|
||||||
|
<string name="button_cancel">Cancel</string>
|
||||||
|
<string name="helper">CAN must be 6 digits long</string>
|
||||||
|
<string name="can_saved">CAN saved</string>
|
||||||
|
<string name="action_undo">UNDO</string>
|
||||||
|
<string name="pin_view">Please enter PIN 1</string>
|
||||||
|
<string name="hint_pin">PIN 1</string>
|
||||||
|
<string name="helper_pin">PIN 1 must be 4–12 digits long</string>
|
||||||
|
<string name="save_pin">Save PIN 1</string>
|
||||||
|
<string name="pin_saved">PIN saved</string>
|
||||||
|
<string name="pin_save_on">On</string>
|
||||||
|
<string name="pin_save_off">Off</string>
|
||||||
|
<string name="continue_button">CONTINUE</string>
|
||||||
</resources>
|
</resources>
|
@ -8,9 +8,9 @@
|
|||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
|
||||||
<color name="blue_200">#90caf9</color>
|
<color name="blue_200">#d1d9ff</color>
|
||||||
<color name="blue_500">#2196f3</color>
|
<color name="blue_500">#002984</color>
|
||||||
<color name="blue_700">#1976d2</color>
|
<color name="blue_700">#001970</color>
|
||||||
<color name="orange_200">#ffcc80</color>
|
<color name="orange_200">#ffab91</color>
|
||||||
<color name="orange_700">#f57c00</color>
|
<color name="orange_700">#f57c00</color>
|
||||||
</resources>
|
</resources>
|
@ -73,4 +73,20 @@
|
|||||||
<string name="hide">HIDE</string>
|
<string name="hide">HIDE</string>
|
||||||
<string name="hidden_pin">****</string>
|
<string name="hidden_pin">****</string>
|
||||||
<string name="unavailable">Settings currently unavailable</string>
|
<string name="unavailable">Settings currently unavailable</string>
|
||||||
|
|
||||||
|
<!-- TEMPORARY SOLUTION -->
|
||||||
|
<string name="can_view">Please enter CAN</string>
|
||||||
|
<string name="hint">CAN</string>
|
||||||
|
<string name="button_cancel">Cancel</string>
|
||||||
|
<string name="helper">CAN must be 6 digits long</string>
|
||||||
|
<string name="can_saved">CAN saved</string>
|
||||||
|
<string name="action_undo">UNDO</string>
|
||||||
|
<string name="pin_view">Please enter PIN 1</string>
|
||||||
|
<string name="hint_pin">PIN 1</string>
|
||||||
|
<string name="helper_pin">PIN 1 must be 4–12 digits long</string>
|
||||||
|
<string name="save_pin">Save PIN 1</string>
|
||||||
|
<string name="pin_saved">PIN saved</string>
|
||||||
|
<string name="pin_save_on">On</string>
|
||||||
|
<string name="pin_save_off">Off</string>
|
||||||
|
<string name="continue_button">CONTINUE</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user