Home: use detach/attach instead of hide/show

This commit is contained in:
ganfra 2019-11-14 11:18:45 +01:00
parent 6ce241163e
commit 4cefdfedce
2 changed files with 8 additions and 8 deletions

View File

@ -170,13 +170,13 @@ class HomeDetailFragment @Inject constructor(
childFragmentManager.fragments
.filter { it != fragmentToShow }
.forEach {
hide(it)
detach(it)
}
if (fragmentToShow == null) {
val params = RoomListParams(displayMode)
add(R.id.roomListContainer, RoomListFragment::class.java, params.toMvRxBundle(), fragmentTag)
} else {
show(fragmentToShow)
attach(fragmentToShow)
}
}
}

View File

@ -143,7 +143,7 @@ class RoomListFragment @Inject constructor(
RoomListDisplayMode.HOME -> createChatFabMenu.isVisible = true
RoomListDisplayMode.PEOPLE -> createChatRoomButton.isVisible = true
RoomListDisplayMode.ROOMS -> createGroupRoomButton.isVisible = true
else -> Unit // No button in this mode
else -> Unit // No button in this mode
}
createChatRoomButton.setOnClickListener {
@ -169,7 +169,7 @@ class RoomListFragment @Inject constructor(
RoomListDisplayMode.HOME -> createChatFabMenu.hide()
RoomListDisplayMode.PEOPLE -> createChatRoomButton.hide()
RoomListDisplayMode.ROOMS -> createGroupRoomButton.hide()
else -> Unit
else -> Unit
}
}
}
@ -209,7 +209,7 @@ class RoomListFragment @Inject constructor(
RoomListDisplayMode.HOME -> createChatFabMenu.show()
RoomListDisplayMode.PEOPLE -> createChatRoomButton.show()
RoomListDisplayMode.ROOMS -> createGroupRoomButton.show()
else -> Unit
else -> Unit
}
}
}
@ -263,7 +263,7 @@ class RoomListFragment @Inject constructor(
requireActivity().invalidateOptionsMenu()
}
}
else -> Unit
else -> Unit
}
}
@ -310,7 +310,7 @@ class RoomListFragment @Inject constructor(
ContextCompat.getDrawable(requireContext(), R.drawable.ic_home_bottom_group),
getString(R.string.room_list_rooms_empty_body)
)
else ->
else ->
// Always display the content in this mode, because if the footer
StateView.State.Content
}
@ -348,7 +348,7 @@ class RoomListFragment @Inject constructor(
RoomListQuickActionsBottomSheet
.newInstance(room.roomId)
.show(requireActivity().supportFragmentManager, "ROOM_LIST_QUICK_ACTIONS")
.show(childFragmentManager, "ROOM_LIST_QUICK_ACTIONS")
return true
}