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

Fix 34 - GridDividerItemDecoration item offsets do not space columns correctly #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mobiRic
Copy link

@mobiRic mobiRic commented Mar 2, 2018

Fixes #34

The current library only supports vertical orientation which means that we can expand the grid vertically if required. So vertical offset calculation is simple, merely moving items down.

The current horizontal spacing method does the same as the vertical method, and ends up pushing items off the grid to the right (this is easiest seen with a wide divider, say 32dp). This is because there is only a fixed horizontal width available that needs to contain the items and the dividers.

This PR calculates the amount of offset for each column to make sure that they are all evenly spaced across the width of the grid.


I hope you do not mind adding the comment there - I spent quite a long time trying to figure out the purpose of some of the variables and I hope this comment helps future maintainers.

As with all contributions to foreign repos, I'm happy to change the styling to be consistent with your team so let me know what I should change.

Given a fixed width of the grid, the horizontal offset of each columns need to be calculated proportionately to its position.

Resolves: bignerdranch#34
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.

GridDividerItemDecoration item offsets do not space columns correctly
1 participant