-
Notifications
You must be signed in to change notification settings - Fork 56
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
base: v3
Are you sure you want to change the base?
Conversation
…ady been declared custom.
2a63c7c
to
e09235d
Compare
@@ -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> |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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){ }
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here: b13a2db
Summary of changes
shape
toedges
Checklist
Screenshot
Authors