diff --git a/paymentsheet/api/paymentsheet.api b/paymentsheet/api/paymentsheet.api index 1bb3913f76a..13cd9ff45b8 100644 --- a/paymentsheet/api/paymentsheet.api +++ b/paymentsheet/api/paymentsheet.api @@ -2469,6 +2469,13 @@ public final class com/stripe/android/paymentsheet/state/PaymentSheetState$Loadi public synthetic fun newArray (I)[Ljava/lang/Object; } +public final class com/stripe/android/paymentsheet/ui/ComposableSingletons$DefaultPaymentMethodLabelKt { + public static final field INSTANCE Lcom/stripe/android/paymentsheet/ui/ComposableSingletons$DefaultPaymentMethodLabelKt; + public static field lambda-1 Lkotlin/jvm/functions/Function2; + public fun ()V + public final fun getLambda-1$paymentsheet_release ()Lkotlin/jvm/functions/Function2; +} + public final class com/stripe/android/paymentsheet/ui/ComposableSingletons$EditPaymentMethodKt { public static final field INSTANCE Lcom/stripe/android/paymentsheet/ui/ComposableSingletons$EditPaymentMethodKt; public static field lambda-1 Lkotlin/jvm/functions/Function2; diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/DefaultPaymentMethodLabel.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/DefaultPaymentMethodLabel.kt new file mode 100644 index 00000000000..5677991768d --- /dev/null +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/DefaultPaymentMethodLabel.kt @@ -0,0 +1,51 @@ +package com.stripe.android.paymentsheet.ui + +import android.content.res.Configuration +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Row +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.testTag +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.tooling.preview.Preview +import com.stripe.android.paymentsheet.R +import com.stripe.android.uicore.DefaultStripeTheme +import com.stripe.android.uicore.stripeColors + +@Composable +internal fun DefaultPaymentMethodLabel( + modifier: Modifier, +) { + Text( + modifier = modifier + .testTag( + TEST_TAG_DEFAULT_PAYMENT_METHOD_LABEL + ), + text = stringResource(id = R.string.stripe_wallet_default), + style = MaterialTheme.typography.caption.copy(fontWeight = FontWeight.Medium), + color = MaterialTheme.stripeColors.placeholderText, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + ) +} + +@Composable +@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) +@Preview +private fun DefaultPaymentMethodLabelPreview() { + DefaultStripeTheme { + Row( + modifier = Modifier.background(color = MaterialTheme.stripeColors.component) + ) { + DefaultPaymentMethodLabel( + modifier = Modifier + ) + } + } +} + +internal const val TEST_TAG_DEFAULT_PAYMENT_METHOD_LABEL = "default_payment_method_label" diff --git a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/ui/DefaultPaymentMethodLabelScreenshotTest.kt b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/ui/DefaultPaymentMethodLabelScreenshotTest.kt new file mode 100644 index 00000000000..91241066782 --- /dev/null +++ b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/ui/DefaultPaymentMethodLabelScreenshotTest.kt @@ -0,0 +1,31 @@ +package com.stripe.android.paymentsheet.ui + +import androidx.compose.foundation.layout.padding +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import com.stripe.android.screenshottesting.FontSize +import com.stripe.android.screenshottesting.PaparazziRule +import com.stripe.android.screenshottesting.SystemAppearance +import com.stripe.android.utils.screenshots.PaymentSheetAppearance +import org.junit.Rule +import org.junit.Test + +internal class DefaultPaymentMethodLabelScreenshotTest { + + @get:Rule + val paparazziRule = PaparazziRule( + SystemAppearance.entries, + PaymentSheetAppearance.entries, + FontSize.entries, + ) + + @Test + fun testDefaultPaymentMethodLabel() { + paparazziRule.snapshot { + DefaultPaymentMethodLabel( + modifier = Modifier + .padding(horizontal = 4.dp, vertical = 4.dp) + ) + } + } +} diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CrazyAppearance,DefaultFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CrazyAppearance,DefaultFont].png new file mode 100644 index 00000000000..a752797d229 Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CrazyAppearance,DefaultFont].png differ diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CrazyAppearance,LargeFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CrazyAppearance,LargeFont].png new file mode 100644 index 00000000000..62314478cc7 Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CrazyAppearance,LargeFont].png differ diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CustomAppearance,DefaultFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CustomAppearance,DefaultFont].png new file mode 100644 index 00000000000..e8834f38e6e Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CustomAppearance,DefaultFont].png differ diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CustomAppearance,LargeFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CustomAppearance,LargeFont].png new file mode 100644 index 00000000000..ff93a3e159c Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,CustomAppearance,LargeFont].png differ diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,DefaultAppearance,DefaultFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,DefaultAppearance,DefaultFont].png new file mode 100644 index 00000000000..405a86acdee Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,DefaultAppearance,DefaultFont].png differ diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,DefaultAppearance,LargeFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,DefaultAppearance,LargeFont].png new file mode 100644 index 00000000000..f19af235ed1 Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[DarkTheme,DefaultAppearance,LargeFont].png differ diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CrazyAppearance,DefaultFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CrazyAppearance,DefaultFont].png new file mode 100644 index 00000000000..a752797d229 Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CrazyAppearance,DefaultFont].png differ diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CrazyAppearance,LargeFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CrazyAppearance,LargeFont].png new file mode 100644 index 00000000000..62314478cc7 Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CrazyAppearance,LargeFont].png differ diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CustomAppearance,DefaultFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CustomAppearance,DefaultFont].png new file mode 100644 index 00000000000..b82ee3235cf Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CustomAppearance,DefaultFont].png differ diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CustomAppearance,LargeFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CustomAppearance,LargeFont].png new file mode 100644 index 00000000000..fdcccfd98bb Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,CustomAppearance,LargeFont].png differ diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,DefaultAppearance,DefaultFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,DefaultAppearance,DefaultFont].png new file mode 100644 index 00000000000..13d4eae5896 Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,DefaultAppearance,DefaultFont].png differ diff --git a/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,DefaultAppearance,LargeFont].png b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,DefaultAppearance,LargeFont].png new file mode 100644 index 00000000000..03dd51867ad Binary files /dev/null and b/paymentsheet/src/test/snapshots/images/com.stripe.android.paymentsheet.ui_DefaultPaymentMethodLabelScreenshotTest_testDefaultPaymentMethodLabel[LightTheme,DefaultAppearance,LargeFont].png differ