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

ReverseLayout not working? #70

Open
mslobodan opened this issue Mar 11, 2017 · 9 comments
Open

ReverseLayout not working? #70

mslobodan opened this issue Mar 11, 2017 · 9 comments

Comments

@mslobodan
Copy link

mslobodan commented Mar 11, 2017

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?

@Fedorkz
Copy link

Fedorkz commented Mar 17, 2017

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

@starkej2 starkej2 added the bug label Feb 21, 2018
@oshamahue
Copy link
Collaborator

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.

@assansh
Copy link

assansh commented Sep 26, 2018

@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.

@starkej2
Copy link
Collaborator

starkej2 commented Sep 26, 2018

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
Copy link
Collaborator

starkej2 commented Sep 26, 2018

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?

@assansh
Copy link

assansh commented Sep 28, 2018

@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.

@starkej2
Copy link
Collaborator

starkej2 commented Sep 28, 2018 via email

@assansh
Copy link

assansh commented Sep 28, 2018

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.

@starkej2
Copy link
Collaborator

starkej2 commented Sep 28, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants