mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 04:52:00 +03:00
Adding TODO
This commit is contained in:
parent
ad9d36e58c
commit
d5345160fa
5 changed files with 21 additions and 23 deletions
|
@ -29,7 +29,6 @@ import im.vector.app.core.epoxy.VectorEpoxyModel
|
|||
import im.vector.app.core.epoxy.onClick
|
||||
import im.vector.app.features.themes.ThemeUtils
|
||||
|
||||
// TODO check where it is used in the project
|
||||
@EpoxyModelClass(layout = R.layout.item_room_category)
|
||||
abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() {
|
||||
|
||||
|
@ -41,6 +40,7 @@ abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() {
|
|||
|
||||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
// TODO do we need to update the binding? do not understand how it is used in the app
|
||||
val tintColor = ThemeUtils.getColor(holder.rootView.context, R.attr.vctr_content_secondary)
|
||||
val expandedArrowDrawableRes = if (expanded) R.drawable.ic_expand_more else R.drawable.ic_expand_less
|
||||
val expandedArrowDrawable = ContextCompat.getDrawable(holder.rootView.context, expandedArrowDrawableRes)?.also {
|
||||
|
|
|
@ -291,15 +291,7 @@ class RoomListFragment @Inject constructor(
|
|||
))
|
||||
checkEmptyState()
|
||||
}
|
||||
lifecycleScope.launch {
|
||||
section.itemCount
|
||||
.flowWithLifecycle(lifecycle, Lifecycle.State.STARTED)
|
||||
.collect { count ->
|
||||
sectionAdapter.updateSection(
|
||||
sectionAdapter.roomsSectionData.copy(itemCount = count)
|
||||
)
|
||||
}
|
||||
}
|
||||
listenItemCount(section, sectionAdapter)
|
||||
section.notificationCount.observe(viewLifecycleOwner) { counts ->
|
||||
sectionAdapter.updateSection(sectionAdapter.roomsSectionData.copy(
|
||||
notificationCount = counts.totalCount,
|
||||
|
@ -323,6 +315,7 @@ class RoomListFragment @Inject constructor(
|
|||
))
|
||||
checkEmptyState()
|
||||
}
|
||||
listenItemCount(section, sectionAdapter)
|
||||
section.isExpanded.observe(viewLifecycleOwner) { _ ->
|
||||
refreshCollapseStates()
|
||||
}
|
||||
|
@ -339,15 +332,7 @@ class RoomListFragment @Inject constructor(
|
|||
isLoading = false))
|
||||
checkEmptyState()
|
||||
}
|
||||
lifecycleScope.launch {
|
||||
section.itemCount
|
||||
.flowWithLifecycle(lifecycle, Lifecycle.State.STARTED)
|
||||
.collect { count ->
|
||||
sectionAdapter.updateSection(
|
||||
sectionAdapter.roomsSectionData.copy(itemCount = count)
|
||||
)
|
||||
}
|
||||
}
|
||||
listenItemCount(section, sectionAdapter)
|
||||
section.notificationCount.observe(viewLifecycleOwner) { counts ->
|
||||
sectionAdapter.updateSection(sectionAdapter.roomsSectionData.copy(
|
||||
notificationCount = counts.totalCount,
|
||||
|
@ -395,6 +380,18 @@ class RoomListFragment @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun listenItemCount(section: RoomsSection, sectionAdapter: SectionHeaderAdapter) {
|
||||
lifecycleScope.launch {
|
||||
section.itemCount
|
||||
.flowWithLifecycle(lifecycle, Lifecycle.State.STARTED)
|
||||
.collect { count ->
|
||||
sectionAdapter.updateSection(
|
||||
sectionAdapter.roomsSectionData.copy(itemCount = count)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleQuickActions(quickAction: RoomListQuickActionsSharedAction) {
|
||||
when (quickAction) {
|
||||
is RoomListQuickActionsSharedAction.NotificationsAllNoisy -> {
|
||||
|
|
|
@ -68,7 +68,7 @@ class RoomListSectionBuilderGroup(
|
|||
it.memberships = Membership.activeMemberships()
|
||||
},
|
||||
{ qpm ->
|
||||
// TODO find a way to show the filtered rooms count ?
|
||||
// TODO find a clean way to listen query params changes to show the filtered rooms count
|
||||
val name = stringProvider.getString(R.string.bottom_action_rooms)
|
||||
session.getFilteredPagedRoomSummariesLive(qpm)
|
||||
.let { updatableFilterLivePageResult ->
|
||||
|
|
|
@ -88,7 +88,7 @@ class RoomListSectionBuilderSpace(
|
|||
it.memberships = Membership.activeMemberships()
|
||||
},
|
||||
{ qpm ->
|
||||
// TODO find a way to show the filtered rooms count ?
|
||||
// TODO find a clean way to listen query params changes to show the filtered rooms count
|
||||
val name = stringProvider.getString(R.string.bottom_action_rooms)
|
||||
session.getFilteredPagedRoomSummariesLive(qpm)
|
||||
.let { updatableFilterLivePageResult ->
|
||||
|
@ -404,7 +404,8 @@ class RoomListSectionBuilderSpace(
|
|||
sectionName = name,
|
||||
livePages = livePagedList,
|
||||
notifyOfLocalEcho = notifyOfLocalEcho,
|
||||
itemCount = session.getRoomCountFlow(roomQueryParams)
|
||||
// TODO not working when switching spaces, how does the query is updated in this case?
|
||||
itemCount = session.getRoomCountFlow(roomQueryParams.process(spaceFilterStrategy, appStateHandler.safeActiveSpaceId()))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ data class RoomsSection(
|
|||
val sectionName: String,
|
||||
// can be a paged list or a regular list
|
||||
val livePages: LiveData<PagedList<RoomSummary>>? = null,
|
||||
// TODO liveList is not used : can we delete ?
|
||||
// TODO liveList is not used : can we delete this livedata?
|
||||
val liveList: LiveData<List<RoomSummary>>? = null,
|
||||
val liveSuggested: LiveData<SuggestedRoomInfo>? = null,
|
||||
val isExpanded: MutableLiveData<Boolean> = MutableLiveData(true),
|
||||
|
|
Loading…
Reference in a new issue