From c776762dfe6b3e2331a994494752ef43ff4d9ef6 Mon Sep 17 00:00:00 2001 From: "a.ignatov" <> Date: Thu, 8 Jun 2023 15:36:01 +0500 Subject: [PATCH] New design --- .../demo/screens/main/MainActivity.kt | 127 +++---- app/src/main/res/layout/activity_checkout.xml | 3 +- app/src/main/res/layout/activity_main.xml | 23 +- gradle.properties | 3 +- .../java/ru/cloudpayments/sdk/card/Card.kt | 47 +-- .../sdk/configuration/PaymentConfiguration.kt | 2 +- .../sdk/configuration/PaymentData.kt | 2 +- .../cloudpayments/sdk/ui/PaymentActivity.kt | 56 +-- .../sdk/ui/dialogs/PaymentCardFragment.kt | 155 ++++---- .../sdk/ui/dialogs/PaymentOptionsFragment.kt | 135 ++++++- .../sdk/ui/dialogs/PaymentProcessFragment.kt | 49 +-- .../sdk/ui/dialogs/ThreeDsDialogFragment.kt | 4 +- .../base/BasePaymentBottomSheetFragment.kt | 108 ++++++ .../BasePaymentDialogFragment.kt} | 39 +- .../BaseVMBottomSheetFragment.kt} | 12 +- .../ui/dialogs/base/BaseVMDialogFragment.kt | 48 +++ .../cloudpayments/sdk/util/InjectorUtils.kt | 4 +- .../sdk/viewmodel/PaymentProcessViewModel.kt | 3 +- .../PaymentProcessViewModelFactory.kt | 3 +- .../cpsdk_ic_checkbox_checked.png | Bin 0 -> 494 bytes .../cpsdk_ic_checkbox_unchecked.png | Bin 0 -> 252 bytes .../res/drawable-hdpi/cpsdk_ic_failure.png | Bin 0 -> 6712 bytes .../res/drawable-hdpi/cpsdk_ic_progress.png | Bin 0 -> 8576 bytes .../res/drawable-hdpi/cpsdk_ic_success.png | Bin 0 -> 7250 bytes .../main/res/drawable-hdpi/drag_handle.png | Bin 0 -> 203 bytes .../res/drawable-hdpi/ic_required_email.png | Bin 0 -> 380 bytes .../cpsdk_ic_checkbox_unchecked.png | Bin 0 -> 198 bytes .../res/drawable-mdpi/cpsdk_ic_failure.png | Bin 0 -> 3450 bytes .../res/drawable-mdpi/cpsdk_ic_progress.png | Bin 0 -> 3571 bytes .../res/drawable-mdpi/cpsdk_ic_success.png | Bin 0 -> 3260 bytes .../main/res/drawable-mdpi/drag_handle.png | Bin 0 -> 186 bytes .../res/drawable-mdpi/ic_required_email.png | Bin 0 -> 285 bytes .../cpsdk_ic_checkbox_checked.png | Bin 0 -> 578 bytes .../cpsdk_ic_checkbox_unchecked.png | Bin 0 -> 256 bytes .../res/drawable-xhdpi/cpsdk_ic_failure.png | Bin 0 -> 9950 bytes .../res/drawable-xhdpi/cpsdk_ic_progress.png | Bin 0 -> 11687 bytes .../res/drawable-xhdpi/cpsdk_ic_success.png | Bin 0 -> 10664 bytes .../main/res/drawable-xhdpi/drag_handle.png | Bin 0 -> 197 bytes .../res/drawable-xhdpi/ic_required_email.png | Bin 0 -> 428 bytes .../cpsdk_ic_checkbox_checked.png | Bin 0 -> 801 bytes .../cpsdk_ic_checkbox_unchecked.png | Bin 0 -> 346 bytes .../res/drawable-xxhdpi/cpsdk_ic_failure.png | Bin 0 -> 20780 bytes .../res/drawable-xxhdpi/cpsdk_ic_progress.png | Bin 0 -> 25908 bytes .../res/drawable-xxhdpi/cpsdk_ic_success.png | Bin 0 -> 24043 bytes .../main/res/drawable-xxhdpi/drag_handle.png | Bin 0 -> 254 bytes .../res/drawable-xxhdpi/ic_required_email.png | Bin 0 -> 603 bytes .../cpsdk_ic_checkbox_checked.png | Bin 0 -> 1070 bytes .../cpsdk_ic_checkbox_unchecked.png | Bin 0 -> 381 bytes .../res/drawable-xxxhdpi/cpsdk_ic_failure.png | Bin 0 -> 33659 bytes .../drawable-xxxhdpi/cpsdk_ic_progress.png | Bin 0 -> 38096 bytes .../res/drawable-xxxhdpi/cpsdk_ic_success.png | Bin 0 -> 40574 bytes .../main/res/drawable-xxxhdpi/drag_handle.png | Bin 0 -> 265 bytes .../drawable-xxxhdpi/ic_required_email.png | Bin 0 -> 776 bytes .../res/drawable/cpsdk_bg_button_gp_black.xml | 2 +- .../main/res/drawable/cpsdk_bg_edit_text.xml | 14 + .../res/drawable/cpsdk_bg_edit_text_error.xml | 14 + .../drawable/cpsdk_bg_edit_text_focused.xml | 14 + .../drawable/cpsdk_bg_edit_text_selector.xml | 5 + .../cpsdk_bg_edit_text_selector_error.xml | 5 + .../drawable/cpsdk_bg_rounded_blue_button.xml | 12 + .../cpsdk_bg_rounded_bottom_sheet.xml | 10 + .../res/drawable/cpsdk_bg_rounded_dialog.xml | 9 + .../cpsdk_bg_rounded_dialog_inset.xml | 9 + .../drawable/cpsdk_ic_checkbox_selector.xml | 6 + .../main/res/drawable/cpsdk_ic_failure.xml | 18 - .../main/res/drawable/cpsdk_ic_progress.xml | 15 - .../main/res/drawable/cpsdk_ic_success.xml | 14 - .../main/res/drawable/cpsdk_secured_logo.xml | 82 +++++ sdk/src/main/res/font/sf_pro_text_regular.ttf | Bin 0 -> 434120 bytes .../res/layout/activity_cpsdk_payment.xml | 3 +- .../res/layout/dialog_cpsdk_payment_card.xml | 334 ++++++++---------- .../layout/dialog_cpsdk_payment_options.xml | 180 ++++++---- .../layout/dialog_cpsdk_payment_process.xml | 139 ++++---- sdk/src/main/res/layout/googlepay_button.xml | 3 +- sdk/src/main/res/values-v21/styles.xml | 43 +-- sdk/src/main/res/values/colors.xml | 4 +- sdk/src/main/res/values/strings.xml | 22 +- sdk/src/main/res/values/styles.xml | 111 ++++-- 78 files changed, 1154 insertions(+), 737 deletions(-) create mode 100644 sdk/src/main/java/ru/cloudpayments/sdk/ui/dialogs/base/BasePaymentBottomSheetFragment.kt rename sdk/src/main/java/ru/cloudpayments/sdk/ui/dialogs/{BasePaymentFragment.kt => base/BasePaymentDialogFragment.kt} (66%) rename sdk/src/main/java/ru/cloudpayments/sdk/ui/dialogs/{BaseVMFragment.kt => base/BaseVMBottomSheetFragment.kt} (54%) create mode 100644 sdk/src/main/java/ru/cloudpayments/sdk/ui/dialogs/base/BaseVMDialogFragment.kt create mode 100644 sdk/src/main/res/drawable-hdpi/cpsdk_ic_checkbox_checked.png create mode 100644 sdk/src/main/res/drawable-hdpi/cpsdk_ic_checkbox_unchecked.png create mode 100644 sdk/src/main/res/drawable-hdpi/cpsdk_ic_failure.png create mode 100644 sdk/src/main/res/drawable-hdpi/cpsdk_ic_progress.png create mode 100644 sdk/src/main/res/drawable-hdpi/cpsdk_ic_success.png create mode 100644 sdk/src/main/res/drawable-hdpi/drag_handle.png create mode 100644 sdk/src/main/res/drawable-hdpi/ic_required_email.png create mode 100644 sdk/src/main/res/drawable-mdpi/cpsdk_ic_checkbox_unchecked.png create mode 100644 sdk/src/main/res/drawable-mdpi/cpsdk_ic_failure.png create mode 100644 sdk/src/main/res/drawable-mdpi/cpsdk_ic_progress.png create mode 100644 sdk/src/main/res/drawable-mdpi/cpsdk_ic_success.png create mode 100644 sdk/src/main/res/drawable-mdpi/drag_handle.png create mode 100644 sdk/src/main/res/drawable-mdpi/ic_required_email.png create mode 100644 sdk/src/main/res/drawable-xhdpi/cpsdk_ic_checkbox_checked.png create mode 100644 sdk/src/main/res/drawable-xhdpi/cpsdk_ic_checkbox_unchecked.png create mode 100644 sdk/src/main/res/drawable-xhdpi/cpsdk_ic_failure.png create mode 100644 sdk/src/main/res/drawable-xhdpi/cpsdk_ic_progress.png create mode 100644 sdk/src/main/res/drawable-xhdpi/cpsdk_ic_success.png create mode 100644 sdk/src/main/res/drawable-xhdpi/drag_handle.png create mode 100644 sdk/src/main/res/drawable-xhdpi/ic_required_email.png create mode 100644 sdk/src/main/res/drawable-xxhdpi/cpsdk_ic_checkbox_checked.png create mode 100644 sdk/src/main/res/drawable-xxhdpi/cpsdk_ic_checkbox_unchecked.png create mode 100644 sdk/src/main/res/drawable-xxhdpi/cpsdk_ic_failure.png create mode 100644 sdk/src/main/res/drawable-xxhdpi/cpsdk_ic_progress.png create mode 100644 sdk/src/main/res/drawable-xxhdpi/cpsdk_ic_success.png create mode 100644 sdk/src/main/res/drawable-xxhdpi/drag_handle.png create mode 100644 sdk/src/main/res/drawable-xxhdpi/ic_required_email.png create mode 100644 sdk/src/main/res/drawable-xxxhdpi/cpsdk_ic_checkbox_checked.png create mode 100644 sdk/src/main/res/drawable-xxxhdpi/cpsdk_ic_checkbox_unchecked.png create mode 100644 sdk/src/main/res/drawable-xxxhdpi/cpsdk_ic_failure.png create mode 100644 sdk/src/main/res/drawable-xxxhdpi/cpsdk_ic_progress.png create mode 100644 sdk/src/main/res/drawable-xxxhdpi/cpsdk_ic_success.png create mode 100644 sdk/src/main/res/drawable-xxxhdpi/drag_handle.png create mode 100644 sdk/src/main/res/drawable-xxxhdpi/ic_required_email.png create mode 100644 sdk/src/main/res/drawable/cpsdk_bg_edit_text.xml create mode 100644 sdk/src/main/res/drawable/cpsdk_bg_edit_text_error.xml create mode 100644 sdk/src/main/res/drawable/cpsdk_bg_edit_text_focused.xml create mode 100644 sdk/src/main/res/drawable/cpsdk_bg_edit_text_selector.xml create mode 100644 sdk/src/main/res/drawable/cpsdk_bg_edit_text_selector_error.xml create mode 100644 sdk/src/main/res/drawable/cpsdk_bg_rounded_blue_button.xml create mode 100644 sdk/src/main/res/drawable/cpsdk_bg_rounded_bottom_sheet.xml create mode 100644 sdk/src/main/res/drawable/cpsdk_bg_rounded_dialog.xml create mode 100644 sdk/src/main/res/drawable/cpsdk_bg_rounded_dialog_inset.xml create mode 100644 sdk/src/main/res/drawable/cpsdk_ic_checkbox_selector.xml delete mode 100644 sdk/src/main/res/drawable/cpsdk_ic_failure.xml delete mode 100644 sdk/src/main/res/drawable/cpsdk_ic_progress.xml delete mode 100644 sdk/src/main/res/drawable/cpsdk_ic_success.xml create mode 100644 sdk/src/main/res/drawable/cpsdk_secured_logo.xml create mode 100644 sdk/src/main/res/font/sf_pro_text_regular.ttf diff --git a/app/src/main/java/ru/cloudpayments/demo/screens/main/MainActivity.kt b/app/src/main/java/ru/cloudpayments/demo/screens/main/MainActivity.kt index 32c0532..89813d1 100644 --- a/app/src/main/java/ru/cloudpayments/demo/screens/main/MainActivity.kt +++ b/app/src/main/java/ru/cloudpayments/demo/screens/main/MainActivity.kt @@ -11,7 +11,6 @@ import ru.cloudpayments.sdk.configuration.CloudpaymentsSDK import ru.cloudpayments.sdk.configuration.PaymentConfiguration import ru.cloudpayments.sdk.configuration.PaymentData - class MainActivity : BaseActivity() { private val cpSdkLauncher = CloudpaymentsSDK.getInstance().launcher(this, result = { @@ -39,66 +38,74 @@ class MainActivity : BaseActivity() { val view = binding.root setContentView(view) - binding.buttonRun.setOnClickListener { + binding.buttonRunTop.setOnClickListener { + runCpSdk() + } - val apiUrl = binding.editApiUrl.text.toString() - val publicId = binding.editPublicId.text.toString() - val amount = binding.editAmount.text.toString() - val currency = binding.editCurrency.text.toString() - val invoiceId = binding.editInvoiceId.text.toString() - val description = binding.editDescription.text.toString() - val accountId = binding.editAccountId.text.toString() - val email = binding.editEmail.text.toString() - - val payerFirstName = binding.editPayerFirstName.text.toString() - val payerLastName = binding.editPayerLastName.text.toString() - val payerMiddleName = binding.editPayerMiddleName.text.toString() - val payerBirthDay = binding.editPayerBirth.text.toString() - val payerAddress = binding.editPayerAddress.text.toString() - val payerStreet = binding.editPayerStreet.text.toString() - val payerCity = binding.editPayerCity.text.toString() - val payerCountry = binding.editPayerCountry.text.toString() - val payerPhone = binding.editPayerPhone.text.toString() - val payerPostcode = binding.editPayerPostcode.text.toString() - - val jsonData = binding.editJsonData.text.toString() - val isDualMessagePayment = binding.checkboxDualMessagePayment.isChecked - - var payer = PaymentDataPayer() - payer.firstName = payerFirstName - payer.lastName = payerLastName - payer.middleName = payerMiddleName - payer.birthDay = payerBirthDay - payer.address = payerAddress - payer.street = payerStreet - payer.city = payerCity - payer.country = payerCountry - payer.phone = payerPhone - payer.postcode = payerPostcode - - val paymentData = PaymentData( - amount = amount, - currency = currency, - invoiceId = invoiceId, - description = description, - accountId = accountId, - email = email, - payer = payer, - jsonData = jsonData - ) - - val configuration = PaymentConfiguration( - publicId = publicId, - paymentData = paymentData, - scanner = CardIOScanner(), - showEmailField = true, - useDualMessagePayment = isDualMessagePayment, - disableGPay = false, - disableYandexPay = false, - yandexPayMerchantID = "1423423564546767575", - apiUrl = apiUrl - ) - cpSdkLauncher.launch(configuration) + binding.buttonRun.setOnClickListener { + runCpSdk() } } + + private fun runCpSdk() { + + val apiUrl = binding.editApiUrl.text.toString() + val publicId = binding.editPublicId.text.toString() + val amount = binding.editAmount.text.toString() + val currency = binding.editCurrency.text.toString() + val invoiceId = binding.editInvoiceId.text.toString() + val description = binding.editDescription.text.toString() + val accountId = binding.editAccountId.text.toString() + val email = binding.editEmail.text.toString() + + val payerFirstName = binding.editPayerFirstName.text.toString() + val payerLastName = binding.editPayerLastName.text.toString() + val payerMiddleName = binding.editPayerMiddleName.text.toString() + val payerBirthDay = binding.editPayerBirth.text.toString() + val payerAddress = binding.editPayerAddress.text.toString() + val payerStreet = binding.editPayerStreet.text.toString() + val payerCity = binding.editPayerCity.text.toString() + val payerCountry = binding.editPayerCountry.text.toString() + val payerPhone = binding.editPayerPhone.text.toString() + val payerPostcode = binding.editPayerPostcode.text.toString() + + val jsonData = binding.editJsonData.text.toString() + val isDualMessagePayment = binding.checkboxDualMessagePayment.isChecked + + var payer = PaymentDataPayer() + payer.firstName = payerFirstName + payer.lastName = payerLastName + payer.middleName = payerMiddleName + payer.birthDay = payerBirthDay + payer.address = payerAddress + payer.street = payerStreet + payer.city = payerCity + payer.country = payerCountry + payer.phone = payerPhone + payer.postcode = payerPostcode + + val paymentData = PaymentData( + amount = amount, + currency = currency, + invoiceId = invoiceId, + description = description, + accountId = accountId, + email = email, + payer = payer, + jsonData = jsonData + ) + + val configuration = PaymentConfiguration( + publicId = publicId, + paymentData = paymentData, + scanner = CardIOScanner(), + requireEmail = false, + useDualMessagePayment = isDualMessagePayment, + disableGPay = false, + disableYandexPay = false, + yandexPayMerchantID = "", + apiUrl = apiUrl + ) + cpSdkLauncher.launch(configuration) + } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_checkout.xml b/app/src/main/res/layout/activity_checkout.xml index 689d9df..aafcfdf 100644 --- a/app/src/main/res/layout/activity_checkout.xml +++ b/app/src/main/res/layout/activity_checkout.xml @@ -144,8 +144,7 @@ android:layout_marginTop="@dimen/ui_margin_16dp" android:layout_marginRight="@dimen/ui_margin_16dp" android:text="@string/checkout_payment" - app:backgroundTint="@color/colorAccent" - style="@style/cpsdk_UnelevatedButton"/> + app:backgroundTint="@color/colorAccent"/> - + android:background="@android:color/white"> +