From 5064e16cc8cf53729d90d1ef49bce4fbe52425b6 Mon Sep 17 00:00:00 2001 From: Alexandr Alexeenko Date: Tue, 5 Jul 2022 01:29:31 +0300 Subject: [PATCH 01/26] Codestyle: move lambda arguments out of parameters --- .../affinidi_id/core/livedata/SingleLiveEvent.kt | 4 ++-- .../affinidi_id/presentation/MainActivity.kt | 4 ++-- .../credential_details/CredentialDetailsFragment.kt | 8 ++++---- .../credentials_list/CredentialsListFragment.kt | 4 ++-- .../delete_credential/DeleteCredentialFragment.kt | 10 ++++++---- .../issue_credential/IssueCredentialFragment.kt | 8 ++++---- .../affinidi_id/presentation/login/LoginFragment.kt | 4 ++-- .../affinidi_id/presentation/logout/LogoutFragment.kt | 4 ++-- .../presentation/main_menu/MainMenuFragment.kt | 4 ++-- .../presentation/profile/ProfileFragment.kt | 4 ++-- .../profile/edit_password/ChangePasswordFragment.kt | 4 ++-- .../presentation/registration/RegistrationFragment.kt | 8 ++++---- .../ResetPasswordConfirmationFragment.kt | 10 ++++++---- .../reset_password/ResetPasswordSetUsernameFragment.kt | 10 ++++++---- .../share_credential/ShareCredentialFragment.kt | 4 ++-- .../verify_credential_qr/ScannedCredentialFragment.kt | 8 ++++---- 16 files changed, 52 insertions(+), 46 deletions(-) diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/core/livedata/SingleLiveEvent.kt b/app/src/main/java/by/alexandr7035/affinidi_id/core/livedata/SingleLiveEvent.kt index 399f1773..d880a533 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/core/livedata/SingleLiveEvent.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/core/livedata/SingleLiveEvent.kt @@ -17,11 +17,11 @@ class SingleLiveEvent : MutableLiveData() { } // Observe the internal MutableLiveData - super.observe(owner, { t -> + super.observe(owner) { t -> if (pending.compareAndSet(true, false)) { observer.onChanged(t) } - }) + } } @MainThread diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/MainActivity.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/MainActivity.kt index e2334a99..7450cbee 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/MainActivity.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/MainActivity.kt @@ -62,7 +62,7 @@ class MainActivity : AppCompatActivity() { } // navigateSafe method allow us not check current destination - viewModel.getAuthCheckLiveData().observe(this, { authCheckResult -> + viewModel.getAuthCheckLiveData().observe(this) { authCheckResult -> binding.progressView.root.isVisible = false when (authCheckResult) { @@ -108,7 +108,7 @@ class MainActivity : AppCompatActivity() { } } } - }) + } } diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsFragment.kt index 9d05b974..396f4782 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsFragment.kt @@ -56,7 +56,7 @@ class CredentialDetailsFragment : Fragment() { binding.proofRecycler.adapter = proofAdapter binding.proofRecycler.layoutManager = LinearLayoutManager(requireContext()) - viewModel.getCredentialLiveData().observe(viewLifecycleOwner, { credentialData -> + viewModel.getCredentialLiveData().observe(viewLifecycleOwner) { credentialData -> binding.progressView.root.isVisible = false when (credentialData) { @@ -116,13 +116,13 @@ class CredentialDetailsFragment : Fragment() { } } - }) + } // Load credential data load(safeArgs.credentialId) - viewModel.getVerificationLiveData().observe(viewLifecycleOwner, { verificationResult -> + viewModel.getVerificationLiveData().observe(viewLifecycleOwner) { verificationResult -> binding.progressView.root.isVisible = false when (verificationResult) { @@ -154,7 +154,7 @@ class CredentialDetailsFragment : Fragment() { } } } - }) + } } private fun load(credentialId: String) { diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credentials_list/CredentialsListFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credentials_list/CredentialsListFragment.kt index 1f24ab6d..ca584167 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credentials_list/CredentialsListFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credentials_list/CredentialsListFragment.kt @@ -51,7 +51,7 @@ class CredentialsListFragment : Fragment(), CredentialClickListener { } binding.recycler.addItemDecoration(decoration) - viewModel.getCredentialsLiveData().observe(viewLifecycleOwner, { + viewModel.getCredentialsLiveData().observe(viewLifecycleOwner) { // Hide all before state update binding.progressView.root.isVisible = false binding.recycler.isVisible = false @@ -79,7 +79,7 @@ class CredentialsListFragment : Fragment(), CredentialClickListener { binding.errorView.errorText.text = it.errorUi.message } } - }) + } loadData() diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/delete_credential/DeleteCredentialFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/delete_credential/DeleteCredentialFragment.kt index 18a8ace4..7fb50d1b 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/delete_credential/DeleteCredentialFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/delete_credential/DeleteCredentialFragment.kt @@ -33,13 +33,15 @@ class DeleteCredentialFragment : BottomSheetDialogFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - viewModel.getDeleteVcLiveData().observe(viewLifecycleOwner, { result -> + viewModel.getDeleteVcLiveData().observe(viewLifecycleOwner) { result -> binding.progressView.progressView.isVisible = false when (result) { is DeleteVcResModel.Success -> { - findNavController().navigateSafe(DeleteCredentialFragmentDirections - .actionDeleteCredentialFragmentToCredentialsListFragment()) + findNavController().navigateSafe( + DeleteCredentialFragmentDirections + .actionDeleteCredentialFragmentToCredentialsListFragment() + ) } is DeleteVcResModel.Fail -> { when (result.errorType) { @@ -60,7 +62,7 @@ class DeleteCredentialFragment : BottomSheetDialogFragment() { } } - }) + } binding.confirmDeleteBtn.setOnClickListener { binding.progressView.progressView.isVisible = true diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/issue_credential/IssueCredentialFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/issue_credential/IssueCredentialFragment.kt index dd810941..139c22b7 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/issue_credential/IssueCredentialFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/issue_credential/IssueCredentialFragment.kt @@ -57,14 +57,14 @@ class IssueCredentialFragment : Fragment(), CredentialClickListener { } binding.recycler.addItemDecoration(decoration) - viewModel.getAvailableVCsLiveData().observe(viewLifecycleOwner, { + viewModel.getAvailableVCsLiveData().observe(viewLifecycleOwner) { adapter.setItems(it) - }) + } viewModel.loadAvailableVCs() - viewModel.getIssueCredentialLiveData().observe(viewLifecycleOwner, { result -> + viewModel.getIssueCredentialLiveData().observe(viewLifecycleOwner) { result -> binding.progressView.root.isVisible = false when (result) { @@ -101,7 +101,7 @@ class IssueCredentialFragment : Fragment(), CredentialClickListener { } } - }) + } } diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/login/LoginFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/login/LoginFragment.kt index 6de84ca6..b3b2daef 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/login/LoginFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/login/LoginFragment.kt @@ -67,7 +67,7 @@ class LoginFragment : Fragment() { } - viewModel.signInLiveData.observe(viewLifecycleOwner, { response -> + viewModel.signInLiveData.observe(viewLifecycleOwner) { response -> binding.progressView.root.isVisible = false @@ -105,7 +105,7 @@ class LoginFragment : Fragment() { } } } - }) + } val goToSignUpText = getString(R.string.go_to_sign_up) diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/logout/LogoutFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/logout/LogoutFragment.kt index 8f636251..529f5a39 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/logout/LogoutFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/logout/LogoutFragment.kt @@ -31,7 +31,7 @@ class LogoutFragment : BottomSheetDialogFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - viewModel.logOutLiveData.observe(viewLifecycleOwner, { logout -> + viewModel.logOutLiveData.observe(viewLifecycleOwner) { logout -> binding.progressView.root.isVisible = false @@ -57,7 +57,7 @@ class LogoutFragment : BottomSheetDialogFragment() { } } } - }) + } binding.logoutBtn.setOnClickListener { binding.progressView.root.isVisible = true diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/main_menu/MainMenuFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/main_menu/MainMenuFragment.kt index 59fc1e1d..748aa0c1 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/main_menu/MainMenuFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/main_menu/MainMenuFragment.kt @@ -73,12 +73,12 @@ class MainMenuFragment : Fragment() { .build() viewModel.init() - viewModel.userProfileLiveData.observe(viewLifecycleOwner, { profile -> + viewModel.userProfileLiveData.observe(viewLifecycleOwner) { profile -> binding.profileImageView.load( uri = profile.imageUrl, imageLoader = imageLoader ) - }) + } binding.toolbar.setOnMenuItemClickListener { diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/profile/ProfileFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/profile/ProfileFragment.kt index 46e3ad7c..8fee23e3 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/profile/ProfileFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/profile/ProfileFragment.kt @@ -39,7 +39,7 @@ class ProfileFragment : Fragment() { .build() - viewModel.userProfileLiveData.observe(viewLifecycleOwner, { profile -> + viewModel.userProfileLiveData.observe(viewLifecycleOwner) { profile -> binding.userNameView.text = profile.userName // TODO profile ui model val formattedDid = profile.userDid.split(";").first() @@ -49,7 +49,7 @@ class ProfileFragment : Fragment() { uri = profile.imageUrl, imageLoader = imageLoader ) - }) + } viewModel.init() diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/profile/edit_password/ChangePasswordFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/profile/edit_password/ChangePasswordFragment.kt index 16c14893..4e9e590a 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/profile/edit_password/ChangePasswordFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/profile/edit_password/ChangePasswordFragment.kt @@ -65,7 +65,7 @@ class ChangePasswordFragment : Fragment() { } } - viewModel.changePasswordLiveData.observe(viewLifecycleOwner, { result -> + viewModel.changePasswordLiveData.observe(viewLifecycleOwner) { result -> binding.progressView.root.isVisible = false when (result) { @@ -98,7 +98,7 @@ class ChangePasswordFragment : Fragment() { } } } - }) + } } private fun chekIfFormIsValid(): Boolean { diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/registration/RegistrationFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/registration/RegistrationFragment.kt index 8c3dff80..bd1e2d95 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/registration/RegistrationFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/registration/RegistrationFragment.kt @@ -55,7 +55,7 @@ class RegistrationFragment : Fragment() { } - viewModel.signUpLiveData.observe(viewLifecycleOwner, { signUpResult -> + viewModel.signUpLiveData.observe(viewLifecycleOwner) { signUpResult -> when (signUpResult) { is SignUpResponseModel.Success -> { @@ -89,7 +89,7 @@ class RegistrationFragment : Fragment() { } } } - }) + } binding.userNameEditText.doOnTextChanged { text, start, before, count -> @@ -127,7 +127,7 @@ class RegistrationFragment : Fragment() { } - viewModel.signUpConfirmationLiveData.observe(viewLifecycleOwner, { signUpConfirmationResult -> + viewModel.signUpConfirmationLiveData.observe(viewLifecycleOwner) { signUpConfirmationResult -> when (signUpConfirmationResult) { is ConfirmSignUpResponseModel.Success -> { @@ -165,7 +165,7 @@ class RegistrationFragment : Fragment() { } } } - }) + } } private fun chekIfFormIsValid(): Boolean { diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/reset_password/ResetPasswordConfirmationFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/reset_password/ResetPasswordConfirmationFragment.kt index e0c75566..aec82ff0 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/reset_password/ResetPasswordConfirmationFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/reset_password/ResetPasswordConfirmationFragment.kt @@ -55,13 +55,15 @@ class ResetPasswordConfirmationFragment : Fragment() { } - viewModel.confirmPasswordResetLiveData.observe(viewLifecycleOwner, { result -> + viewModel.confirmPasswordResetLiveData.observe(viewLifecycleOwner) { result -> binding.progressView.root.isVisible = false when (result) { is ConfirmPasswordResetResponseModel.Success -> { - findNavController().navigateSafe(ResetPasswordConfirmationFragmentDirections - .actionGlobalLoginFragment()) + findNavController().navigateSafe( + ResetPasswordConfirmationFragmentDirections + .actionGlobalLoginFragment() + ) binding.root.showSnackBar( message = getString(R.string.password_changed_successfully), @@ -92,7 +94,7 @@ class ResetPasswordConfirmationFragment : Fragment() { } } } - }) + } binding.toolbar.setNavigationOnClickListener { findNavController().navigateUp() diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/reset_password/ResetPasswordSetUsernameFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/reset_password/ResetPasswordSetUsernameFragment.kt index 101bd040..b8478683 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/reset_password/ResetPasswordSetUsernameFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/reset_password/ResetPasswordSetUsernameFragment.kt @@ -54,13 +54,15 @@ class ResetPasswordSetUsernameFragment : Fragment() { } } - viewModel.initializePasswordResetLiveData.observe(viewLifecycleOwner, { result -> + viewModel.initializePasswordResetLiveData.observe(viewLifecycleOwner) { result -> binding.progressView.root.isVisible = false when (result) { is InitializePasswordResetResponseModel.Success -> { - findNavController().navigateSafe(ResetPasswordSetUsernameFragmentDirections - .actionResetPasswordSetUsernameFragmentToResetPasswordSetPasswordFragment(result.userName)) + findNavController().navigateSafe( + ResetPasswordSetUsernameFragmentDirections + .actionResetPasswordSetUsernameFragmentToResetPasswordSetPasswordFragment(result.userName) + ) } is InitializePasswordResetResponseModel.Fail -> { @@ -84,7 +86,7 @@ class ResetPasswordSetUsernameFragment : Fragment() { } } } - }) + } } private fun chekIfFormIsValid(): Boolean { diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/share_credential/ShareCredentialFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/share_credential/ShareCredentialFragment.kt index b2ac3da7..305b4385 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/share_credential/ShareCredentialFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/share_credential/ShareCredentialFragment.kt @@ -36,7 +36,7 @@ class ShareCredentialFragment : BottomSheetDialogFragment() { binding.progressView.root.isVisible = true - viewModel.getShareCredentialLiveData().observe(viewLifecycleOwner, { + viewModel.getShareCredentialLiveData().observe(viewLifecycleOwner) { binding.progressView.root.isVisible = false when (it) { @@ -64,7 +64,7 @@ class ShareCredentialFragment : BottomSheetDialogFragment() { } } - }) + } viewModel.load(safeArgs.credentialId) } diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/verify_credential_qr/ScannedCredentialFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/verify_credential_qr/ScannedCredentialFragment.kt index 7342c3fb..966be939 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/verify_credential_qr/ScannedCredentialFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/verify_credential_qr/ScannedCredentialFragment.kt @@ -56,7 +56,7 @@ class ScannedCredentialFragment : Fragment() { binding.proofRecycler.adapter = proofAdapter binding.proofRecycler.layoutManager = LinearLayoutManager(requireContext()) - viewModel.getCredentialLiveData().observe(viewLifecycleOwner, { credentialData -> + viewModel.getCredentialLiveData().observe(viewLifecycleOwner) { credentialData -> binding.progressView.root.isVisible = false when (credentialData) { @@ -87,9 +87,9 @@ class ScannedCredentialFragment : Fragment() { findNavController().navigateUp() } } - }) + } - viewModel.getVerificationLiveData().observe(viewLifecycleOwner, { verificationResult -> + viewModel.getVerificationLiveData().observe(viewLifecycleOwner) { verificationResult -> binding.progressView.root.isVisible = false when (verificationResult) { @@ -121,7 +121,7 @@ class ScannedCredentialFragment : Fragment() { } } } - }) + } // Load credential from QR code binding.progressView.root.isVisible = true From 486baa305b1844acf15df398549319db9860859c Mon Sep 17 00:00:00 2001 From: Alexandr Alexeenko Date: Tue, 5 Jul 2022 01:37:42 +0300 Subject: [PATCH 02/26] Update app version + gradle plugin --- app/build.gradle | 4 ++-- build.gradle | 4 ++-- data/build.gradle | 2 -- gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3acca943..a2b34df9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,8 +26,8 @@ android { applicationId "by.alexandr7035.affinidi_id" minSdk 21 targetSdk 31 - versionCode 500 - versionName "3.0" + versionCode 600 + versionName "4.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/build.gradle b/build.gradle index 573c6796..1f91277e 100644 --- a/build.gradle +++ b/build.gradle @@ -5,12 +5,12 @@ buildscript { mavenCentral() } dependencies { - classpath "com.android.tools.build:gradle:7.0.4" + classpath 'com.android.tools.build:gradle:7.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31" classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1' - def nav_version = "2.3.5" + def nav_version = '2.4.1' classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/data/build.gradle b/data/build.gradle index a4f2214e..3032982d 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -10,8 +10,6 @@ android { defaultConfig { minSdk 21 targetSdk 31 - versionCode 1 - versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 64e14b10..0de9a10f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Dec 14 22:35:19 MSK 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME From d69f7ffa8c87db158acb2f5f1c4cb9b6a6ef7137 Mon Sep 17 00:00:00 2001 From: Alexandr Alexeenko Date: Tue, 5 Jul 2022 01:42:01 +0300 Subject: [PATCH 03/26] Update dependencies --- app/build.gradle | 18 +++++++++--------- build.gradle | 2 +- data/build.gradle | 8 ++++---- domain/build.gradle | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a2b34df9..bdbd18c5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -62,10 +62,10 @@ dependencies { implementation project(path:":domain") implementation project(path: ":data") - implementation 'androidx.core:core-ktx:1.7.0' - implementation 'androidx.appcompat:appcompat:1.4.1' - implementation 'com.google.android.material:material:1.5.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.3' + implementation 'androidx.core:core-ktx:1.8.0' + implementation 'androidx.appcompat:appcompat:1.4.2' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.legacy:legacy-support-v4:1.0.0' testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' @@ -81,21 +81,21 @@ dependencies { // Retrofit implementation "com.squareup.retrofit2:retrofit:2.9.0" implementation 'com.squareup.retrofit2:converter-gson:2.9.0' - implementation "com.squareup.okhttp3:logging-interceptor:4.9.1" + implementation "com.squareup.okhttp3:logging-interceptor:4.9.3" // Room - def room_version = "2.4.1" + def room_version = "2.4.2" implementation "androidx.room:room-runtime:$room_version" kapt "androidx.room:room-compiler:$room_version" implementation "androidx.room:room-ktx:$room_version" // Navigation - def nav_version = "2.4.1" + def nav_version = "2.5.0" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" // ViewBinding delegate - def viewbindingdelegate_version = "1.5.3" + def viewbindingdelegate_version = "1.5.6" implementation "com.github.kirich1409:viewbindingpropertydelegate-noreflection:$viewbindingdelegate_version" // Coil @@ -109,5 +109,5 @@ dependencies { implementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false } implementation 'com.google.zxing:core:3.3.0' - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1") } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1f91277e..77e99500 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:7.1.3' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21" classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1' diff --git a/data/build.gradle b/data/build.gradle index 3032982d..d1367ab2 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -40,16 +40,16 @@ dependencies { // Retrofit implementation "com.squareup.retrofit2:retrofit:2.9.0" implementation 'com.squareup.retrofit2:converter-gson:2.9.0' - implementation "com.squareup.okhttp3:logging-interceptor:4.9.1" + implementation "com.squareup.okhttp3:logging-interceptor:4.9.3" - implementation 'androidx.core:core-ktx:1.7.0' + implementation 'androidx.core:core-ktx:1.8.0' testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1") - def room_version = "2.4.1" + def room_version = "2.4.2" implementation "androidx.room:room-runtime:$room_version" kapt "androidx.room:room-compiler:$room_version" implementation "androidx.room:room-ktx:$room_version" diff --git a/domain/build.gradle b/domain/build.gradle index 0def8d53..0b97e323 100644 --- a/domain/build.gradle +++ b/domain/build.gradle @@ -10,5 +10,5 @@ java { dependencies { implementation "javax.inject:javax.inject:1" - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1") } \ No newline at end of file From 189277f3cc5e13ec5887860f68636e8f5f04bd8c Mon Sep 17 00:00:00 2001 From: Alexandr Alexeenko Date: Tue, 5 Jul 2022 22:39:55 +0300 Subject: [PATCH 04/26] Feature #63: copy VC fields on click --- .../credential_details/CredentialDataAdapter.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDataAdapter.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDataAdapter.kt index 7f7b3da0..b817c92c 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDataAdapter.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDataAdapter.kt @@ -5,9 +5,14 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import androidx.viewbinding.ViewBinding +import by.alexandr7035.affinidi_id.core.extensions.copyToClipboard +import by.alexandr7035.affinidi_id.core.extensions.showSnackBar +import by.alexandr7035.affinidi_id.core.extensions.showToast import by.alexandr7035.affinidi_id.databinding.ViewVcDetailFieldBinding import by.alexandr7035.affinidi_id.databinding.ViewVcDetailTitleOnlyBinding +import by.alexandr7035.affinidi_id.presentation.common.SnackBarMode import by.alexandr7035.affinidi_id.presentation.common.credentials.CredentialDataItem +import com.google.android.material.snackbar.Snackbar class CredentialDataAdapter : RecyclerView.Adapter() { @@ -72,6 +77,13 @@ class CredentialDataAdapter : RecyclerView.Adapter Date: Tue, 5 Jul 2022 23:54:17 +0300 Subject: [PATCH 05/26] Feature #104: add tablayout to credentials list --- app/src/main/res/drawable/bg_tab.xml | 19 +++++++++ .../res/layout/fragment_credentials_list.xml | 42 +++++++++++++++++-- app/src/main/res/values/dimens.xml | 3 ++ app/src/main/res/values/strings.xml | 3 ++ app/src/main/res/values/styles_core.xml | 19 +++++++++ 5 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 app/src/main/res/drawable/bg_tab.xml diff --git a/app/src/main/res/drawable/bg_tab.xml b/app/src/main/res/drawable/bg_tab.xml new file mode 100644 index 00000000..e69e8219 --- /dev/null +++ b/app/src/main/res/drawable/bg_tab.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_credentials_list.xml b/app/src/main/res/layout/fragment_credentials_list.xml index d96ea68d..7c76eae2 100644 --- a/app/src/main/res/layout/fragment_credentials_list.xml +++ b/app/src/main/res/layout/fragment_credentials_list.xml @@ -15,16 +15,49 @@ app:layout_constraintTop_toTopOf="parent" app:title="Your credentials" /> + + + + + + + + + + + + app:layout_constraintTop_toBottomOf="@id/toolbar" + tools:visibility="gone"/> + tools:visibility="gone" /> + tools:visibility="gone"/> \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index d51d9af1..ac0aca1d 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -61,4 +61,7 @@ 12dp 160dp + 12dp + 32dp + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 41aa6007..51a8e3f9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -103,5 +103,8 @@ Open app settings Scan the QR code of verifiable credential Failed to obtain credential. Please, ensure your are scanning the right QR code. Also check your internet connection + All + Cloud + Local \ No newline at end of file diff --git a/app/src/main/res/values/styles_core.xml b/app/src/main/res/values/styles_core.xml index c665507f..fd3eae94 100644 --- a/app/src/main/res/values/styles_core.xml +++ b/app/src/main/res/values/styles_core.xml @@ -86,4 +86,23 @@ @color/color_bottom_nav_icon @drawable/background_bottom_navigation + + + + + + \ No newline at end of file From 8b2e3ee785877f96a7a0020fe50a108bfb9cc63f Mon Sep 17 00:00:00 2001 From: Alexandr Alexeenko Date: Wed, 6 Jul 2022 00:24:08 +0300 Subject: [PATCH 06/26] Feature #104: remove ids from tabs as it causes crashes --- app/src/main/res/layout/fragment_credentials_list.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/src/main/res/layout/fragment_credentials_list.xml b/app/src/main/res/layout/fragment_credentials_list.xml index 7c76eae2..2009022b 100644 --- a/app/src/main/res/layout/fragment_credentials_list.xml +++ b/app/src/main/res/layout/fragment_credentials_list.xml @@ -27,19 +27,16 @@ app:layout_constraintEnd_toEndOf="parent"> From fd211b095c2ff1304f1a1a8a3788299dcd3e1e2f Mon Sep 17 00:00:00 2001 From: Alexandr Alexeenko Date: Thu, 7 Jul 2022 00:46:37 +0300 Subject: [PATCH 07/26] Feature #107: create viewpager and use shared viewmodel inside --- .../CredentialDetailsFragment.kt | 189 +++++++----- .../CredentialDetailsViewModel.kt | 6 + .../CredentialViewPagerAdapter.kt | 31 ++ .../claims/CredentialClaimsFragment.kt | 40 +++ .../more_info/CredentialMoreInfoFragment.kt | 39 +++ .../res/layout/fragment_credential_claims.xml | 9 + .../layout/fragment_credential_details.xml | 275 ++++++++++-------- .../layout/fragment_credential_more_info.xml | 9 + app/src/main/res/values/strings.xml | 3 + 9 files changed, 409 insertions(+), 192 deletions(-) create mode 100644 app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialViewPagerAdapter.kt create mode 100644 app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/claims/CredentialClaimsFragment.kt create mode 100644 app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/more_info/CredentialMoreInfoFragment.kt create mode 100644 app/src/main/res/layout/fragment_credential_claims.xml create mode 100644 app/src/main/res/layout/fragment_credential_more_info.xml diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsFragment.kt index 396f4782..eca49390 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsFragment.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsFragment.kt @@ -9,19 +9,19 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.navArgs -import androidx.recyclerview.widget.LinearLayoutManager import by.alexandr7035.affinidi_id.R -import by.alexandr7035.affinidi_id.core.extensions.navigateSafe import by.alexandr7035.affinidi_id.core.extensions.showErrorDialog import by.alexandr7035.affinidi_id.core.extensions.showSnackBar import by.alexandr7035.affinidi_id.core.extensions.vibrate import by.alexandr7035.affinidi_id.databinding.FragmentCredentialDetailsBinding import by.alexandr7035.affinidi_id.domain.core.ErrorType import by.alexandr7035.affinidi_id.presentation.common.VibrationMode -import by.alexandr7035.affinidi_id.presentation.common.credentials.CredentialDetailsUiModel import by.alexandr7035.affinidi_id.presentation.common.credentials.verification.VerificationModelUi +import by.alexandr7035.affinidi_id.presentation.credential_details.claims.CredentialClaimsFragment import by.kirich1409.viewbindingdelegate.viewBinding import com.google.android.material.snackbar.Snackbar +import com.google.android.material.tabs.TabLayout +import com.google.android.material.tabs.TabLayoutMediator import dagger.hilt.android.AndroidEntryPoint @@ -44,83 +44,130 @@ class CredentialDetailsFragment : Fragment() { findNavController().navigateUp() } - val credentialSubjectAdapter = CredentialDataAdapter() - binding.credentialSubjectRecycler.adapter = credentialSubjectAdapter - binding.credentialSubjectRecycler.layoutManager = LinearLayoutManager(requireContext()) + val pagerAdapter = CredentialViewPagerAdapter( + parentFragment = this, + tabsCount = 2 + ) - val metadataAdapter = CredentialDataAdapter() - binding.metadataRecycler.adapter = metadataAdapter - binding.metadataRecycler.layoutManager = LinearLayoutManager(requireContext()) + binding.viewPager.adapter = pagerAdapter - val proofAdapter = CredentialDataAdapter() - binding.proofRecycler.adapter = proofAdapter - binding.proofRecycler.layoutManager = LinearLayoutManager(requireContext()) + val tabTitles = listOf( + getString(R.string.claims), + getString(R.string.nore) + ) - viewModel.getCredentialLiveData().observe(viewLifecycleOwner) { credentialData -> - binding.progressView.root.isVisible = false - - when (credentialData) { - is CredentialDetailsUiModel.Success -> { - // Set fields to cards - credentialSubjectAdapter.setItems(credentialData.credentialSubjectItems) - metadataAdapter.setItems(credentialData.metadataItems) - proofAdapter.setItems(credentialData.proofItems) - - binding.credentialType.text = credentialData.credentialType - binding.statusMark.setColorFilter(credentialData.credentialStatus.statusColor) - binding.statusLabel.text = credentialData.credentialStatus.status - - binding.verifyBtn.setOnClickListener { - binding.progressView.root.isVisible = true - viewModel.verifyCredential(credentialData.rawVcDataPrettyFormatted) - } + TabLayoutMediator(binding.tabLayout, binding.viewPager) { tab, position -> + tab.text = tabTitles[position] + }.attach() - binding.toolbar.setOnMenuItemClickListener { - when (it.itemId) { - R.id.item_delete -> { - // Dialog to delete VC - findNavController().navigateSafe( - CredentialDetailsFragmentDirections.actionCredentialDetailsFragmentToDeleteCredentialFragment( - safeArgs.credentialId - ) - ) - } - - R.id.item_share -> { - // Share VC dialog - findNavController().navigateSafe( - CredentialDetailsFragmentDirections.actionCredentialDetailsFragmentToShareCredentialFragment( - safeArgs.credentialId - ) - ) - } - } - - true - } - - } - - is CredentialDetailsUiModel.Loading -> { - binding.progressView.root.isVisible = true - } - - is CredentialDetailsUiModel.Fail -> { - // Show unknown error always - // Connection error is unlikely to be thrown as credential is already cached - showErrorDialog( - getString(R.string.error_unknown_title), - getString(R.string.error_unknown) - ) - } - } + load(safeArgs.credentialId) + viewModel.getCredentialLiveData().observe(viewLifecycleOwner) { + binding.progressView.root.isVisible = false } - // Load credential data - load(safeArgs.credentialId) +// +// val nestedNavHost = requireActivity() +// .supportFragmentManager.findFragmentById(R.id.credential_nav_host) as NavHostFragment + + +// + + +// binding.tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { +// override fun onTabSelected(tab: TabLayout.Tab) { +// TODO("Not yet implemented") +// } +// +// override fun onTabUnselected(tab: TabLayout.Tab) { +// +// } +// +// override fun onTabReselected(tab: TabLayout.Tab) { +// +// } +// }) + + +// val credentialSubjectAdapter = CredentialDataAdapter() +// binding.credentialSubjectRecycler.adapter = credentialSubjectAdapter +// binding.credentialSubjectRecycler.layoutManager = LinearLayoutManager(requireContext()) +// +// val metadataAdapter = CredentialDataAdapter() +// binding.metadataRecycler.adapter = metadataAdapter +// binding.metadataRecycler.layoutManager = LinearLayoutManager(requireContext()) +// +// val proofAdapter = CredentialDataAdapter() +// binding.proofRecycler.adapter = proofAdapter +// binding.proofRecycler.layoutManager = LinearLayoutManager(requireContext()) +// +// viewModel.getCredentialLiveData().observe(viewLifecycleOwner) { credentialData -> +// binding.progressView.root.isVisible = false +// +// when (credentialData) { +// is CredentialDetailsUiModel.Success -> { +// // Set fields to cards +// credentialSubjectAdapter.setItems(credentialData.credentialSubjectItems) +// metadataAdapter.setItems(credentialData.metadataItems) +// proofAdapter.setItems(credentialData.proofItems) +// +// binding.credentialType.text = credentialData.credentialType +// binding.statusMark.setColorFilter(credentialData.credentialStatus.statusColor) +// binding.statusLabel.text = credentialData.credentialStatus.status +// +// binding.verifyBtn.setOnClickListener { +// binding.progressView.root.isVisible = true +// viewModel.verifyCredential(credentialData.rawVcDataPrettyFormatted) +// } +// +// binding.toolbar.setOnMenuItemClickListener { +// when (it.itemId) { +// R.id.item_delete -> { +// // Dialog to delete VC +// findNavController().navigateSafe( +// CredentialDetailsFragmentDirections.actionCredentialDetailsFragmentToDeleteCredentialFragment( +// safeArgs.credentialId +// ) +// ) +// } +// +// R.id.item_share -> { +// // Share VC dialog +// findNavController().navigateSafe( +// CredentialDetailsFragmentDirections.actionCredentialDetailsFragmentToShareCredentialFragment( +// safeArgs.credentialId +// ) +// ) +// } +// +// } +// +// true +// } +// +// } +// +// is CredentialDetailsUiModel.Loading -> { +// binding.progressView.root.isVisible = true +// } +// +// is CredentialDetailsUiModel.Fail -> { +// // Show unknown error always +// // Connection error is unlikely to be thrown as credential is already cached +// showErrorDialog( +// getString(R.string.error_unknown_title), +// getString(R.string.error_unknown) +// ) +// } +// } +// +// } +// +// +// // Load credential data +// load(safeArgs.credentialId) viewModel.getVerificationLiveData().observe(viewLifecycleOwner) { verificationResult -> binding.progressView.root.isVisible = false diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsViewModel.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsViewModel.kt index e676ea1d..49141893 100644 --- a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsViewModel.kt +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialDetailsViewModel.kt @@ -4,6 +4,7 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import by.alexandr7035.affinidi_id.core.extensions.debug import by.alexandr7035.affinidi_id.core.livedata.SingleLiveEvent import by.alexandr7035.affinidi_id.domain.model.credentials.stored_credentials.GetCredentialByIdReqModel import by.alexandr7035.affinidi_id.domain.model.credentials.stored_credentials.GetCredentialByIdResModel @@ -19,6 +20,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import timber.log.Timber import javax.inject.Inject @HiltViewModel @@ -32,6 +34,10 @@ class CredentialDetailsViewModel @Inject constructor( private val credentialLiveData = MutableLiveData() private val verificationLiveData = SingleLiveEvent() + init { + Timber.debug("shared viewmodel initialized") + } + fun loadCredential(credentialId: String) { viewModelScope.launch(Dispatchers.IO) { // Get credential diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialViewPagerAdapter.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialViewPagerAdapter.kt new file mode 100644 index 00000000..84828b45 --- /dev/null +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/CredentialViewPagerAdapter.kt @@ -0,0 +1,31 @@ +package by.alexandr7035.affinidi_id.presentation.credential_details + +import androidx.fragment.app.Fragment +import androidx.viewpager2.adapter.FragmentStateAdapter +import by.alexandr7035.affinidi_id.presentation.credential_details.claims.CredentialClaimsFragment +import by.alexandr7035.affinidi_id.presentation.credential_details.more_info.CredentialMoreInfoFragment +import java.lang.IllegalStateException + +class CredentialViewPagerAdapter( + private val tabsCount: Int, + private val parentFragment: Fragment +): FragmentStateAdapter(parentFragment) { + override fun getItemCount(): Int { + return tabsCount + } + + override fun createFragment(position: Int): Fragment { + return when (position) { + 0 -> { + CredentialClaimsFragment() + } + + 1 -> { + CredentialMoreInfoFragment() + } + + else -> throw IllegalStateException("Too many pages, some not implemented. Check viewpager & adapter") + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/claims/CredentialClaimsFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/claims/CredentialClaimsFragment.kt new file mode 100644 index 00000000..7d54050d --- /dev/null +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/claims/CredentialClaimsFragment.kt @@ -0,0 +1,40 @@ +package by.alexandr7035.affinidi_id.presentation.credential_details.claims + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.viewModels +import androidx.lifecycle.ViewModelProvider +import by.alexandr7035.affinidi_id.R +import by.alexandr7035.affinidi_id.core.extensions.showToast +import by.alexandr7035.affinidi_id.presentation.credential_details.CredentialDetailsViewModel + + +class CredentialClaimsFragment : Fragment() { + +// private val viewModel by lazy { +// ViewModelProvider(requireActivity()).get(CredentialDetailsViewModel::class.java) +// } + + private val sharedViewModel by viewModels( + ownerProducer = { requireParentFragment() } + ) + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_credential_claims, container, false) + } + + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + sharedViewModel.getCredentialLiveData().observe(viewLifecycleOwner) { + requireContext().showToast("${it}") + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/more_info/CredentialMoreInfoFragment.kt b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/more_info/CredentialMoreInfoFragment.kt new file mode 100644 index 00000000..93bc0b40 --- /dev/null +++ b/app/src/main/java/by/alexandr7035/affinidi_id/presentation/credential_details/more_info/CredentialMoreInfoFragment.kt @@ -0,0 +1,39 @@ +package by.alexandr7035.affinidi_id.presentation.credential_details.more_info + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.viewModels +import androidx.lifecycle.ViewModelProvider +import by.alexandr7035.affinidi_id.R +import by.alexandr7035.affinidi_id.core.extensions.showToast +import by.alexandr7035.affinidi_id.presentation.credential_details.CredentialDetailsViewModel + + +class CredentialMoreInfoFragment : Fragment() { + +// private val viewModel by lazy { +// ViewModelProvider(requireActivity()).get(CredentialDetailsViewModel::class.java) +// } + + + private val sharedViewModel by viewModels( + ownerProducer = { requireParentFragment() } + ) + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_credential_more_info, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + sharedViewModel.getCredentialLiveData().observe(viewLifecycleOwner) { + requireContext().showToast("${it}") + } + } + +} \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_credential_claims.xml b/app/src/main/res/layout/fragment_credential_claims.xml new file mode 100644 index 00000000..657f72b8 --- /dev/null +++ b/app/src/main/res/layout/fragment_credential_claims.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_credential_details.xml b/app/src/main/res/layout/fragment_credential_details.xml index 5dd13052..4a5bea24 100644 --- a/app/src/main/res/layout/fragment_credential_details.xml +++ b/app/src/main/res/layout/fragment_credential_details.xml @@ -16,131 +16,164 @@ app:menu="@menu/menu_credential_info_toolbar" app:title="@string/credential_info" /> - + app:layout_constraintEnd_toEndOf="parent"> + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:text="Details" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +