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

Draw divider for list header/footer views #268

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yhpark
Copy link
Contributor

@yhpark yhpark commented Feb 16, 2014

Dividers for header/footer view is drawn in ListView by default. I made a patch to imitate this drawing using pattern already being used in the library; making use of WrapperView. Header/footer view is now wrapped by WrapperView and managed with a little more care.

WrapperViewList.java:112-121
As each divider in WrapperView is drawn by the view below, the last divider at the bottom has to be drawn differently. (fyi: divider at the bottom is only shown when items of the ListView doesn't fill all the ListView's space. Refer to the screenshots in this SO question)

Further improvement would be to implement android:header(footer)dividersenabled, giving on/off functionality.

If you would merge please review the code throughly. Though I tested several cases I may have not caught all the edge cases. I'd be glad to take any feedback.

@emilsjolander
Copy link
Owner

I'll look through the code later today but in the mean time it would be great to implement android:header(footer)dividersenabled at the same time, would be weird not to support this feature all the way ;)

@yhpark
Copy link
Contributor Author

yhpark commented Feb 17, 2014

The return value of removeHeader(Footer)View() is weird. When adapter is not attached, it always returns false(?). I made a fix regarding the issue as well as implementing android:header(footer)dividersenabled.

@yhpark
Copy link
Contributor Author

yhpark commented Feb 20, 2014

It turns out the bug I described in the previous comment, which I just deleted, was not relevant to the changes from this pull request. I've made a separate PR(#270) to deal with the issue.

@@ -123,6 +123,7 @@ public StickyListHeadersListView(Context context, AttributeSet attrs, int defSty
mDividerHeight = mList.getDividerHeight();
mList.setDivider(null);
mList.setDividerHeight(0);
mList.setListDivider(mDivider, mDividerHeight);
Copy link
Owner

Choose a reason for hiding this comment

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

This is very confusing as it looks like the two above line of code are useless even though they aren't

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because mDivider and mDividerHeight must be passed to mList, those three set*Divider*()s will be there anyway. I'd love to make it less confusing, yet nothing came up in my mind for now.

@emilsjolander
Copy link
Owner

Sorry for the delay but i haven't had any time to look over fixing some of the issues i have with the code.

@jaredsburrows
Copy link

+1 Why has this not been merged?

@FireZenk
Copy link

FireZenk commented Mar 8, 2016

+1

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.

6 participants