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

[Layouts] Add an InsetDividerLinearLayout component #8

Conversation

tadfisher
Copy link
Contributor

Ref #7

Adds a standalone modification to LinearLayoutCompat which allows for
control over divider insets. Users may specify "start" and "end" insets,
which affect the appropriate dimension in both horizontal and vertical
orientations, as well as LTR and RTL layout directions. Users may also
specify which dividers to inset, similar to the showDividers
attribute.

To make it easier to adhere to the Material Design baseline grid,
dividers are drawn over child views instead of offsetting them. This
also allows for backgrounds to be set directly on children without
leaving gaps where they would normally be offset.

Additionally, start/end dividers are drawn outside of the layout's
padding by ignoring child dimensions and simply drawing them along the
top/bottom (in vertical orientation) or left/right (in horizontal
orientation) edges of the layout. This makes it easier to apply the
recommended top/bottom padding to the layout per the Lists spec.

Tests were added to verify some basic behavior as well as covering all
permutations of inset mode, orientation, and layout direction. These
pass on emulators from platform versions 2.3.7 to 7.1.1.

Ref material-components#7

Adds a standalone modification to LinearLayoutCompat which allows for
control over divider insets. Users may specify "start" and "end" insets,
which affect the appropriate dimension in both horizontal and vertical
orientations, as well as LTR and RTL layout directions. Users may also
specify which dividers to inset, similar to the `showDividers`
attribute.

To make it easier to adhere to the Material Design baseline grid,
dividers are drawn over child views instead of offsetting them. This
also allows for backgrounds to be set directly on children without
leaving gaps where they would normally be offset.

* https://material.io/guidelines/layout/metrics-keylines.html#metrics-keylines-baseline-grids

Additionally, start/end dividers are drawn outside of the layout's
padding by ignoring child dimensions and simply drawing them along the
top/bottom (in vertical orientation) or left/right (in horizontal
orientation) edges of the layout. This makes it easier to apply the
recommended top/bottom padding to the layout per the Lists spec.

* https://material.io/guidelines/components/lists.html#lists-specs

Tests were added to verify some basic behavior as well as covering all
permutations of inset mode, orientation, and layout direction. These
pass on emulators from platform versions 2.3.7 to 7.1.1.
return (mApplyInsets & INSET_DIVIDER_END) != 0;
}

int getFirstVisibleChildIndex() {
Copy link
Contributor

Choose a reason for hiding this comment

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

@VisibleForTesting

return Integer.MAX_VALUE;
}

int getLastVisibleChildIndex() {
Copy link
Contributor

Choose a reason for hiding this comment

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

@VisibleForTesting

}
}

void drawDividersHorizontal(Canvas canvas) {
Copy link
Contributor

Choose a reason for hiding this comment

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

private? +the next two methods

@jestelle
Copy link

jestelle commented Jan 5, 2017

Thanks for the PR! We're catching up from holidays and new year planning. But we'll be giving this more attention soon!

@cketcham
Copy link
Contributor

Since this pr is quite old and there were no pings we're going to close it for now. If it is still a desirable addition to the library please ping on this pr. We'll reopen it and take a look.

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.

4 participants