diff --git a/stripe/src/main/java/com/stripe/android/view/CardInputWidget.kt b/stripe/src/main/java/com/stripe/android/view/CardInputWidget.kt index 415d25559fc..d612f9a29f2 100644 --- a/stripe/src/main/java/com/stripe/android/view/CardInputWidget.kt +++ b/stripe/src/main/java/com/stripe/android/view/CardInputWidget.kt @@ -381,24 +381,31 @@ class CardInputWidget @JvmOverloads constructor( /** * Expose a text watcher to receive updates when the card number is changed. */ - fun setCardNumberTextWatcher(cardNumberTextWatcher: TextWatcher?) { + override fun setCardNumberTextWatcher(cardNumberTextWatcher: TextWatcher?) { cardNumberEditText.addTextChangedListener(cardNumberTextWatcher) } /** * Expose a text watcher to receive updates when the expiry date is changed. */ - fun setExpiryDateTextWatcher(expiryDateTextWatcher: TextWatcher?) { + override fun setExpiryDateTextWatcher(expiryDateTextWatcher: TextWatcher?) { expiryDateEditText.addTextChangedListener(expiryDateTextWatcher) } /** * Expose a text watcher to receive updates when the cvc number is changed. */ - fun setCvcNumberTextWatcher(cvcNumberTextWatcher: TextWatcher?) { + override fun setCvcNumberTextWatcher(cvcNumberTextWatcher: TextWatcher?) { cvcNumberEditText.addTextChangedListener(cvcNumberTextWatcher) } + /** + * Expose a text watcher to receive updates when the cvc number is changed. + */ + override fun setPostalCodeTextWatcher(postalCodeTextWatcher: TextWatcher?) { + postalCodeEditText.addTextChangedListener(postalCodeTextWatcher) + } + /** * Override of [View.isEnabled] that returns `true` only * if all three sub-controls are enabled. diff --git a/stripe/src/main/java/com/stripe/android/view/CardMultilineWidget.kt b/stripe/src/main/java/com/stripe/android/view/CardMultilineWidget.kt index 814d57027d7..14ab6d445d1 100644 --- a/stripe/src/main/java/com/stripe/android/view/CardMultilineWidget.kt +++ b/stripe/src/main/java/com/stripe/android/view/CardMultilineWidget.kt @@ -415,28 +415,28 @@ class CardMultilineWidget @JvmOverloads constructor( /** * Expose a text watcher to receive updates when the card number is changed. */ - fun setCardNumberTextWatcher(cardNumberTextWatcher: TextWatcher?) { + override fun setCardNumberTextWatcher(cardNumberTextWatcher: TextWatcher?) { cardNumberEditText.addTextChangedListener(cardNumberTextWatcher) } /** * Expose a text watcher to receive updates when the expiry date is changed. */ - fun setExpiryDateTextWatcher(expiryDateTextWatcher: TextWatcher?) { + override fun setExpiryDateTextWatcher(expiryDateTextWatcher: TextWatcher?) { expiryDateEditText.addTextChangedListener(expiryDateTextWatcher) } /** * Expose a text watcher to receive updates when the cvc number is changed. */ - fun setCvcNumberTextWatcher(cvcNumberTextWatcher: TextWatcher?) { + override fun setCvcNumberTextWatcher(cvcNumberTextWatcher: TextWatcher?) { cvcEditText.addTextChangedListener(cvcNumberTextWatcher) } /** * Expose a text watcher to receive updates when the cvc number is changed. */ - fun setPostalCodeTextWatcher(postalCodeTextWatcher: TextWatcher?) { + override fun setPostalCodeTextWatcher(postalCodeTextWatcher: TextWatcher?) { postalCodeEditText.addTextChangedListener(postalCodeTextWatcher) } diff --git a/stripe/src/main/java/com/stripe/android/view/CardWidget.kt b/stripe/src/main/java/com/stripe/android/view/CardWidget.kt index 304f37ae190..143e383cfc7 100644 --- a/stripe/src/main/java/com/stripe/android/view/CardWidget.kt +++ b/stripe/src/main/java/com/stripe/android/view/CardWidget.kt @@ -1,5 +1,6 @@ package com.stripe.android.view +import android.text.TextWatcher import androidx.annotation.IntRange import com.stripe.android.model.Card import com.stripe.android.model.PaymentMethodCreateParams @@ -28,6 +29,26 @@ internal interface CardWidget { fun setCardInputListener(listener: CardInputListener?) + /** + * Expose a text watcher to receive updates when the card number is changed. + */ + fun setCardNumberTextWatcher(cardNumberTextWatcher: TextWatcher?) + + /** + * Expose a text watcher to receive updates when the expiry date is changed. + */ + fun setExpiryDateTextWatcher(expiryDateTextWatcher: TextWatcher?) + + /** + * Expose a text watcher to receive updates when the cvc number is changed. + */ + fun setCvcNumberTextWatcher(cvcNumberTextWatcher: TextWatcher?) + + /** + * Expose a text watcher to receive updates when the cvc number is changed. + */ + fun setPostalCodeTextWatcher(postalCodeTextWatcher: TextWatcher?) + fun setCardHint(cardHint: String) fun clear()