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

Use more clear names for methods changing unit of value. #15

Merged
merged 2 commits into from Sep 9, 2021

Conversation

pelmenstar1
Copy link
Contributor

For example expression 2.px tells nothing about from what to what unit we convert. It's better to use dpToPx name. This name tells us that we convert from dp to pixels. Everything is clear.
Int.dp -> pxToDp(Float): Float
Int.sp -> spToPx(Float): Float

And argument and return type are changed to Float, because more often we use Float, not Int

For example expression 2.px tells nothing about from what to what unit we convert. It's better to use dpToPx name. This name tells us that we convert from dp to pixels. Everything is clear.
Int.dp -> pxToDp(Float): Float
Int.sp -> spToPx(Float): Float

And argument and return type are changed to Float, because more often we use Float, not Int
@Droppers
Copy link
Owner

LGTM but there are some conflicts.

# Conflicts:
#	timerangepicker/src/main/java/nl/joery/timerangepicker/DefaultClockRenderer.kt
#	timerangepicker/src/main/java/nl/joery/timerangepicker/TimeRangePicker.kt
@Droppers Droppers merged commit cb3418a into Droppers:main Sep 9, 2021
@pelmenstar1 pelmenstar1 deleted the more-clear-extensions branch September 10, 2021 17:26
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.

None yet

2 participants