Redo hidden bottom bar and combined chats view for v1.0 merge
This commit is contained in:
parent
95850440bd
commit
e857052e37
|
@ -90,8 +90,8 @@ class HomeDetailFragment @Inject constructor(
|
|||
|
||||
withState(viewModel) {
|
||||
// Update the navigation view if needed (for when we restore the tabs)
|
||||
bottomNavigationView.selectedItemId = it.displayMode.toMenuId()
|
||||
bottomNavigationView.visibility = if (bottomNavigationView.selectedItemId != R.id.bottom_action_notification) View.VISIBLE else View.GONE
|
||||
//bottomNavigationView.selectedItemId = it.displayMode.toMenuId()
|
||||
bottomNavigationView.visibility = View.GONE
|
||||
}
|
||||
|
||||
viewModel.selectSubscribe(this, HomeDetailViewState::groupSummary) { groupSummary ->
|
||||
|
@ -249,7 +249,8 @@ class HomeDetailFragment @Inject constructor(
|
|||
val displayMode = when (it.itemId) {
|
||||
R.id.bottom_action_people -> RoomListDisplayMode.PEOPLE
|
||||
R.id.bottom_action_rooms -> RoomListDisplayMode.ROOMS
|
||||
else -> RoomListDisplayMode.NOTIFICATIONS
|
||||
R.id.bottom_action_notification -> RoomListDisplayMode.NOTIFICATIONS
|
||||
else -> RoomListDisplayMode.ALL
|
||||
}
|
||||
viewModel.handle(HomeDetailAction.SwitchDisplayMode(displayMode))
|
||||
true
|
||||
|
|
|
@ -27,7 +27,7 @@ import im.vector.matrix.android.api.session.sync.SyncState
|
|||
data class HomeDetailViewState(
|
||||
val groupSummary: Option<GroupSummary> = Option.empty(),
|
||||
val asyncRooms: Async<List<RoomSummary>> = Uninitialized,
|
||||
val displayMode: RoomListDisplayMode = RoomListDisplayMode.PEOPLE,
|
||||
val displayMode: RoomListDisplayMode = RoomListDisplayMode.ALL,
|
||||
val notificationCountCatchup: Int = 0,
|
||||
val notificationHighlightCatchup: Boolean = false,
|
||||
val notificationCountPeople: Int = 0,
|
||||
|
|
|
@ -20,6 +20,7 @@ import androidx.annotation.StringRes
|
|||
import im.vector.riotx.R
|
||||
|
||||
enum class RoomListDisplayMode(@StringRes val titleRes: Int) {
|
||||
ALL(R.string.bottom_action_all),
|
||||
NOTIFICATIONS(R.string.bottom_action_notification),
|
||||
PEOPLE(R.string.bottom_action_people_x),
|
||||
ROOMS(R.string.bottom_action_rooms),
|
||||
|
|
|
@ -28,8 +28,9 @@ class RoomListDisplayModeFilter(private val displayMode: RoomListDisplayMode) :
|
|||
return false
|
||||
}
|
||||
return when (displayMode) {
|
||||
RoomListDisplayMode.ALL -> true
|
||||
RoomListDisplayMode.NOTIFICATIONS ->
|
||||
true //roomSummary.notificationCount > 0 || roomSummary.membership == Membership.INVITE || roomSummary.userDrafts.isNotEmpty()
|
||||
roomSummary.notificationCount > 0 || roomSummary.membership == Membership.INVITE || roomSummary.userDrafts.isNotEmpty()
|
||||
RoomListDisplayMode.PEOPLE -> roomSummary.isDirect && roomSummary.membership.isActive()
|
||||
RoomListDisplayMode.ROOMS -> !roomSummary.isDirect && roomSummary.membership.isActive()
|
||||
RoomListDisplayMode.FILTERED -> roomSummary.membership == Membership.JOIN
|
||||
|
|
|
@ -138,6 +138,7 @@ class RoomListFragment @Inject constructor(
|
|||
|
||||
private fun setupCreateRoomButton() {
|
||||
when (roomListParams.displayMode) {
|
||||
RoomListDisplayMode.ALL,
|
||||
RoomListDisplayMode.NOTIFICATIONS -> createChatFabMenu.isVisible = true
|
||||
RoomListDisplayMode.PEOPLE -> createChatRoomButton.isVisible = true
|
||||
RoomListDisplayMode.ROOMS -> createGroupRoomButton.isVisible = true
|
||||
|
@ -164,6 +165,7 @@ class RoomListFragment @Inject constructor(
|
|||
RecyclerView.SCROLL_STATE_DRAGGING,
|
||||
RecyclerView.SCROLL_STATE_SETTLING -> {
|
||||
when (roomListParams.displayMode) {
|
||||
RoomListDisplayMode.ALL,
|
||||
RoomListDisplayMode.NOTIFICATIONS -> createChatFabMenu.hide()
|
||||
RoomListDisplayMode.PEOPLE -> createChatRoomButton.hide()
|
||||
RoomListDisplayMode.ROOMS -> createGroupRoomButton.hide()
|
||||
|
@ -207,6 +209,7 @@ class RoomListFragment @Inject constructor(
|
|||
private val showFabRunnable = Runnable {
|
||||
if (isAdded) {
|
||||
when (roomListParams.displayMode) {
|
||||
RoomListDisplayMode.ALL,
|
||||
RoomListDisplayMode.NOTIFICATIONS -> createChatFabMenu.show()
|
||||
RoomListDisplayMode.PEOPLE -> createChatRoomButton.show()
|
||||
RoomListDisplayMode.ROOMS -> createGroupRoomButton.show()
|
||||
|
@ -258,6 +261,7 @@ class RoomListFragment @Inject constructor(
|
|||
roomController.update(state)
|
||||
// Mark all as read menu
|
||||
when (roomListParams.displayMode) {
|
||||
RoomListDisplayMode.ALL,
|
||||
RoomListDisplayMode.NOTIFICATIONS,
|
||||
RoomListDisplayMode.PEOPLE,
|
||||
RoomListDisplayMode.ROOMS -> {
|
||||
|
@ -288,6 +292,12 @@ class RoomListFragment @Inject constructor(
|
|||
}
|
||||
.isNullOrEmpty()
|
||||
val emptyState = when (roomListParams.displayMode) {
|
||||
RoomListDisplayMode.ALL ->
|
||||
StateView.State.Empty(
|
||||
getString(R.string.all_list_rooms_empty_title),
|
||||
ContextCompat.getDrawable(requireContext(), R.drawable.ic_home_bottom_group),
|
||||
getString(R.string.all_list_rooms_empty_body)
|
||||
)
|
||||
RoomListDisplayMode.NOTIFICATIONS -> {
|
||||
if (hasNoRoom) {
|
||||
StateView.State.Empty(
|
||||
|
|
|
@ -37,6 +37,8 @@ class SharedPreferencesUiStateRepository @Inject constructor(
|
|||
}
|
||||
|
||||
override fun getDisplayMode(): RoomListDisplayMode {
|
||||
return RoomListDisplayMode.ALL
|
||||
/*
|
||||
return when (sharedPreferences.getInt(KEY_DISPLAY_MODE, VALUE_DISPLAY_MODE_CATCHUP)) {
|
||||
VALUE_DISPLAY_MODE_PEOPLE -> RoomListDisplayMode.PEOPLE
|
||||
VALUE_DISPLAY_MODE_ROOMS -> RoomListDisplayMode.ROOMS
|
||||
|
@ -46,6 +48,7 @@ class SharedPreferencesUiStateRepository @Inject constructor(
|
|||
RoomListDisplayMode.PEOPLE
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
override fun storeDisplayMode(displayMode: RoomListDisplayMode) {
|
||||
|
|
|
@ -12,4 +12,8 @@
|
|||
<string name="bubble_style_start">Selbe Seite</string>
|
||||
<string name="bubble_style_both">Beide Seiten</string>
|
||||
|
||||
<string name="bottom_action_all">Übersicht</string>
|
||||
<string name="all_list_rooms_empty_title">SchildiChat</string>
|
||||
<string name="all_list_rooms_empty_body">Konversationen werden hier angezeigt</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -12,4 +12,8 @@
|
|||
<string name="bubble_style_start">Same side</string>
|
||||
<string name="bubble_style_both">Both sides</string>
|
||||
|
||||
<string name="bottom_action_all">Overview</string>
|
||||
<string name="all_list_rooms_empty_title">SchildiChat</string>
|
||||
<string name="all_list_rooms_empty_body">Chats will be displayed here</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue