-
Notifications
You must be signed in to change notification settings - Fork 731
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
#4533: improve headers UI in room/messages lists #5181
Conversation
I have achieved most of the required changes. However, without making to many changes, I have some troubles to understand how to listen for query parameters changes to update the item list count to cover missing some use cases:
|
Matrix SDKIntegration Tests Results:
|
.withRealm { realm -> roomSummariesQuery(realm, queryParams).findAllAsync() } | ||
.toFlow() | ||
// need to create the flow on a context dispatcher with a thread with attached Looper | ||
.flowOn(coroutineDispatchers.main) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a little bit strange, we need to switch to the main thread in order to query the count?
we have some other flow based pipelines we don't need to do the switch https://github.com/vector-im/element-android/blob/develop/matrix-sdk-android-flow/src/main/java/org/matrix/android/sdk/flow/FlowSession.kt 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I see why it could be strange but this is the only solution I found to make it work. I am using the toFlow() extension of RealmResult and I didn't find any existing usage in the project. I have seen there is an issue about the documentation of this extension meaning the thread we collect the flow should be the same as the one used for creating the result...
Do you have any idea of how to avoid Dispatchers.Main
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having read a little more into this, it's not as troublesome as I originally thought, realm's async is keeping us off of the main thread but it needs to be triggered from a thread with a looper
initially I was thought this might have pushed us into doing the database query on the main thread
0419054
to
31b30a6
Compare
holder.titleView.text = title | ||
with(holder.counterView) { | ||
text = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this reset the counter amount?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it does not display the counter at all. For what I understood of the code, this item may be used in a screen to add a room but I didn't succeed to find where in the app. I didn't reach creation of this item in debug mode. So, I just supposed we don't need a counter in this use case. Do you know how to open the screen which uses this item ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from what I can tell RoomCategoryItem/RoomCategoryItem_
is only used by the AddRoomListController
which is used by the SpaceAddRoomFragment
which I believe is this screen...
to get here I did, menu drawer
-> add space
-> private, just me
, this screen should also be accessible by editing an existing space to add/remove rooms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we don't want to have a counter here, it could be nice to extract a constant for the empty copy with a name like
const val NO_COUNTER = ""
what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to add the counter in this screen as well to have consistent UI.
b0eee1d
to
4ecda36
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some few remarks, but globally looking good to me!
matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt
Outdated
Show resolved
Hide resolved
vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt
Outdated
Show resolved
Hide resolved
val expandedArrowDrawableRes = if (roomsSectionData.isExpanded) R.drawable.ic_expand_more else R.drawable.ic_expand_less | ||
val expandedArrowDrawable = ContextCompat.getDrawable(binding.root.context, expandedArrowDrawableRes)?.also { | ||
DrawableCompat.setTint(it, tintColor) | ||
with(binding) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not a big fan of with
(and apply
for the same reason). It ends up with several this
in the block and this is a source of bugs, and not good for the readability, especially on GitHub). We can discuss this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my side, I use a lot operators like with
, apply
, run
or let
when there are at least 2 operators applied to a variable. But I reverted back the usage here. I understand your point of view since it changes the scope, you must pay attention what you do inside.
66e07b4
to
a5b7ad3
Compare
a5b7ad3
to
8bb0a5c
Compare
@ouchadam I have fixed all comments and rebase the branch on develop. Can you take a look again if everything is okay to be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for updating, LGTM 💯 feel free to merge once the CI is happy!
I can't tell from the PR description. Was this addressed? |
This part was in fact already implemented before this PR. There is a field named |
Oh wait. That was the wrong question, sorry. What I want to know is, if |
Okay I see. When there is only one visible section, we decided to show the header. It is necessary to keep it since it includes the notifications counter and the current number of items as well. |
I see. This was the main reason I opened #4533:
So, my issue isn't actually solved by this PR. 😅 |
Hello, sorry for the late reply. I see your point. The height of the headers has been increased. Maybe now it is better to avoid this scenario? If it does not fix this problem, I do not have a solution right now for that. It will need to rethink the UI and for all platforms to be consistent. CC: @daniellekirkwood |
Actually, the description of the merged PR #5580 seems to imply that the change I'm seeking is already implemented. There are no screenshots, though, so I'm not sure. Could you please check? |
The actual changes is in fact in #5616. When there is a single section, it is not collapsable. Is was released in the v1.4.7. It looks like the capture below: |
Alright! That does indeed solve my problem. Thanks for confirming! Maybe #4533 should be linked to that PR instead, for posterity? |
Type of change
Content
Improvement for UI of headers sections in the rooms and messages lists. A counter of the list items has been added and the notification badge has been moved to the right.
Motivation and context
Closes #4533
Screenshots / GIFs
New header style :
Tests
Tested devices
Checklist