-
Notifications
You must be signed in to change notification settings - Fork 739
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
room summary now has constant height #7145
Conversation
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 thinking of fixing this issue since a long time, thanks for doing it! (I think I have a local branch with some attempt somewhere).
I was wondering if it would be possible to define a dimen
resource for the cell height, which could be with unit sp
, so that we ensure that the room item and the placeholder have the same height, and so we avoid regression. WDYT?
changelog.d/7079.bugfix
Outdated
@@ -0,0 +1 @@ | |||
Fix text margin in QR code view when no display name is set |
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.
Wrong comment?
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.
now I wonder where I put the correct one 😅
|
||
if (useSingleLineForLastEvent) { | ||
holder.subtitleView.setLines(1) | ||
} |
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.
Since items can be recycled, we need to add a else
block here. But since the value is constant in the controller, I think this is fine.
return roomSummaryItemFactory.create(item, roomChangeMembershipStates.orEmpty(), emptySet(), displayMode, listener) | ||
return if (item == null) { | ||
val host = this | ||
RoomSummaryItemPlaceHolder_().apply { |
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.
Nit: roomSummaryItemPlaceHolder{ }
could be used
RoomSummaryItemPlaceHolder_().apply { | |
roomSummaryItemPlaceHolder { |
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.
roomSummaryItemPlaceHolder
adds model to collector, but here we need to return item instead, so we can't really use this inside buildItemModel
method :(
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.
Oh, true, my bad.
return roomSummaryItemFactory.create(item, roomChangeMembershipStates.orEmpty(), emptySet(), RoomListDisplayMode.ROOMS, listener) | ||
return if (item == null) { | ||
val host = this | ||
RoomSummaryItemPlaceHolder_().apply { |
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.
Nit: roomSummaryItemPlaceHolder{ }
could be used
RoomSummaryItemPlaceHolder_().apply { | |
roomSummaryItemPlaceHolder { |
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.
roomSummaryItemPlaceHolder
adds model to collector, but here we need to return item instead, so we can't really use this inside buildItemModel
method :(
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.
fair enough :)
|
||
init { | ||
val fontScale = fontScalePreferences.getResolvedFontScaleValue() | ||
shouldUseSingleLine = fontScale.scale > FontScalePreferences.SCALE_LARGE |
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.
A tiny detail, but I would have used >=
shouldUseSingleLine = fontScale.scale > FontScalePreferences.SCALE_LARGE | |
shouldUseSingleLine = fontScale.scale >= FontScalePreferences.SCALE_LARGER |
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 don't feel ok checking equality of two floating-point numbers. We don't do any calculations here, so they should be the same, but I still concerned. 🤔
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 see your point, OK
… to the first position
* @param layoutManager - [LinearLayoutManager] of the recycler view, which displays items | ||
* @param onItemUpdated - callback to be called, when observer detects event | ||
*/ | ||
class FirstItemUpdatedObserver( |
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.
(you have to use @property
instead of @param
for class members documentation, in this case onItemUpdated
)
|
SonarCloud Quality Gate failed. |
Type of change
Content
Currently room summary item height is not constant - it can vary depending if there is enough text in the last message/event to go on a second line. This cause some flickering and jumping scrolls when placeholders are replaced with actual items. To mitigate this I've forced last event text view to have constant amount of lines (2 normally, reduced to 1 if font scale is bigger than "Large"). Also Placeholder's items had height defined in dp, which caused them to have wrong height if font size is scaled.
Motivation and context
closes #7079
Screenshots / GIFs
before changes (look for first room item's height):
After changes:
with font scaling (Huge):