Skip to content

Rename PaymentButton shape Property to edges #325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

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

Open
wants to merge 15 commits into
base: v3
Choose a base branch
from

Conversation

sshropshire
Copy link
Collaborator

@sshropshire sshropshire commented May 23, 2025

Summary of changes

  • This PR renames PaymentButton's shape to edges

Checklist

  • Added a changelog entry

Screenshot

Authors

List GitHub usernames for everyone who contributed to this pull request.

@sshropshire sshropshire changed the base branch from main to v3 May 23, 2025 19:02
@sshropshire sshropshire marked this pull request as ready for review May 27, 2025 19:52
@sshropshire sshropshire requested a review from a team as a code owner May 27, 2025 19:52
@sshropshire sshropshire force-pushed the v3__rename_shape_property branch from 2a63c7c to e09235d Compare May 28, 2025 15:30
@@ -24,6 +26,6 @@
<dimen name="paypal_payment_button_label_text_size_large">18sp</dimen>

<!-- Make logo height 76% of button -->
<item name="paypal_payment_button_logo_weight" type="dimen" format="float">0.76</item>
<item name="paypal_payment_button_vertical_spacer_weight" type="dimen" format="float">0.12</item>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the additional type="dimen" and float="float" attributes were necessary at one point, but I was able to verify using <dimen /> by itself works fine.


data class PayPalButtonsUiState(
val fundingType: ButtonFundingType = ButtonFundingType.PAYPAL,
val payPalCreditButtonColor: PayPalCreditButtonColor = PayPalCreditButtonColor.BLUE,
val payPalButtonColor: PayPalButtonColor = PayPalButtonColor.BLUE,
val payPalButtonLabel: PayPalButtonLabel = PayPalButtonLabel.PAYPAL,
val paymentButtonShape: PaymentButtonShape = PaymentButtonShape.ROUNDED,
val customCornerRadius: Int? = null
val paymentButtonEdges: PaymentButtonEdges = PaymentButtonEdges.Soft,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paymentButtonEdges to paymentButtonEdge since it only holds 1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ticket calls for edges as the property name. We may need keep this for feature parity with iOS for now.

@@ -0,0 +1,30 @@
package com.paypal.android.paymentbuttons

sealed class PaymentButtonEdges {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PaymentButtonEdges to PaymentButtonEdge same in other places also

@@ -323,6 +259,27 @@ abstract class PaymentButton<C : PaymentButtonColor> @JvmOverloads constructor(
prefixTextView.setTextColor(textColor)
suffixTextView.setTextColor(textColor)
}

private fun applyEdgeStyling() {
val cornerSize: Float = when (val edges = edges) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need scoped val here when(edge){ }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I initially had when (edges) but oddly it doesn't compile without the val edges = edges assignment.

IntSlider(
value = cornerRadius.toInt(),
valueRange = 0..CORNER_RADIUS_SLIDER_MAX,
steps = CORNER_RADIUS_SLIDER_MAX,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max in valueRange and steps same? means we can either select 0 or max?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this code does is set the number of steps equal to the max value. In this case the max is 100, so there should be 100 valid step values.

I can refactor this so the intent is more clear. Something like valueRange.length would be better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here: b13a2db

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants