-
Notifications
You must be signed in to change notification settings - Fork 659
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
Fix an issue where the primary button got extra wide on configuration changes. #6326
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 14 additions & 8 deletions
22
paymentsheet/res/layout/fragment_primary_button_container.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<com.stripe.android.paymentsheet.ui.PrimaryButton xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:id="@+id/primary_button" | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="@dimen/stripe_paymentsheet_primary_button_height" | ||
android:layout_marginTop="@dimen/stripe_paymentsheet_button_container_spacing" | ||
android:layout_marginStart="@dimen/stripe_paymentsheet_outer_spacing_horizontal" | ||
android:layout_marginEnd="@dimen/stripe_paymentsheet_outer_spacing_horizontal" | ||
android:text="@string/stripe_paymentsheet_pay_button_label" | ||
android:visibility="gone" /> | ||
android:layout_height="wrap_content"> | ||
<!-- Needs to be wrapped in a FrameLayout to prevent layout issues after configuration changes. --> | ||
|
||
<com.stripe.android.paymentsheet.ui.PrimaryButton | ||
android:id="@+id/primary_button" | ||
android:layout_width="match_parent" | ||
android:layout_height="@dimen/stripe_paymentsheet_primary_button_height" | ||
android:layout_marginTop="@dimen/stripe_paymentsheet_button_container_spacing" | ||
android:layout_marginStart="@dimen/stripe_paymentsheet_outer_spacing_horizontal" | ||
android:layout_marginEnd="@dimen/stripe_paymentsheet_outer_spacing_horizontal" | ||
android:text="@string/stripe_paymentsheet_pay_button_label" | ||
android:visibility="gone" /> | ||
</FrameLayout> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
My guess is it's a compose bug. But I didn't look to far into it since the mitigation was low cost.
I've run into this before, which is why I suspected this and fixed it here. The layout inflator isn't taking into account the root view (from this XML file) layout params into account when inflating the view. An easy way around that is to not have any layout params in the root view, but keep them in the nested view, which is what I did here.