From 171398cc2941c6b1d2ea97190ef4f332ce9bd583 Mon Sep 17 00:00:00 2001 From: Till Hellmund Date: Thu, 25 Aug 2022 15:17:57 -0400 Subject: [PATCH] Fix several UX issues in address element - Make screens scrollable, which is necessary in landscape mode - Prevent search field from re-requesting focus after user hits enter - Adjust `Enter manually` font size - Prevent address sheet dismissal (only in auto-complete screen) and half-expanded state - Fix dismissal animation by overriding pending transitions --- ...stripe_paymentsheet_transition_fade_in.xml | 0 ...tripe_paymentsheet_transition_fade_out.xml | 0 .../GooglePayLauncherActivity.kt | 10 +++---- .../GooglePayPaymentMethodLauncherActivity.kt | 10 +++---- .../StripeGooglePayActivity.kt | 9 ++++-- .../PaymentLauncherConfirmationActivity.kt | 10 +++---- .../android/utils}/AnimationConstants.kt | 6 ++-- .../BaseAddPaymentMethodFragment.kt | 2 +- .../paymentsheet/PaymentOptionsActivity.kt | 2 +- .../paymentsheet/PaymentSheetActivity.kt | 2 +- .../addresselement/AddressElementActivity.kt | 26 +++++++++++++---- .../AddressElementActivityContract.kt | 13 ++++++--- .../addresselement/AddressUtils.kt | 24 +++++++++++++++- .../addresselement/AutocompleteScreen.kt | 28 +++++++++++-------- .../addresselement/EnterManuallyText.kt | 2 ++ .../addresselement/InputAddressScreen.kt | 2 +- .../paymentsheet/ui/BaseSheetActivity.kt | 3 +- 17 files changed, 103 insertions(+), 46 deletions(-) rename {paymentsheet => payments-core}/res/anim/stripe_paymentsheet_transition_fade_in.xml (100%) rename {paymentsheet => payments-core}/res/anim/stripe_paymentsheet_transition_fade_out.xml (100%) rename {paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui => payments-core/src/main/java/com/stripe/android/utils}/AnimationConstants.kt (61%) diff --git a/paymentsheet/res/anim/stripe_paymentsheet_transition_fade_in.xml b/payments-core/res/anim/stripe_paymentsheet_transition_fade_in.xml similarity index 100% rename from paymentsheet/res/anim/stripe_paymentsheet_transition_fade_in.xml rename to payments-core/res/anim/stripe_paymentsheet_transition_fade_in.xml diff --git a/paymentsheet/res/anim/stripe_paymentsheet_transition_fade_out.xml b/payments-core/res/anim/stripe_paymentsheet_transition_fade_out.xml similarity index 100% rename from paymentsheet/res/anim/stripe_paymentsheet_transition_fade_out.xml rename to payments-core/res/anim/stripe_paymentsheet_transition_fade_out.xml diff --git a/payments-core/src/main/java/com/stripe/android/googlepaylauncher/GooglePayLauncherActivity.kt b/payments-core/src/main/java/com/stripe/android/googlepaylauncher/GooglePayLauncherActivity.kt index 1ca6046de09..d30fd2f503e 100644 --- a/payments-core/src/main/java/com/stripe/android/googlepaylauncher/GooglePayLauncherActivity.kt +++ b/payments-core/src/main/java/com/stripe/android/googlepaylauncher/GooglePayLauncherActivity.kt @@ -12,6 +12,7 @@ import com.google.android.gms.wallet.AutoResolveHelper import com.google.android.gms.wallet.PaymentData import com.stripe.android.model.PaymentMethodCreateParams import com.stripe.android.model.StripeIntent +import com.stripe.android.utils.AnimationConstants import com.stripe.android.view.AuthActivityStarterHost import kotlinx.coroutines.launch import org.json.JSONObject @@ -46,7 +47,7 @@ internal class GooglePayLauncherActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - disableAnimations() + setFadeAnimations() args = runCatching { requireNotNull(GooglePayLauncherContract.Args.fromIntent(intent)) { @@ -89,7 +90,7 @@ internal class GooglePayLauncherActivity : AppCompatActivity() { override fun finish() { super.finish() - disableAnimations() + setFadeAnimations() } private fun payWithGoogle(task: Task) { @@ -179,9 +180,8 @@ internal class GooglePayLauncherActivity : AppCompatActivity() { finish() } - private fun disableAnimations() { - // this is a transparent Activity so we want to disable animations - overridePendingTransition(0, 0) + private fun setFadeAnimations() { + overridePendingTransition(AnimationConstants.FADE_IN, AnimationConstants.FADE_OUT) } private companion object { diff --git a/payments-core/src/main/java/com/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncherActivity.kt b/payments-core/src/main/java/com/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncherActivity.kt index e4b3f7299e9..5b5eefebf66 100644 --- a/payments-core/src/main/java/com/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncherActivity.kt +++ b/payments-core/src/main/java/com/stripe/android/googlepaylauncher/GooglePayPaymentMethodLauncherActivity.kt @@ -11,6 +11,7 @@ import com.google.android.gms.tasks.Task import com.google.android.gms.wallet.AutoResolveHelper import com.google.android.gms.wallet.PaymentData import com.stripe.android.model.PaymentMethod +import com.stripe.android.utils.AnimationConstants import kotlinx.coroutines.launch /** @@ -46,7 +47,7 @@ internal class GooglePayPaymentMethodLauncherActivity : AppCompatActivity() { window.statusBarColor = statusColor } - disableAnimations() + setFadeAnimations() val nullableArgs = GooglePayPaymentMethodLauncherContract.Args.fromIntent(intent) if (nullableArgs == null) { @@ -90,7 +91,7 @@ internal class GooglePayPaymentMethodLauncherActivity : AppCompatActivity() { override fun finish() { super.finish() - disableAnimations() + setFadeAnimations() } private fun launchGooglePay(task: Task) { @@ -174,9 +175,8 @@ internal class GooglePayPaymentMethodLauncherActivity : AppCompatActivity() { finish() } - private fun disableAnimations() { - // this is a transparent Activity so we want to disable animations - overridePendingTransition(0, 0) + private fun setFadeAnimations() { + overridePendingTransition(AnimationConstants.FADE_IN, AnimationConstants.FADE_OUT) } private fun googlePayStatusCodeToErrorCode(googlePayStatusCode: Int): diff --git a/payments-core/src/main/java/com/stripe/android/googlepaylauncher/StripeGooglePayActivity.kt b/payments-core/src/main/java/com/stripe/android/googlepaylauncher/StripeGooglePayActivity.kt index 8cf7467c69a..c73741a7bf8 100644 --- a/payments-core/src/main/java/com/stripe/android/googlepaylauncher/StripeGooglePayActivity.kt +++ b/payments-core/src/main/java/com/stripe/android/googlepaylauncher/StripeGooglePayActivity.kt @@ -13,6 +13,7 @@ import com.stripe.android.model.GooglePayResult import com.stripe.android.model.PaymentMethod import com.stripe.android.model.PaymentMethodCreateParams import com.stripe.android.model.ShippingInformation +import com.stripe.android.utils.AnimationConstants import org.json.JSONObject /** @@ -48,7 +49,7 @@ internal class StripeGooglePayActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - overridePendingTransition(0, 0) + setFadeAnimations() setResult( RESULT_OK, Intent().putExtras( @@ -88,7 +89,11 @@ internal class StripeGooglePayActivity : AppCompatActivity() { override fun finish() { super.finish() - overridePendingTransition(0, 0) + setFadeAnimations() + } + + private fun setFadeAnimations() { + overridePendingTransition(AnimationConstants.FADE_IN, AnimationConstants.FADE_OUT) } /** diff --git a/payments-core/src/main/java/com/stripe/android/payments/paymentlauncher/PaymentLauncherConfirmationActivity.kt b/payments-core/src/main/java/com/stripe/android/payments/paymentlauncher/PaymentLauncherConfirmationActivity.kt index 2db7404161d..c15729461a6 100644 --- a/payments-core/src/main/java/com/stripe/android/payments/paymentlauncher/PaymentLauncherConfirmationActivity.kt +++ b/payments-core/src/main/java/com/stripe/android/payments/paymentlauncher/PaymentLauncherConfirmationActivity.kt @@ -8,6 +8,7 @@ import androidx.activity.viewModels import androidx.annotation.VisibleForTesting import androidx.appcompat.app.AppCompatActivity import androidx.lifecycle.ViewModelProvider +import com.stripe.android.utils.AnimationConstants import com.stripe.android.view.AuthActivityStarterHost /** @@ -35,7 +36,7 @@ internal class PaymentLauncherConfirmationActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - disableAnimations() + setFadeAnimations() val args = runCatching { requireNotNull(starterArgs) { @@ -73,12 +74,11 @@ internal class PaymentLauncherConfirmationActivity : AppCompatActivity() { override fun finish() { super.finish() - disableAnimations() + setFadeAnimations() } - private fun disableAnimations() { - // this is a transparent Activity so we want to disable animations - overridePendingTransition(0, 0) + private fun setFadeAnimations() { + overridePendingTransition(AnimationConstants.FADE_IN, AnimationConstants.FADE_OUT) } /** diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/AnimationConstants.kt b/payments-core/src/main/java/com/stripe/android/utils/AnimationConstants.kt similarity index 61% rename from paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/AnimationConstants.kt rename to payments-core/src/main/java/com/stripe/android/utils/AnimationConstants.kt index 847605713a9..205f40c2a44 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/AnimationConstants.kt +++ b/payments-core/src/main/java/com/stripe/android/utils/AnimationConstants.kt @@ -1,9 +1,9 @@ -package com.stripe.android.paymentsheet.ui +package com.stripe.android.utils import androidx.annotation.AnimRes -import com.stripe.android.paymentsheet.R +import com.stripe.android.R -internal object AnimationConstants { +object AnimationConstants { @AnimRes val FADE_IN = R.anim.stripe_paymentsheet_transition_fade_in diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/BaseAddPaymentMethodFragment.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/BaseAddPaymentMethodFragment.kt index 012c64ebfd5..d989bf5d05b 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/BaseAddPaymentMethodFragment.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/BaseAddPaymentMethodFragment.kt @@ -29,7 +29,7 @@ import com.stripe.android.paymentsheet.model.getPMAddForm import com.stripe.android.paymentsheet.paymentdatacollection.ComposeFormDataCollectionFragment import com.stripe.android.paymentsheet.paymentdatacollection.FormFragmentArguments import com.stripe.android.paymentsheet.paymentdatacollection.ach.USBankAccountFormFragment -import com.stripe.android.paymentsheet.ui.AnimationConstants +import com.stripe.android.utils.AnimationConstants import com.stripe.android.paymentsheet.ui.PrimaryButton import com.stripe.android.paymentsheet.viewmodels.BaseSheetViewModel import com.stripe.android.ui.core.Amount diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentOptionsActivity.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentOptionsActivity.kt index 07cf4ce3a80..7159f748eb1 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentOptionsActivity.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentOptionsActivity.kt @@ -21,7 +21,7 @@ import androidx.lifecycle.ViewModelProvider import com.google.android.material.appbar.AppBarLayout import com.google.android.material.appbar.MaterialToolbar import com.stripe.android.paymentsheet.databinding.ActivityPaymentOptionsBinding -import com.stripe.android.paymentsheet.ui.AnimationConstants +import com.stripe.android.utils.AnimationConstants import com.stripe.android.paymentsheet.ui.BaseSheetActivity import com.stripe.android.paymentsheet.ui.PrimaryButton import com.stripe.android.paymentsheet.viewmodels.BaseSheetViewModel diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentSheetActivity.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentSheetActivity.kt index a478c556424..2b51dd0380e 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentSheetActivity.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentSheetActivity.kt @@ -27,7 +27,7 @@ import com.stripe.android.paymentsheet.PaymentSheetViewModel.CheckoutIdentifier import com.stripe.android.paymentsheet.databinding.ActivityPaymentSheetBinding import com.stripe.android.paymentsheet.model.PaymentSelection import com.stripe.android.paymentsheet.model.PaymentSheetViewState -import com.stripe.android.paymentsheet.ui.AnimationConstants +import com.stripe.android.utils.AnimationConstants import com.stripe.android.paymentsheet.ui.BaseSheetActivity import com.stripe.android.paymentsheet.ui.GooglePayDividerUi import com.stripe.android.paymentsheet.ui.PrimaryButton diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressElementActivity.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressElementActivity.kt index bc51929bc99..386bc07335b 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressElementActivity.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressElementActivity.kt @@ -29,6 +29,7 @@ import com.google.accompanist.navigation.animation.composable import com.google.accompanist.navigation.animation.AnimatedNavHost import com.google.accompanist.navigation.animation.rememberAnimatedNavController import com.stripe.android.paymentsheet.parseAppearance +import com.stripe.android.utils.AnimationConstants import com.stripe.android.ui.core.PaymentsTheme import kotlinx.coroutines.launch @@ -57,14 +58,22 @@ internal class AddressElementActivity : ComponentActivity() { WindowCompat.setDecorFitsSystemWindows(window, false) starterArgs.config?.appearance?.parseAppearance() + starterArgs.statusBarColor?.let { + window.statusBarColor = it + } + // set a default result in case the user closes the sheet manually setResult() setContent { - val modalBottomSheetState = - rememberModalBottomSheetState( - ModalBottomSheetValue.Expanded - ) + val modalBottomSheetState = rememberModalBottomSheetState( + initialValue = ModalBottomSheetValue.Expanded, + skipHalfExpanded = true, + confirmStateChange = { + val route = navController.currentDestination?.route + route != AddressElementScreen.Autocomplete.route + } + ) navController = rememberAnimatedNavController() viewModel.navigator.navigationController = navController @@ -125,7 +134,9 @@ internal class AddressElementActivity : ComponentActivity() { } }, content = {}, - modifier = Modifier.navigationBarsPadding().systemBarsPadding() + modifier = Modifier + .navigationBarsPadding() + .systemBarsPadding() ) } } @@ -138,4 +149,9 @@ internal class AddressElementActivity : ComponentActivity() { ) ) } + + override fun finish() { + super.finish() + overridePendingTransition(AnimationConstants.FADE_IN, AnimationConstants.FADE_OUT) + } } diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressElementActivityContract.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressElementActivityContract.kt index a1017caa719..9eec3ebebcd 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressElementActivityContract.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressElementActivityContract.kt @@ -1,8 +1,10 @@ package com.stripe.android.paymentsheet.addresselement +import android.app.Activity import android.content.Context import android.content.Intent import androidx.activity.result.contract.ActivityResultContract +import androidx.annotation.ColorInt import androidx.annotation.RestrictTo import androidx.core.os.bundleOf import com.stripe.android.core.injection.DUMMY_INJECTOR_KEY @@ -14,9 +16,11 @@ import kotlinx.parcelize.Parcelize internal class AddressElementActivityContract : ActivityResultContract() { - override fun createIntent(context: Context, input: Args) = - Intent(context, AddressElementActivity::class.java) - .putExtra(EXTRA_ARGS, input) + override fun createIntent(context: Context, input: Args): Intent { + val statusBarColor = (context as? Activity)?.window?.statusBarColor + return Intent(context, AddressElementActivity::class.java) + .putExtra(EXTRA_ARGS, input.copy(statusBarColor = statusBarColor)) + } override fun parseResult(resultCode: Int, intent: Intent?) = intent?.getParcelableExtra(EXTRA_RESULT)?.addressOptionsResult @@ -34,7 +38,8 @@ internal class AddressElementActivityContract : data class Args internal constructor( internal val publishableKey: String, internal val config: AddressLauncher.Configuration?, - @InjectorKey internal val injectorKey: String = DUMMY_INJECTOR_KEY + @InjectorKey internal val injectorKey: String = DUMMY_INJECTOR_KEY, + @ColorInt internal val statusBarColor: Int? = null ) : ActivityStarter.Args { companion object { diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressUtils.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressUtils.kt index c929f8a7116..c13a8020d6d 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressUtils.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AddressUtils.kt @@ -1,10 +1,17 @@ package com.stripe.android.paymentsheet.addresselement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ColumnScope +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier import kotlin.math.min // https://gist.github.com/ademar111190/34d3de41308389a0d0d8 -fun CharSequence.levenshtein(other: CharSequence): Int { +internal fun CharSequence.levenshtein(other: CharSequence): Int { if (this == other) { return 0 } if (this.isEmpty()) { return other.length } if (other.isEmpty()) { return this.length } @@ -47,3 +54,18 @@ internal fun AddressDetails.editDistance(otherAddress: AddressDetails?): Int { editDistance += (address?.state ?: "").levenshtein(comparedAddress?.state ?: "") return editDistance } + +@Composable +internal fun ScrollableColumn( + modifier: Modifier = Modifier, + content: @Composable ColumnScope.() -> Unit +) { + Box( + modifier = Modifier.verticalScroll(rememberScrollState()) + ) { + Column( + modifier = modifier, + content = content + ) + } +} diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AutocompleteScreen.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AutocompleteScreen.kt index 34b4875a73a..35fd2ebde9f 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AutocompleteScreen.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/AutocompleteScreen.kt @@ -22,7 +22,7 @@ import androidx.compose.material.MaterialTheme import androidx.compose.material.Scaffold import androidx.compose.material.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.SideEffect +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember @@ -77,6 +77,11 @@ internal fun AutocompleteScreenUI(viewModel: AutocompleteViewModel) { val attributionDrawable = PlacesClientProxy.getPlacesPoweredByGoogleDrawable(isSystemInDarkTheme()) val focusRequester = remember { FocusRequester() } + + LaunchedEffect(true) { + focusRequester.requestFocus() + } + Scaffold( bottomBar = { val background = if (isSystemInDarkTheme()) { @@ -100,7 +105,7 @@ internal fun AutocompleteScreenUI(viewModel: AutocompleteViewModel) { } } ) { paddingValues -> - Column( + ScrollableColumn( modifier = Modifier .fillMaxWidth() .fillMaxHeight() @@ -127,9 +132,6 @@ internal fun AutocompleteScreenUI(viewModel: AutocompleteViewModel) { .fillMaxWidth() .focusRequester(focusRequester) ) - SideEffect { - focusRequester.requestFocus() - } } if (loading) { Row( @@ -145,9 +147,7 @@ internal fun AutocompleteScreenUI(viewModel: AutocompleteViewModel) { modifier = Modifier.padding(vertical = 8.dp) ) Column( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 16.dp) + modifier = Modifier.fillMaxWidth() ) { it.forEach { prediction -> val primaryText = prediction.primaryText @@ -158,6 +158,10 @@ internal fun AutocompleteScreenUI(viewModel: AutocompleteViewModel) { .clickable { viewModel.selectPrediction(prediction) } + .padding( + vertical = 8.dp, + horizontal = 16.dp + ) ) { val regex = query.value .replace(" ", "|") @@ -182,7 +186,7 @@ internal fun AutocompleteScreenUI(viewModel: AutocompleteViewModel) { ) } Divider( - modifier = Modifier.padding(vertical = 8.dp) + modifier = Modifier.padding(horizontal = 16.dp) ) } } @@ -208,8 +212,10 @@ internal fun AutocompleteScreenUI(viewModel: AutocompleteViewModel) { ), contentDescription = null, modifier = Modifier - .padding(top = 8.dp) - .padding(horizontal = 16.dp) + .padding( + vertical = 16.dp, + horizontal = 16.dp + ) .testTag(TEST_TAG_ATTRIBUTION_DRAWABLE) ) } diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/EnterManuallyText.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/EnterManuallyText.kt index 5bb8cf86b51..e4580f68f7f 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/EnterManuallyText.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/EnterManuallyText.kt @@ -6,6 +6,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.buildAnnotatedString import com.stripe.android.paymentsheet.R +import com.stripe.android.ui.core.PaymentsThemeDefaults @Composable internal fun EnterManuallyText( @@ -20,6 +21,7 @@ internal fun EnterManuallyText( ) }, style = MaterialTheme.typography.body1.copy( + fontSize = PaymentsThemeDefaults.typography.largeFontSize, color = MaterialTheme.colors.primary ) ) { diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/InputAddressScreen.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/InputAddressScreen.kt index ba7e9bf98f8..88defc6b4c1 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/InputAddressScreen.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/addresselement/InputAddressScreen.kt @@ -34,7 +34,7 @@ internal fun InputAddressScreen( formContent: @Composable ColumnScope.() -> Unit, checkboxContent: @Composable ColumnScope.() -> Unit ) { - Column( + ScrollableColumn( modifier = Modifier .fillMaxHeight() .background(MaterialTheme.colors.surface) diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/BaseSheetActivity.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/BaseSheetActivity.kt index 7f336e818cb..f80b8334394 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/BaseSheetActivity.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/BaseSheetActivity.kt @@ -43,6 +43,7 @@ import com.stripe.android.ui.core.elements.Html import com.stripe.android.ui.core.getBackgroundColor import com.stripe.android.ui.core.isSystemDarkTheme import com.stripe.android.ui.core.paymentsColors +import com.stripe.android.utils.AnimationConstants import com.stripe.android.view.KeyboardController import kotlin.math.roundToInt @@ -169,7 +170,7 @@ internal abstract class BaseSheetActivity : AppCompatActivity() { override fun finish() { super.finish() - overridePendingTransition(0, 0) + overridePendingTransition(AnimationConstants.FADE_IN, AnimationConstants.FADE_OUT) } override fun onBackPressed() {