Skip to content

Commit

Permalink
Add save this card checkbox to PaymentSheet (#2974)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshafrir-stripe authored Oct 27, 2020
1 parent 00de39b commit 48bc353
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
38 changes: 32 additions & 6 deletions stripe/res/layout/fragment_paymentsheet_add_card.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/stripe_paymentsheet_outer_spacing"
tools:context=".paymentsheet.PaymentSheetPaymentMethodsListFragment">

<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="wrap_content">
<TextView
android:id="@+id/add_card_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/stripe_paymentsheet_add_payment_method"
android:textSize="24sp"
android:textStyle="bold"
android:paddingBottom="10dp" />
android:paddingBottom="10dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/card_multiline_widget"
app:layout_constraintStart_toStartOf="parent" />

<com.stripe.android.view.CardMultilineWidget
android:id="@+id/card_multiline_widget"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/add_card_header"
app:layout_constraintBottom_toTopOf="@+id/save_card_checkbox"
app:layout_constraintStart_toStartOf="parent" />

<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/save_card_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
app:layout_constraintTop_toBottomOf="@+id/card_multiline_widget"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<TextView
android:id="@+id/save_card_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/stripe_paymentsheet_save_this_card"
android:labelFor="@+id/save_card_checkbox"
app:layout_constraintTop_toTopOf="@+id/save_card_checkbox"
app:layout_constraintBaseline_toBaselineOf="@+id/save_card_checkbox"
app:layout_constraintStart_toEndOf="@+id/save_card_checkbox" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
1 change: 1 addition & 0 deletions stripe/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
<string name="stripe_paymentsheet_pay_using" tools:ignore="MissingTranslation">Pay using</string>
<string name="stripe_paymentsheet_add_payment_method" tools:ignore="MissingTranslation">Add payment method</string>
<string name="stripe_paymentsheet_add_payment_method_button" tools:ignore="MissingTranslation">+ Add new</string>
<string name="stripe_paymentsheet_save_this_card" tools:ignore="MissingTranslation">Save this card</string>

<!-- The payment amount (e.g. "Pay $25.00") -->
<string name="stripe_paymentsheet_pay_button_amount" tools:ignore="MissingTranslation">Pay %s</string>
Expand Down

0 comments on commit 48bc353

Please sign in to comment.