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

Made CompassButton more customizable #251

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

michalgwo
Copy link
Contributor

As discussed in #250, I made Compass Button more customizable:

  • allowed setting the size of the button
  • allowed setting drawable of the needle

In addition, 2 changes that seemed reasonable:

  • allowed setting content description of DisappearingCompassButton
  • set the default content description of CompassButton to string resource, instead of hardcoded string

Copy link
Collaborator

@westnordost westnordost left a comment

Choose a reason for hiding this comment

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

Does this actually place the chosen icon in the center when a very large size is specified (or the icon is very small)?

@michalgwo
Copy link
Contributor Author

Yes. The sizes on the screenshots are 30.dp and 300.dp. The icon is vector drawable with 24 dp height and 24 dp width, I don't think the size of the drawable matters as it's in the centre no matter how big the button is. What I noticed now, the icon may go out of bounds when the button is big enough (as you can see in the last screenshot), and barely noticeable, when the button is small, so it may be a good idea to have contentPadding customizable as well.

73e08dc7-6a9c-43f1-a324-3d286594743a 135b8a7f-b94c-41e8-a48b-2d42470030a6 ca0ed5e6-5075-4880-a293-cd72ebdd6118

@michalgwo
Copy link
Contributor Author

Now it looks better. I also made the shape of the button customizable, as it was the last thing that wasn't customizable.

24345b36-ff72-419b-a729-9bf8e35a48fd ad68584b-4eb1-4477-bd68-5e536b5b6940

@michalgwo
Copy link
Contributor Author

Actually, it may be a good idea to make the default contentPadding depend on the size, instead of hardcoding 8.dp, any thoughts on this?

contentPadding: PaddingValues = PaddingValues(size / 6)

@sargunv
Copy link
Owner

sargunv commented Jan 15, 2025

Thanks for the PR! Looks reasonable to me, will review properly in a bit.

it may be a good idea to make the default contentPadding depend on the size, instead of hardcoding 8.dp, any thoughts on this?

That sounds good to me, though I don't have a strong preference either way.

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