Skip to content
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

refactor+docs: use paddingRelative in AlertDialog.customView #17660

Merged
merged 2 commits into from
Dec 28, 2024

Conversation

BrayanDSO
Copy link
Member

Small refactor extracted from other changes

Using start and end is more encouraged in Android due to support for RTL languages

All the right and left padding values were the same, so the replacements create no differences

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Dec 25, 2024
@mikehardy
Copy link
Member

mikehardy commented Dec 26, 2024

Hey @BrayanDSO I saw this and my first reaction was " 🤦 I always forget these right/left -> start/end" RTL issues"

And my second reaction was "why doesn't lint catch these?". I don't have a good answer for that - #8282 discusses it but it appears that the built-in lint checks which we do have enabled simply don't catch it and we don't have a custom check

So my final reaction was "I'm sure there are more of these, maybe I can just fix them really quickly?"

After some consultation (https://medium.com/android-news/rtl-support-on-android-here-is-all-you-need-know-e13f2df512e2 seemed like a good resource that summarizes all of my learning as I looked into it)...

I rudely hacked a second commit on here which I think does a codebase-wide fix for all existing RTL hard-coded right/left type stuff.

I say rudely because I never asked, which means I am obligated to be more than happy for you or anyone reviewing to go "nope" and just drop the commit, no offense will be taken at all

But maybe the commit looks good ?

Maybe we should reopen 8282 or open a new one asking for a custom lint that checks for:

  • any use of paddingLeft / paddingRight
  • any use of setPadding vs setPaddingRelative
  • any use of setMargins without also using setMarginStart and setMarginEnd to kick it into relative mode

We don't have a label for "Reviewer added a commit that may be crap" but that's the intended reading of me adding "Needs Author Reply" label. Act as you see fit

@mikehardy mikehardy added the Needs Author Reply Waiting for a reply from the original author label Dec 26, 2024
@BrayanDSO BrayanDSO added Needs reviewer reply Waiting for a reply from another reviewer and removed Needs Author Reply Waiting for a reply from the original author labels Dec 26, 2024
there is no lint that reliably catches these apparently, this
was an AndroidStudio search for paddingLeft/paddingRight and altering
all returned items
@mikehardy mikehardy added Needs Author Reply Waiting for a reply from the original author and removed Needs reviewer reply Waiting for a reply from another reviewer labels Dec 27, 2024
@BrayanDSO BrayanDSO removed the Needs Author Reply Waiting for a reply from the original author label Dec 28, 2024
@BrayanDSO
Copy link
Member Author

Still LGTM

@david-allison david-allison added this pull request to the merge queue Dec 28, 2024
Merged via the queue into ankidroid:main with commit 010c429 Dec 28, 2024
9 checks passed
@github-actions github-actions bot added this to the 2.21 release milestone Dec 28, 2024
@github-actions github-actions bot removed the Needs Second Approval Has one approval, one more approval to merge label Dec 28, 2024
@mikehardy
Copy link
Member

Thanks @BrayanDSO and thanks for letting my semi-hijack your PR. i18n and l10n (for example, LTR...) stuff I try to get whenever I see it because otherwise it seems like it just never happens as it's pretty low-interest

@BrayanDSO BrayanDSO deleted the ref branch December 29, 2024 21:01
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.

3 participants