【问题标题】:CardInputWidget is not animating when wrong details are entered输入错误的详细信息时,CardInputWidget 没有动画
【发布时间】:2020-05-13 08:36:09
【问题描述】:

当输入错误的详细信息时,CardInputWidget 不是animatingdocumentation 网站中提到它自己处理动画。

至少如果我能收到错误消息,如果不是动画,我可以在警告框中显示。

我找不到答案。请帮助解决问题。

这是我的代码

    private fun loadPage() {

    binding.payButton.setOnClickListener {

        val card = binding.cardInputWidget.paymentMethodCard
        val nameText = binding.nameInput.text.toString()

        binding.progressBar.visibility = View.VISIBLE

        if (nameText.isEmpty()) {
            Utilities.alertBoxSingleBtn(this, "Please fill the name field")
            binding.progressBar.visibility = View.GONE
            return@setOnClickListener
        }

        val billingDetails = PaymentMethod.BillingDetails.Builder()
                .setName(nameText)
                .build()
        if (card != null) { // Create SetupIntent confirm parameters with the above
            binding.payButton.isEnabled = false
            val paymentMethodParams = PaymentMethodCreateParams.create(card, billingDetails)
            val confirmParams = ConfirmSetupIntentParams.create(paymentMethodParams, clientSecretKey!!)
            stripe.confirmSetupIntent(this, confirmParams)
        } else {

            binding.payButton.isEnabled = true
            binding.progressBar.visibility = View.GONE
        }
    }
}

这是我的小部件代码

<com.stripe.android.view.CardInputWidget
        android:id="@+id/cardInputWidget"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/_20dp"
        android:layout_marginEnd="@dimen/_20dp"
        app:layout_constraintBottom_toTopOf="@+id/payButton"
        app:layout_constraintStart_toStartOf="@+id/nameInput"
        app:layout_constraintTop_toBottomOf="@+id/nameInput" />

【问题讨论】:

  • 你能解释一下你对动画本身的期望吗?此外,您可以做的是在用户输入卡号时使用 CardWidget 验证回调以显示错误消息card_input_widget.setCardValidCallback(CardValidCallback)
  • @wsw 在这个链接(stripe.com/img/docs/mobile/android/…),你能看到卡号在输入错误的时候变成红色吗?我的应用中没有发生这种情况

标签: java android kotlin stripe-payments


【解决方案1】:

此错误已在 Stripe android 版本 13.1.2 中重现。该错误已在13.2.0 中修复。

【讨论】:

    猜你喜欢
    • 2022-08-22
    • 2019-11-16
    • 2020-06-27
    • 1970-01-01
    • 2019-03-23
    • 2015-02-06
    • 1970-01-01
    • 2011-08-01
    • 1970-01-01
    相关资源
    最近更新 更多