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

Update note list after changing layout mode #88

Closed

Conversation

nhoeher
Copy link
Contributor

@nhoeher nhoeher commented Nov 14, 2022

The user is able to set different values for the amount of preview lines to be shown depending on the layout mode (grid / list).

When the user changes between list and grid mode the amount of preview lines shown doesn't change, because the NoteList isn't updated. The different amount of preview lines only takes effect on the next database change.

With this PR the issue is fixed by manually calling updateNoteList() after changing the list layout mode, similar to how it is handled after changing the sort mode.

@maltaisn
Copy link
Owner

I'm having trouble reproducing this. I set 5 lines in list mode, 10 lines in grid mode, but when I switch from one another it gets updated correctly. Is this the right steps? Normally that's an attribute of the view holder which gets updated by the adapter when changing the layout manager.

@nhoeher
Copy link
Contributor Author

nhoeher commented Nov 15, 2022

Ah, I just now noticed that it only doesn't work for list notes. Other than that the steps to reproduce should be correct.

Create a list note with more than 5 items, switch from list view to grid view and the amount of items shown doesn't change. I am able to reproduce this consistently on Android 12.

@nhoeher
Copy link
Contributor Author

nhoeher commented Nov 15, 2022

The updateForListLayoutChange function in the NoteAdapter causes a rebind of all items. The issue seems to be that the same NoteItemList is being rebound (ListNoteViewHolder.bind), which still contains the old items list and overflowCount.

It works for text notes, because the amount of maximum lines is dynamically set in TextNoteViewHolder.bind instead of being part of the NoteItemText class.

@maltaisn maltaisn closed this Nov 16, 2022
@maltaisn
Copy link
Owner

Thanks.

@nhoeher nhoeher deleted the fix-update-notelist-after-layout-change branch December 11, 2022 23:39
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.

2 participants