mirror of
https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC.git
synced 2024-12-22 12:30:16 +02:00
MOB-12 MOB-14 MOB-35 MOB-36 base for creating views and navigation created
This commit is contained in:
parent
8c4b7b613e
commit
5e92403b93
4
MobileAuthApp/.idea/misc.xml
generated
4
MobileAuthApp/.idea/misc.xml
generated
@ -4,7 +4,11 @@
|
|||||||
<option name="filePathToZoomLevelMap">
|
<option name="filePathToZoomLevelMap">
|
||||||
<map>
|
<map>
|
||||||
<entry key="..\:/Users/henri/Desktop/Tarkvaraprojekt/Estonian-ID-card-mobile-authenticator-POC/MobileAuthApp/app/src/main/res/layout/activity_main.xml" value="0.17300724637681159" />
|
<entry key="..\:/Users/henri/Desktop/Tarkvaraprojekt/Estonian-ID-card-mobile-authenticator-POC/MobileAuthApp/app/src/main/res/layout/activity_main.xml" value="0.17300724637681159" />
|
||||||
|
<entry key="..\:/Users/henri/Desktop/Tarkvaraprojekt/Estonian-ID-card-mobile-authenticator-POC/MobileAuthApp/app/src/main/res/layout/fragment_auth.xml" value="0.1598731884057971" />
|
||||||
|
<entry key="..\:/Users/henri/Desktop/Tarkvaraprojekt/Estonian-ID-card-mobile-authenticator-POC/MobileAuthApp/app/src/main/res/layout/fragment_can.xml" value="0.1598731884057971" />
|
||||||
<entry key="..\:/Users/henri/Desktop/Tarkvaraprojekt/Estonian-ID-card-mobile-authenticator-POC/MobileAuthApp/app/src/main/res/layout/fragment_home.xml" value="0.17300724637681159" />
|
<entry key="..\:/Users/henri/Desktop/Tarkvaraprojekt/Estonian-ID-card-mobile-authenticator-POC/MobileAuthApp/app/src/main/res/layout/fragment_home.xml" value="0.17300724637681159" />
|
||||||
|
<entry key="..\:/Users/henri/Desktop/Tarkvaraprojekt/Estonian-ID-card-mobile-authenticator-POC/MobileAuthApp/app/src/main/res/layout/fragment_pin.xml" value="0.1598731884057971" />
|
||||||
|
<entry key="..\:/Users/henri/Desktop/Tarkvaraprojekt/Estonian-ID-card-mobile-authenticator-POC/MobileAuthApp/app/src/main/res/layout/fragment_user.xml" value="0.1598731884057971" />
|
||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
@ -36,7 +36,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
def lifecycle_version = "2.3.1"
|
||||||
implementation 'androidx.core:core-ktx:1.6.0'
|
implementation 'androidx.core:core-ktx:1.6.0'
|
||||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||||
implementation 'com.google.android.material:material:1.4.0'
|
implementation 'com.google.android.material:material:1.4.0'
|
||||||
@ -46,7 +46,13 @@ dependencies {
|
|||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
|
|
||||||
|
//To use activityViewModels
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
|
||||||
//For navigation component
|
//For navigation component
|
||||||
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
|
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
|
||||||
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
|
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
|
||||||
|
|
||||||
|
//ViewModel
|
||||||
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
||||||
}
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.tarkvaraprojekt.mobileauthapp
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
|
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentAuthBinding
|
||||||
|
import com.tarkvaraprojekt.mobileauthapp.model.SmartCardViewModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragment that asks the user to detect the ID card with mobile NFC chip.
|
||||||
|
* Currently contains a next button that won't be needed later on.
|
||||||
|
* This button is just needed to test navigation between fragments so that every step exists.
|
||||||
|
*/
|
||||||
|
class AuthFragment : Fragment() {
|
||||||
|
|
||||||
|
private val viewModel: SmartCardViewModel by activityViewModels()
|
||||||
|
|
||||||
|
private var binding: FragmentAuthBinding? = null
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
|
binding = FragmentAuthBinding.inflate(inflater, container, false)
|
||||||
|
return binding!!.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
binding!!.nextButton.setOnClickListener { goToNextFragment() }
|
||||||
|
binding!!.cancelButton.setOnClickListener { goToTheStart() }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun goToNextFragment() {
|
||||||
|
//Dummy data for now
|
||||||
|
viewModel.setUserFirstName("John")
|
||||||
|
viewModel.setUserLastName("Doe")
|
||||||
|
viewModel.setUserIdentificationNumber("012345678910")
|
||||||
|
findNavController().navigate(R.id.action_authFragment_to_userFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun goToTheStart() {
|
||||||
|
viewModel.clearUserInfo()
|
||||||
|
findNavController().navigate(R.id.action_authFragment_to_homeFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
binding = null
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.tarkvaraprojekt.mobileauthapp
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
|
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentCanBinding
|
||||||
|
import com.tarkvaraprojekt.mobileauthapp.model.SmartCardViewModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragment that deals with asking the user for six digit CAN
|
||||||
|
*/
|
||||||
|
class CanFragment : Fragment() {
|
||||||
|
|
||||||
|
private val viewModel: SmartCardViewModel by activityViewModels()
|
||||||
|
|
||||||
|
private var binding: FragmentCanBinding? = null
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
|
binding = FragmentCanBinding.inflate(inflater, container, false)
|
||||||
|
return binding!!.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
binding!!.nextButton.setOnClickListener { goToNextFragment() }
|
||||||
|
binding!!.cancelButton.setOnClickListener { goToTheStart() }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun goToNextFragment() {
|
||||||
|
viewModel.setUserCan(
|
||||||
|
binding!!.canEditText.text.toString()
|
||||||
|
)
|
||||||
|
findNavController().navigate(R.id.action_canFragment_to_authFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun goToTheStart() {
|
||||||
|
viewModel.clearUserInfo()
|
||||||
|
findNavController().navigate(R.id.action_canFragment_to_homeFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
binding = null
|
||||||
|
}
|
||||||
|
}
|
@ -5,10 +5,15 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentHomeBinding
|
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentHomeBinding
|
||||||
|
import com.tarkvaraprojekt.mobileauthapp.model.SmartCardViewModel
|
||||||
|
|
||||||
class HomeFragment : Fragment() {
|
class HomeFragment : Fragment() {
|
||||||
|
|
||||||
|
private val viewModel: SmartCardViewModel by activityViewModels()
|
||||||
|
|
||||||
private var binding: FragmentHomeBinding? = null
|
private var binding: FragmentHomeBinding? = null
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
@ -20,6 +25,16 @@ class HomeFragment : Fragment() {
|
|||||||
return binding!!.root
|
return binding!!.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
binding!!.beginButton.setOnClickListener { goToNextFragment() }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun goToNextFragment() {
|
||||||
|
findNavController().navigate(R.id.action_homeFragment_to_pinFragment)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
binding = null
|
binding = null
|
||||||
|
@ -18,4 +18,5 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
|
val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
|
||||||
navigationController = navHostFragment.navController
|
navigationController = navHostFragment.navController
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.tarkvaraprojekt.mobileauthapp
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
|
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentPinBinding
|
||||||
|
import com.tarkvaraprojekt.mobileauthapp.model.SmartCardViewModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragment that deals with asking the user for PIN1
|
||||||
|
*/
|
||||||
|
class PinFragment : Fragment() {
|
||||||
|
|
||||||
|
private val viewModel: SmartCardViewModel by activityViewModels()
|
||||||
|
|
||||||
|
private var binding: FragmentPinBinding? = null
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
|
binding = FragmentPinBinding.inflate(inflater, container, false)
|
||||||
|
return binding!!.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
binding!!.nextButton.setOnClickListener { goToNextFragment() }
|
||||||
|
binding!!.cancelButton.setOnClickListener { goToTheStart() }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun goToNextFragment() {
|
||||||
|
viewModel.setUserPin(
|
||||||
|
binding!!.pinEditText.text.toString()
|
||||||
|
)
|
||||||
|
findNavController().navigate(R.id.action_pinFragment_to_canFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun goToTheStart() {
|
||||||
|
viewModel.clearUserInfo()
|
||||||
|
findNavController().navigate(R.id.action_pinFragment_to_homeFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
binding = null
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.tarkvaraprojekt.mobileauthapp
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
|
import com.tarkvaraprojekt.mobileauthapp.databinding.FragmentUserBinding
|
||||||
|
import com.tarkvaraprojekt.mobileauthapp.model.SmartCardViewModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragment that is used to display the persons name and national identification number.
|
||||||
|
* Currently needed in order to test that the app is working because the results at the moment
|
||||||
|
* are not sent to some other website or app.
|
||||||
|
*/
|
||||||
|
class UserFragment : Fragment() {
|
||||||
|
|
||||||
|
private val TAG = UserFragment::class.java.name
|
||||||
|
|
||||||
|
private val viewModel: SmartCardViewModel by activityViewModels()
|
||||||
|
|
||||||
|
private var binding: FragmentUserBinding? = null
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View? {
|
||||||
|
binding = FragmentUserBinding.inflate(inflater, container, false)
|
||||||
|
return binding!!.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
binding!!.firstName.text = getString(R.string.info_text, "First name", viewModel.userFirstName)
|
||||||
|
binding!!.lastName.text = getString(R.string.info_text, "Last name", viewModel.userLastName)
|
||||||
|
binding!!.identificationNumber.text = getString(R.string.info_text, "Idenfitication number", viewModel.userIdentificationNumber)
|
||||||
|
binding!!.clearButton.setOnClickListener { goToTheStart() }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun goToTheStart() {
|
||||||
|
viewModel.clearUserInfo()
|
||||||
|
Log.i(TAG, "First name value after clearUserInfo ${viewModel.userFirstName}")
|
||||||
|
findNavController().navigate(R.id.action_userFragment_to_homeFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
binding = null
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.tarkvaraprojekt.mobileauthapp.model
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
|
||||||
|
class SmartCardViewModel: ViewModel() {
|
||||||
|
|
||||||
|
private var _userPin: String = ""
|
||||||
|
val userPin get() = _userPin
|
||||||
|
|
||||||
|
private var _userCan: String = ""
|
||||||
|
val userCan get() = _userCan
|
||||||
|
|
||||||
|
private var _userFirstName: String = ""
|
||||||
|
val userFirstName get() = _userFirstName
|
||||||
|
|
||||||
|
private var _userLastName: String = ""
|
||||||
|
val userLastName get() = _userLastName
|
||||||
|
|
||||||
|
private var _userIdentificationNumber: String = ""
|
||||||
|
val userIdentificationNumber get() = _userIdentificationNumber
|
||||||
|
|
||||||
|
fun clearUserInfo() {
|
||||||
|
_userPin = ""
|
||||||
|
_userCan = ""
|
||||||
|
_userFirstName = ""
|
||||||
|
_userLastName = ""
|
||||||
|
_userIdentificationNumber = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setUserPin(newUserPin: String) {
|
||||||
|
_userPin = newUserPin
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setUserCan(newUserCan: String) {
|
||||||
|
_userCan = newUserCan
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setUserFirstName(newUserFirstName: String) {
|
||||||
|
_userFirstName = newUserFirstName
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setUserLastName(newUserLastName: String) {
|
||||||
|
_userLastName = newUserLastName
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setUserIdentificationNumber(newUserIdentificationNumber: String) {
|
||||||
|
_userIdentificationNumber = newUserIdentificationNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
40
MobileAuthApp/app/src/main/res/layout/fragment_auth.xml
Normal file
40
MobileAuthApp/app/src/main/res/layout/fragment_auth.xml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?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"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="24dp"
|
||||||
|
tools:context=".AuthFragment">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/auth_fragment_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/auth_fragment"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<!-- later there will be no button, but the app will continue automatically -->
|
||||||
|
<Button
|
||||||
|
android:id="@+id/next_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/next_text"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/auth_fragment_text"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/cancel_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/cancel_text"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/auth_fragment_text"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/next_button"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
49
MobileAuthApp/app/src/main/res/layout/fragment_can.xml
Normal file
49
MobileAuthApp/app/src/main/res/layout/fragment_can.xml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?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"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="24dp"
|
||||||
|
tools:context=".CanFragment">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/can_fragment_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/can_fragment"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/can_edit_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/enter_can"
|
||||||
|
android:inputType="numberPassword"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/can_fragment_text"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/next_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/next_text"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/can_edit_text"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/cancel_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/cancel_text"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/can_edit_text"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/next_button"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,13 +1,30 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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"
|
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"
|
||||||
tools:context=".HomeFragment">
|
tools:context=".HomeFragment">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/home_fragment_text"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:text="@string/home_fragment" />
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/home_fragment"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
</FrameLayout>
|
<!-- Temporary button for testing purposes -->
|
||||||
|
<Button
|
||||||
|
android:id="@+id/begin_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/begin_text"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/home_fragment_text"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
49
MobileAuthApp/app/src/main/res/layout/fragment_pin.xml
Normal file
49
MobileAuthApp/app/src/main/res/layout/fragment_pin.xml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?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"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="24dp"
|
||||||
|
tools:context=".PinFragment">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/pin_fragment_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/pin_fragment"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/pin_edit_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/enter_pin"
|
||||||
|
android:inputType="numberPassword"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/pin_fragment_text"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/next_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/next_text"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/pin_edit_text"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/cancel_button"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/cancel_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/cancel_text"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/pin_edit_text"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/next_button"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
70
MobileAuthApp/app/src/main/res/layout/fragment_user.xml
Normal file
70
MobileAuthApp/app/src/main/res/layout/fragment_user.xml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?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"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="24dp"
|
||||||
|
tools:context=".UserFragment">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/user_fragment_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/user_fragment"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/test_info_output"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/test_info"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/user_fragment_text"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/clear_button"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/first_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/info_text"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/test_info_output"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/last_name"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/last_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/info_text"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/first_name"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/identification_number"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/identification_number"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/info_text"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/last_name"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/clear_button"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/clear_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/clear_text"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/identification_number"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -9,5 +9,66 @@
|
|||||||
android:id="@+id/homeFragment"
|
android:id="@+id/homeFragment"
|
||||||
android:name="com.tarkvaraprojekt.mobileauthapp.HomeFragment"
|
android:name="com.tarkvaraprojekt.mobileauthapp.HomeFragment"
|
||||||
android:label="fragment_home"
|
android:label="fragment_home"
|
||||||
tools:layout="@layout/fragment_home" />
|
tools:layout="@layout/fragment_home" >
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_homeFragment_to_pinFragment"
|
||||||
|
app:destination="@id/pinFragment"
|
||||||
|
/>
|
||||||
|
</fragment>
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/pinFragment"
|
||||||
|
android:name="com.tarkvaraprojekt.mobileauthapp.PinFragment"
|
||||||
|
android:label="fragment_pin"
|
||||||
|
tools:layout="@layout/fragment_pin" >
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_pinFragment_to_canFragment"
|
||||||
|
app:destination="@id/canFragment"
|
||||||
|
app:popUpTo="@id/homeFragment" />
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_pinFragment_to_homeFragment"
|
||||||
|
app:destination="@id/homeFragment"
|
||||||
|
app:popUpTo="@id/homeFragment"
|
||||||
|
app:popUpToInclusive="true" />
|
||||||
|
</fragment>
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/canFragment"
|
||||||
|
android:name="com.tarkvaraprojekt.mobileauthapp.CanFragment"
|
||||||
|
android:label="fragment_can"
|
||||||
|
tools:layout="@layout/fragment_can" >
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_canFragment_to_authFragment"
|
||||||
|
app:destination="@id/authFragment"
|
||||||
|
app:popUpTo="@id/homeFragment"/>
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_canFragment_to_homeFragment"
|
||||||
|
app:destination="@id/homeFragment"
|
||||||
|
app:popUpTo="@id/homeFragment"
|
||||||
|
app:popUpToInclusive="true" />
|
||||||
|
</fragment>
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/authFragment"
|
||||||
|
android:name="com.tarkvaraprojekt.mobileauthapp.AuthFragment"
|
||||||
|
android:label="fragment_auth"
|
||||||
|
tools:layout="@layout/fragment_auth" >
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_authFragment_to_userFragment"
|
||||||
|
app:destination="@id/userFragment"
|
||||||
|
app:popUpTo="@id/homeFragment"/>
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_authFragment_to_homeFragment"
|
||||||
|
app:destination="@id/homeFragment"
|
||||||
|
app:popUpTo="@id/homeFragment"
|
||||||
|
app:popUpToInclusive="true" />
|
||||||
|
</fragment>
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/userFragment"
|
||||||
|
android:name="com.tarkvaraprojekt.mobileauthapp.UserFragment"
|
||||||
|
android:label="fragment_user"
|
||||||
|
tools:layout="@layout/fragment_user" >
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_userFragment_to_homeFragment"
|
||||||
|
app:destination="@id/homeFragment"
|
||||||
|
app:popUpTo="@id/homeFragment"
|
||||||
|
app:popUpToInclusive="true"/>
|
||||||
|
</fragment>
|
||||||
</navigation>
|
</navigation>
|
@ -2,12 +2,12 @@
|
|||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.MobileAuthApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.MobileAuthApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_200</item>
|
<item name="colorPrimary">@color/blue_200</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/blue_700</item>
|
||||||
<item name="colorOnPrimary">@color/black</item>
|
<item name="colorOnPrimary">@color/black</item>
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color. -->
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
<item name="colorSecondary">@color/orange_200</item>
|
||||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
<item name="colorSecondaryVariant">@color/orange_200</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color. -->
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||||
|
@ -7,4 +7,11 @@
|
|||||||
<color name="teal_700">#FF018786</color>
|
<color name="teal_700">#FF018786</color>
|
||||||
<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_500">#2196f3</color>
|
||||||
|
<color name="blue_700">#1976d2</color>
|
||||||
|
<color name="orange_200">#ffcc80</color>
|
||||||
|
<color name="orange_700">#f57c00</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -1,5 +1,20 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Mobile Auth App</string>
|
<string name="app_name">Mobile Authenticator</string>
|
||||||
<!-- TODO: Remove or change this placeholder text -->
|
<string name="home_fragment">This is home fragment</string>
|
||||||
<string name="home_fragment">To make sure that fragment is displayed</string>
|
<string name="pin_fragment">This is pin fragment</string>
|
||||||
|
<string name="can_fragment">This is can fragment</string>
|
||||||
|
<string name="auth_fragment">This is auth fragment</string>
|
||||||
|
<string name="user_fragment">This is user fragment</string>
|
||||||
|
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||||
|
|
||||||
|
<string name="begin_text">Begin</string>
|
||||||
|
<string name="next_text">Next</string>
|
||||||
|
<string name="clear_text">Clear</string>
|
||||||
|
<string name="cancel_text">Cancel</string>
|
||||||
|
|
||||||
|
<string name="test_info">Test information</string>
|
||||||
|
<string name="info_text">%1$s: %2$s</string>
|
||||||
|
|
||||||
|
<string name="enter_can">Enter CAN</string>
|
||||||
|
<string name="enter_pin">Enter PIN</string>
|
||||||
</resources>
|
</resources>
|
@ -2,12 +2,12 @@
|
|||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.MobileAuthApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.MobileAuthApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_500</item>
|
<item name="colorPrimary">@color/blue_500</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/blue_700</item>
|
||||||
<item name="colorOnPrimary">@color/white</item>
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color. -->
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
<item name="colorSecondary">@color/orange_200</item>
|
||||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
<item name="colorSecondaryVariant">@color/orange_700</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color. -->
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||||
|
@ -6,6 +6,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
ext {
|
ext {
|
||||||
nav_version = "2.3.1"
|
nav_version = "2.3.1"
|
||||||
|
kotlin_version = "1.4.30"
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.android.tools.build:gradle:7.0.2"
|
classpath "com.android.tools.build:gradle:7.0.2"
|
||||||
|
Loading…
Reference in New Issue
Block a user