header-decor icon indicating copy to clipboard operation
header-decor copied to clipboard

ReverseLayout not working?

Open mslobodan opened this issue 7 years ago • 9 comments

I set on my LinearLayout manager reverseLayout to true and sticky headers are not working. I want to see headers acting same as reverseLayout is set to false.

Can anybody help with this?

mslobodan avatar Mar 11 '17 18:03 mslobodan

Thats true, reverse layout does not work properly, only stack from end.

Fedorkz avatar Mar 17 '17 08:03 Fedorkz

So I looked at this. I couldn't figure out where to place the headers. In the sample app the list goes like this

-item 0 Header 0 -item 1 -item 2 Header 1 -item 3

And headers stick to top.

In reverse order it makes sense to put the header above the items. Also header should stick to top. But with items has no title we would end up something like this:

Header 1 -item 3 Header0 -item 2 -item 1 -item 0

So 'item 0' looks like under 'Header 0' but it is not. It seems like it because it doesn't have a title. If we have a use case for reverse layout I can start work on it.

oshamahue avatar May 30 '18 19:05 oshamahue

@oshamahue One use case could be a chat screen in a messaging application, where date separators should be drawn as sticky headers, and the message list must be drawn in reverse order.

assansh avatar Sep 26 '18 14:09 assansh

So 'item 0' looks like under 'Header 0' but it is not. It seems like it because it doesn't have a title. If we have a use case for reverse layout I can start work on it.

Yeah headers are above the items in the sample app, but item 0 does not have a header (a feature added in #48). But I haven't tried using reverseLayout with this library...

starkej2 avatar Sep 26 '18 18:09 starkej2

One use case could be a chat screen in a messaging application, where date separators should be drawn as sticky headers, and the message list must be drawn in reverse order.

@nassa I actually have that exact same use case. Can't you just reverse the order of your message list?

starkej2 avatar Sep 26 '18 18:09 starkej2

@nassa I actually have that exact same use case. Can't you just reverse the order of your message list?

You could do that, but then the very first message will be displayed at the top of the list, and the list will grow down. In most of the popular messaging apps the list grows bottom-up, and it is also (arguably) more intuitive, so I wanted to implement it using reverse layout.

Here's my quick-and-dirty implementation, if anyone's interested: https://gist.github.com/nassa/6ebf102c77cd46b0861e232a2df9bf2c

Sorry, I don't have time to implement a proper library-worthy solution right now.

assansh avatar Sep 28 '18 06:09 assansh

If the list is sorted in ascending date order, the oldest items will be at the top and any new messages would get added to the end of the list so it would display bottom up as desired.

On Fri, Sep 28, 2018, 2:55 AM nassa [email protected] wrote:

@nassa https://github.com/nassa I actually have that exact same use case. Can't you just reverse the order of your message list?

You could do that, but then the very first message will be displayed at the top of the list, and the list will grow down. In most of the popular messaging apps the list grows bottom-up, and it is also (arguably) more intuitive, so I wanted to implement it using reverse layout.

Here's my quick-and-dirty implementation, if anyone's interested: https://gist.github.com/nassa/6ebf102c77cd46b0861e232a2df9bf2c

Sorry, I don't have time to implement a proper library-worthy solution right now.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edubarr/header-decor/issues/70#issuecomment-425340454, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQkVAIN5SR-DrYJfLmygjTHa3z_Um9wks5ufcfVgaJpZM4MaSxr .

starkej2 avatar Sep 28 '18 13:09 starkej2

201809281911071000

Here's what I mean. I want the second layout.

I understand that layout direction has no effect if there are enough messages to fill the entire screen.

assansh avatar Sep 28 '18 13:09 assansh

Yeah my app has that same bottom up layout with headers and I'm not having the same issue.

On Fri, Sep 28, 2018, 9:12 AM nassa [email protected] wrote:

[image: 201809281911071000] https://user-images.githubusercontent.com/4612367/46210357-54aa9480-c352-11e8-9381-250e291663c0.jpg

Here's what I mean. I want the second layout.

I understand that layout direction has no effect if there are enough messages to fill the entire screen.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edubarr/header-decor/issues/70#issuecomment-425431256, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQkVLbH-RykX5e3g48PCctOLaLZeI96ks5ufiBVgaJpZM4MaSxr .

starkej2 avatar Sep 28 '18 13:09 starkej2