相关文章推荐

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account
  • launch "scan the card (number)" with button
  • return to the original activity with credit card input
  • edit the credit card (and fill rest of the fields)
  • In this scenario, when returning into original activity, user would like the keyboard to be open (in correct mode) and have the cursor (force focus) in credit card number (or any other preferred) field. With current credit card input we do achieve this by requesting focus and force opening the sw keyboard. That is not possible with Stripe widget.
    Would it be possible to get requestFocus(focusField) in the CardInputWidget?

    We currently use another component for the card input in Android (Stripe for iOS). But now that Stripe widget seems a lot more stable option than the existing, I will take it into use in Android anyways. We also use Stripe as payment method.

    P.S Another problem is, that there is no control over what IME_ACTION_DONE does. I was a bit surprised that Stripe widget didn't give any control over it. But there was already another issue about that so thats tackled!

    I was able to "hack" this with:

    val creditcardWidget: CardInputWidget by bindView(R.id.credit_card_widget)
    creditcardWidget.requestFocus()
    creditcardWidget.requestChildFocus(creditcardWidget.getChildAt(0), currentFocus)
    

    That seems to do the trick also :) But it would also be nice to have that helper in the api.

    Hi @sarihi! Thanks for writing in - let me make sure I understand what you're looking for!

    Inside the CardInputWidget, you'd like to be able to be able to put focus on the EditText where the credit card number is input?

    If that's the case, theoretically, we should already be requesting focus on that EditText by default.

    https://github.com/stripe/stripe-android/blob/master/stripe/src/main/java/com/stripe/android/view/CardInputWidget.java#L597

    Thanks,
    Kathy

    @ksun-stripe, could this please be reopened? I also have the same issue where the keyboard is not displaying when the CardInputWidget has focus. Unfortunately the workaround provided by @sarihi didn't seem to work for me.

    Essentially, we have a fragment that contains a CardInputWidget. When opening the fragment, the cursor in the card number field is flashing, indicating that it would appear to have focus. However, the soft keyboard does not automatically open. To open the soft keyboard, the user then needs to press on the card number edit field.

    In contrast, if you had a fragment with standard EditText fields, if one of those was given focus, then the soft keyboard would automatically open.

     
    推荐文章