mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +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.core.epoxy.onClick
|
||||||
import im.vector.app.features.themes.ThemeUtils
|
import im.vector.app.features.themes.ThemeUtils
|
||||||
|
|
||||||
// TODO check where it is used in the project
|
|
||||||
@EpoxyModelClass(layout = R.layout.item_room_category)
|
@EpoxyModelClass(layout = R.layout.item_room_category)
|
||||||
abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() {
|
abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() {
|
||||||
|
|
||||||
|
@ -41,6 +40,7 @@ abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() {
|
||||||
|
|
||||||
override fun bind(holder: Holder) {
|
override fun bind(holder: Holder) {
|
||||||
super.bind(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 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 expandedArrowDrawableRes = if (expanded) R.drawable.ic_expand_more else R.drawable.ic_expand_less
|
||||||
val expandedArrowDrawable = ContextCompat.getDrawable(holder.rootView.context, expandedArrowDrawableRes)?.also {
|
val expandedArrowDrawable = ContextCompat.getDrawable(holder.rootView.context, expandedArrowDrawableRes)?.also {
|
||||||
|
|
|
@ -291,15 +291,7 @@ class RoomListFragment @Inject constructor(
|
||||||
))
|
))
|
||||||
checkEmptyState()
|
checkEmptyState()
|
||||||
}
|
}
|
||||||
lifecycleScope.launch {
|
listenItemCount(section, sectionAdapter)
|
||||||
section.itemCount
|
|
||||||
.flowWithLifecycle(lifecycle, Lifecycle.State.STARTED)
|
|
||||||
.collect { count ->
|
|
||||||
sectionAdapter.updateSection(
|
|
||||||
sectionAdapter.roomsSectionData.copy(itemCount = count)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
section.notificationCount.observe(viewLifecycleOwner) { counts ->
|
section.notificationCount.observe(viewLifecycleOwner) { counts ->
|
||||||
sectionAdapter.updateSection(sectionAdapter.roomsSectionData.copy(
|
sectionAdapter.updateSection(sectionAdapter.roomsSectionData.copy(
|
||||||
notificationCount = counts.totalCount,
|
notificationCount = counts.totalCount,
|
||||||
|
@ -323,6 +315,7 @@ class RoomListFragment @Inject constructor(
|
||||||
))
|
))
|
||||||
checkEmptyState()
|
checkEmptyState()
|
||||||
}
|
}
|
||||||
|
listenItemCount(section, sectionAdapter)
|
||||||
section.isExpanded.observe(viewLifecycleOwner) { _ ->
|
section.isExpanded.observe(viewLifecycleOwner) { _ ->
|
||||||
refreshCollapseStates()
|
refreshCollapseStates()
|
||||||
}
|
}
|
||||||
|
@ -339,15 +332,7 @@ class RoomListFragment @Inject constructor(
|
||||||
isLoading = false))
|
isLoading = false))
|
||||||
checkEmptyState()
|
checkEmptyState()
|
||||||
}
|
}
|
||||||
lifecycleScope.launch {
|
listenItemCount(section, sectionAdapter)
|
||||||
section.itemCount
|
|
||||||
.flowWithLifecycle(lifecycle, Lifecycle.State.STARTED)
|
|
||||||
.collect { count ->
|
|
||||||
sectionAdapter.updateSection(
|
|
||||||
sectionAdapter.roomsSectionData.copy(itemCount = count)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
section.notificationCount.observe(viewLifecycleOwner) { counts ->
|
section.notificationCount.observe(viewLifecycleOwner) { counts ->
|
||||||
sectionAdapter.updateSection(sectionAdapter.roomsSectionData.copy(
|
sectionAdapter.updateSection(sectionAdapter.roomsSectionData.copy(
|
||||||
notificationCount = counts.totalCount,
|
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) {
|
private fun handleQuickActions(quickAction: RoomListQuickActionsSharedAction) {
|
||||||
when (quickAction) {
|
when (quickAction) {
|
||||||
is RoomListQuickActionsSharedAction.NotificationsAllNoisy -> {
|
is RoomListQuickActionsSharedAction.NotificationsAllNoisy -> {
|
||||||
|
|
|
@ -68,7 +68,7 @@ class RoomListSectionBuilderGroup(
|
||||||
it.memberships = Membership.activeMemberships()
|
it.memberships = Membership.activeMemberships()
|
||||||
},
|
},
|
||||||
{ qpm ->
|
{ 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)
|
val name = stringProvider.getString(R.string.bottom_action_rooms)
|
||||||
session.getFilteredPagedRoomSummariesLive(qpm)
|
session.getFilteredPagedRoomSummariesLive(qpm)
|
||||||
.let { updatableFilterLivePageResult ->
|
.let { updatableFilterLivePageResult ->
|
||||||
|
|
|
@ -88,7 +88,7 @@ class RoomListSectionBuilderSpace(
|
||||||
it.memberships = Membership.activeMemberships()
|
it.memberships = Membership.activeMemberships()
|
||||||
},
|
},
|
||||||
{ qpm ->
|
{ 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)
|
val name = stringProvider.getString(R.string.bottom_action_rooms)
|
||||||
session.getFilteredPagedRoomSummariesLive(qpm)
|
session.getFilteredPagedRoomSummariesLive(qpm)
|
||||||
.let { updatableFilterLivePageResult ->
|
.let { updatableFilterLivePageResult ->
|
||||||
|
@ -404,7 +404,8 @@ class RoomListSectionBuilderSpace(
|
||||||
sectionName = name,
|
sectionName = name,
|
||||||
livePages = livePagedList,
|
livePages = livePagedList,
|
||||||
notifyOfLocalEcho = notifyOfLocalEcho,
|
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,
|
val sectionName: String,
|
||||||
// can be a paged list or a regular list
|
// can be a paged list or a regular list
|
||||||
val livePages: LiveData<PagedList<RoomSummary>>? = null,
|
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 liveList: LiveData<List<RoomSummary>>? = null,
|
||||||
val liveSuggested: LiveData<SuggestedRoomInfo>? = null,
|
val liveSuggested: LiveData<SuggestedRoomInfo>? = null,
|
||||||
val isExpanded: MutableLiveData<Boolean> = MutableLiveData(true),
|
val isExpanded: MutableLiveData<Boolean> = MutableLiveData(true),
|
||||||
|
|
Loading…
Reference in a new issue