diff --git a/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationActivity.kt b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationActivity.kt index 1afaba2a5..fccbdaeb0 100644 --- a/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationActivity.kt +++ b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationActivity.kt @@ -138,9 +138,12 @@ class ConfigurationActivity : AppCompatActivity() { // 11 enable review screens custom bottom navigation bar binding.layoutBottomNavigationToggles.switchReviewScreenCustomBottomNavbar.isChecked = configuration.isReviewScreenCustomBottomNavBarEnabled - + // 39 enable skonto screens custom bottom navigation bar binding.layoutBottomNavigationToggles.switchSkontoCustomBottomNavbar.isChecked = configuration.isSkontoCustomNavBarEnabled + // 41 enable skonto help screens custom bottom navigation bar + binding.layoutBottomNavigationToggles.switchSkontoHelpCustomBottomNavbar.isChecked = + configuration.isSkontoHelpCustomNavBarEnabled // 12 enable image picker screens custom bottom navigation bar -> was implemented on iOS, not needed for Android @@ -375,6 +378,7 @@ class ConfigurationActivity : AppCompatActivity() { ) } + // 39 enable skonto screens custom bottom navigation bar binding.layoutBottomNavigationToggles.switchSkontoCustomBottomNavbar.setOnCheckedChangeListener { _, isChecked -> configurationViewModel.setConfiguration( configurationViewModel.configurationFlow.value.copy( @@ -383,6 +387,15 @@ class ConfigurationActivity : AppCompatActivity() { ) } + // 41 enable skonto screens custom bottom navigation bar + binding.layoutBottomNavigationToggles.switchSkontoHelpCustomBottomNavbar.setOnCheckedChangeListener { _, isChecked -> + configurationViewModel.setConfiguration( + configurationViewModel.configurationFlow.value.copy( + isSkontoHelpCustomNavBarEnabled = isChecked + ) + ) + } + // 12 enable image picker screens custom bottom navigation bar -> was implemented on iOS, not needed for Android // 13 enable onboarding screens at first launch diff --git a/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationViewModel.kt b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationViewModel.kt index 94475f05c..d70dd79c0 100644 --- a/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationViewModel.kt +++ b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationViewModel.kt @@ -26,6 +26,7 @@ import net.gini.android.bank.sdk.exampleapp.ui.adapters.CustomOnButtonLoadingInd import net.gini.android.bank.sdk.exampleapp.ui.adapters.CustomOnboardingIllustrationAdapter import net.gini.android.bank.sdk.exampleapp.ui.adapters.CustomOnboardingNavigationBarBottomAdapter import net.gini.android.bank.sdk.exampleapp.ui.adapters.CustomReviewNavigationBarBottomAdapter +import net.gini.android.bank.sdk.exampleapp.ui.adapters.CustomSkontoHelpNavigationBarBottomAdapter import net.gini.android.bank.sdk.exampleapp.ui.adapters.CustomSkontoNavigationBarBottomAdapter import net.gini.android.bank.sdk.exampleapp.ui.data.Configuration import net.gini.android.capture.GiniCaptureDebug @@ -285,6 +286,12 @@ class ConfigurationViewModel @Inject constructor( GiniBank.skontoNavigationBarBottomAdapter = null } + if (configuration.isSkontoHelpCustomNavBarEnabled) { + GiniBank.skontoHelpNavigationBarBottomAdapter = CustomSkontoHelpNavigationBarBottomAdapter() + } else { + GiniBank.skontoHelpNavigationBarBottomAdapter = null + } + // 35 Digital invoice onboarding bottom navigation bar if (configuration.isDigitalInvoiceOnboardingBottomNavigationBarEnabled) { GiniBank.digitalInvoiceOnboardingNavigationBarBottomAdapter = diff --git a/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/adapters/CustomSkontoHelpNavigationBarBottomAdapter.kt b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/adapters/CustomSkontoHelpNavigationBarBottomAdapter.kt new file mode 100644 index 000000000..b54d7e201 --- /dev/null +++ b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/adapters/CustomSkontoHelpNavigationBarBottomAdapter.kt @@ -0,0 +1,27 @@ +package net.gini.android.bank.sdk.exampleapp.ui.adapters + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import net.gini.android.bank.sdk.capture.skonto.help.SkontoHelpNavigationBarBottomAdapter +import net.gini.android.bank.sdk.exampleapp.databinding.CustomSkontoHelpNavigationBarBottomBinding + +class CustomSkontoHelpNavigationBarBottomAdapter: + SkontoHelpNavigationBarBottomAdapter { + var viewBinding: CustomSkontoHelpNavigationBarBottomBinding? = null + + override fun setOnBackClickListener(onClick: () -> Unit) { + viewBinding?.gbsGoBack?.setOnClickListener { onClick() } + } + + override fun onCreateView(container: ViewGroup): View { + val binding = CustomSkontoHelpNavigationBarBottomBinding.inflate(LayoutInflater.from(container.context), container, false) + viewBinding = binding + + return viewBinding!!.root + } + + override fun onDestroy() { + viewBinding = null + } +} \ No newline at end of file diff --git a/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/data/Configuration.kt b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/data/Configuration.kt index 4af4125c3..b07ba5b58 100644 --- a/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/data/Configuration.kt +++ b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/data/Configuration.kt @@ -163,6 +163,9 @@ data class Configuration( // 40 enable Skonto val isSkontoEnabled: Boolean = true, + // 41 Skonto help Custom bottom navigation + val isSkontoHelpCustomNavBarEnabled: Boolean = false, + ) : Parcelable { companion object { diff --git a/bank-sdk/example-app/src/main/res/layout/custom_skonto_help_navigation_bar_bottom.xml b/bank-sdk/example-app/src/main/res/layout/custom_skonto_help_navigation_bar_bottom.xml new file mode 100644 index 000000000..a1699090d --- /dev/null +++ b/bank-sdk/example-app/src/main/res/layout/custom_skonto_help_navigation_bar_bottom.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/bank-sdk/example-app/src/main/res/layout/layout_bottom_navigation_toggles.xml b/bank-sdk/example-app/src/main/res/layout/layout_bottom_navigation_toggles.xml index 67cfd4a1b..b916090b4 100644 --- a/bank-sdk/example-app/src/main/res/layout/layout_bottom_navigation_toggles.xml +++ b/bank-sdk/example-app/src/main/res/layout/layout_bottom_navigation_toggles.xml @@ -139,4 +139,18 @@ android:layout_height="wrap_content" android:text="@string/custom_bottom_navbar_switch_description" /> + + + + \ No newline at end of file diff --git a/bank-sdk/example-app/src/main/res/values/strings.xml b/bank-sdk/example-app/src/main/res/values/strings.xml index 5c9c4db39..6163cc698 100644 --- a/bank-sdk/example-app/src/main/res/values/strings.xml +++ b/bank-sdk/example-app/src/main/res/values/strings.xml @@ -77,6 +77,7 @@ Camera screen custom bottom navigation bar Review screen custom bottom navigation bar Skonto screen custom bottom navigation bar + Skonto help screen custom bottom navigation bar Onboarding screens at every launch Onboarding screens at first launch Overwrites \'Onboarding screens at first launch\'. diff --git a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/GiniBank.kt b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/GiniBank.kt index 4b158e9a2..3d24e8165 100644 --- a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/GiniBank.kt +++ b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/GiniBank.kt @@ -25,6 +25,7 @@ import net.gini.android.bank.sdk.capture.digitalinvoice.view.DefaultDigitalInvoi import net.gini.android.bank.sdk.capture.digitalinvoice.view.DigitalInvoiceNavigationBarBottomAdapter import net.gini.android.bank.sdk.capture.digitalinvoice.view.DigitalInvoiceOnboardingNavigationBarBottomAdapter import net.gini.android.bank.sdk.capture.skonto.SkontoNavigationBarBottomAdapter +import net.gini.android.bank.sdk.capture.skonto.help.SkontoHelpNavigationBarBottomAdapter import net.gini.android.bank.sdk.error.AmountParsingException import net.gini.android.bank.sdk.pay.getBusinessIntent import net.gini.android.bank.sdk.pay.getRequestId @@ -114,6 +115,17 @@ object GiniBank { get() = skontoNavigationBarBottomAdapterInstance?.viewAdapter + internal var skontoHelpNavigationBarBottomAdapterInstance: InjectedViewAdapterInstance? = + null + + var skontoHelpNavigationBarBottomAdapter: SkontoHelpNavigationBarBottomAdapter? + set(value) { + skontoHelpNavigationBarBottomAdapterInstance = + value?.let { InjectedViewAdapterInstance(it) } + } + get() = skontoHelpNavigationBarBottomAdapterInstance?.viewAdapter + + internal fun getCaptureConfiguration() = captureConfiguration /** diff --git a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/help/SkontoHelpFragment.kt b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/help/SkontoHelpFragment.kt index 900981bf8..86553af6b 100644 --- a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/help/SkontoHelpFragment.kt +++ b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/help/SkontoHelpFragment.kt @@ -6,10 +6,12 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.WindowManager +import android.widget.FrameLayout import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.Image import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth @@ -28,16 +30,17 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.platform.ComposeView +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.compose.ui.viewinterop.AndroidView import androidx.fragment.app.Fragment import androidx.navigation.findNavController import net.gini.android.bank.sdk.GiniBank import net.gini.android.bank.sdk.R -import net.gini.android.bank.sdk.capture.skonto.SkontoNavigationBarBottomAdapter import net.gini.android.bank.sdk.capture.skonto.help.colors.SkontoHelpScreenColors import net.gini.android.bank.sdk.capture.skonto.help.colors.section.SkontoHelpDescriptionSectionColors import net.gini.android.bank.sdk.capture.skonto.help.colors.section.SkontoHelpFooterSectionColors @@ -57,8 +60,8 @@ class SkontoHelpFragment : Fragment() { private val isBottomNavigationBarEnabled = GiniCapture.getInstance().isBottomNavigationBarEnabled - private val customBottomNavBarAdapter: InjectedViewAdapterInstance? = - GiniBank.skontoNavigationBarBottomAdapterInstance + private val customBottomNavBarAdapter: InjectedViewAdapterInstance? = + GiniBank.skontoHelpNavigationBarBottomAdapterInstance private var customBottomNavigationBarView: View? = null @@ -131,7 +134,7 @@ private fun ScreenContent( modifier: Modifier = Modifier, screenColorScheme: SkontoHelpScreenColors = SkontoHelpScreenColors.colors(), isBottomNavigationBarEnabled: Boolean, - customBottomNavBarAdapter: InjectedViewAdapterInstance?, + customBottomNavBarAdapter: InjectedViewAdapterInstance?, ) { BackHandler { navigateBack() } @@ -149,7 +152,7 @@ private fun ScreenContent( private fun ScreenStateContent( onBackClicked: () -> Unit, isBottomNavigationBarEnabled: Boolean, - customBottomNavBarAdapter: InjectedViewAdapterInstance?, + customBottomNavBarAdapter: InjectedViewAdapterInstance?, modifier: Modifier = Modifier, screenColorScheme: SkontoHelpScreenColors = SkontoHelpScreenColors.colors() ) { @@ -164,6 +167,8 @@ private fun ScreenStateContent( colors = screenColorScheme.topAppBarColors, onBackClicked = onBackClicked, ) + }, bottomBar = { + HelpCustomNavBarSection(customBottomNavBarAdapter, onBackClicked) }) { Column( modifier = Modifier @@ -197,6 +202,22 @@ private fun ScreenStateContent( } +@Composable +private fun HelpCustomNavBarSection( + customBottomNavBarAdapter: InjectedViewAdapterInstance?, + onBackClicked: () -> Unit, +) { + if (customBottomNavBarAdapter != null) { + val ctx = LocalContext.current + AndroidView(factory = { + customBottomNavBarAdapter.viewAdapter.onCreateView(FrameLayout(ctx)) + }, update = { + with(customBottomNavBarAdapter.viewAdapter) { + setOnBackClickListener(onBackClicked) + } + }) + } +} @Composable private fun HelpFooterSection( diff --git a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/help/SkontoHelpNavigationBarBottomAdapter.kt b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/help/SkontoHelpNavigationBarBottomAdapter.kt new file mode 100644 index 000000000..b7d25f3d3 --- /dev/null +++ b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/help/SkontoHelpNavigationBarBottomAdapter.kt @@ -0,0 +1,14 @@ +package net.gini.android.bank.sdk.capture.skonto.help + +import net.gini.android.capture.view.InjectedViewAdapter + +interface SkontoHelpNavigationBarBottomAdapter : InjectedViewAdapter { + + /** + * Set the click listener for the back button. + * + * @param onClick the click function for the back button + */ + fun setOnBackClickListener(onClick: () -> Unit) + +} \ No newline at end of file