-
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
Replaces subtitle in Search Rooms with room context rather than last event #5860
Changes from 12 commits
0250f61
a3367d4
9e53e6c
70cded2
87ad35d
3347560
b280358
4784717
962e9ab
7e415e8
7cc79fe
a355b62
f70a24d
47493fc
c9b32fe
b46794d
52c404a
21fe5a2
50839c2
7c1d1c3
83bd9bc
03acf45
d12ab17
a5dc8ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Adds space or user id as a subtitle under rooms in search |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ import org.matrix.android.sdk.api.session.room.UpdatableLivePageResult | |
import org.matrix.android.sdk.api.session.room.model.Membership | ||
import org.matrix.android.sdk.api.session.room.model.RoomSummary | ||
import org.matrix.android.sdk.api.session.room.model.RoomType | ||
import org.matrix.android.sdk.api.session.room.model.SpaceParentInfo | ||
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams | ||
import org.matrix.android.sdk.api.session.room.spaceSummaryQueryParams | ||
import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotificationCount | ||
|
@@ -193,7 +194,7 @@ internal class RoomSummaryDataSource @Inject constructor( | |
} | ||
val dataSourceFactory = realmDataSourceFactory.map { | ||
roomSummaryMapper.map(it) | ||
} | ||
}.map { it.getWithParents() } | ||
|
||
val boundaries = MutableLiveData(ResultBoundaries()) | ||
|
||
|
@@ -232,6 +233,20 @@ internal class RoomSummaryDataSource @Inject constructor( | |
} | ||
} | ||
|
||
private fun RoomSummary.getWithParents(): RoomSummary { | ||
val parents = flattenParentIds.mapNotNull { parentId -> | ||
getRoomSummary(parentId)?.let { parentSummary -> | ||
SpaceParentInfo( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just return the RoomSummaries here instead of fake parentInfo with fake/wrong canonical & viaservers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idk why I didn't do this to start with lmao There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
parentId = parentSummary.flattenParentIds.firstOrNull(), | ||
roomSummary = parentSummary, | ||
canonical = true, | ||
viaServers = emptyList() | ||
) | ||
} | ||
} | ||
return copy(flattenParents = parents) | ||
} | ||
|
||
fun getCountLive(queryParams: RoomSummaryQueryParams): LiveData<Int> { | ||
val liveRooms = monarchy.findAllManagedWithChanges { | ||
roomSummariesQuery(it, queryParams) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,13 +112,27 @@ | |
app:layout_constraintTop_toBottomOf="@id/roomAvatarContainer" | ||
tools:layout_marginStart="20dp" /> | ||
|
||
<Space | ||
android:id="@+id/topMarginSpace" | ||
android:layout_width="0dp" | ||
android:layout_height="12dp" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<Space | ||
android:id="@+id/centerTitleSpace" | ||
android:layout_width="match_parent" | ||
android:layout_height="15dp" | ||
android:visibility="gone" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/topMarginSpace" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. weird way to align text vertically. If the font size is changed, it will not work properly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried this with changing consraints programatically, but that affects other bindings as you scroll. There's no easy way to 'reset' the view to its original xml state. Can you explain more what you mean by sublayout? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sublayout: add a new ConstraintLayout to pack the Title and the Subtitle. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the best way to do this imo is to inflate an entirely different Epoxy item based on whether there is a subtitle or not. What are your thoughts on that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will improve that in the future, there is another bug related, with the placeholder. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. I am removing myself from the reviewer now. |
||
|
||
<TextView | ||
android:id="@+id/roomNameView" | ||
style="@style/Widget.Vector.TextView.Subtitle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="@dimen/layout_horizontal_margin" | ||
android:layout_marginTop="12dp" | ||
android:layout_marginEnd="8dp" | ||
android:duplicateParentState="true" | ||
android:ellipsize="end" | ||
|
@@ -130,7 +144,7 @@ | |
app:layout_constraintHorizontal_bias="0.0" | ||
app:layout_constraintHorizontal_chainStyle="packed" | ||
app:layout_constraintStart_toEndOf="@id/roomAvatarContainer" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/centerTitleSpace" | ||
tools:text="@sample/users.json/data/displayName" /> | ||
|
||
<ImageView | ||
|
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 think it would be cool to have an overload of
map
inRoomSummaryMapper
to have a param to request flattened parentThere 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 think it would be better also. Like that it won't impact perf for those who don't need to load additional things?
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.
Good shout!