mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 21:48:50 +03:00
Rename class
This commit is contained in:
parent
82f639b91f
commit
238d1d87c6
5 changed files with 31 additions and 31 deletions
|
@ -39,7 +39,7 @@ import im.vector.riotx.core.error.ErrorFormatter
|
|||
import im.vector.riotx.core.platform.OnBackPressed
|
||||
import im.vector.riotx.core.platform.StateView
|
||||
import im.vector.riotx.core.platform.VectorBaseFragment
|
||||
import im.vector.riotx.features.home.room.list.actions.RoomListQuickSharedAction
|
||||
import im.vector.riotx.features.home.room.list.actions.RoomListQuickActionsSharedAction
|
||||
import im.vector.riotx.features.home.room.list.actions.RoomListQuickActionsBottomSheet
|
||||
import im.vector.riotx.features.home.room.list.actions.RoomListQuickActionsStore
|
||||
import im.vector.riotx.features.home.room.list.widget.FabMenuView
|
||||
|
@ -216,24 +216,24 @@ class RoomListFragment @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun handleQuickActions(quickAction: RoomListQuickSharedAction) {
|
||||
private fun handleQuickActions(quickAction: RoomListQuickActionsSharedAction) {
|
||||
when (quickAction) {
|
||||
is RoomListQuickSharedAction.NotificationsAllNoisy -> {
|
||||
is RoomListQuickActionsSharedAction.NotificationsAllNoisy -> {
|
||||
roomListViewModel.accept(RoomListActions.ChangeRoomNotificationState(quickAction.roomId, RoomNotificationState.ALL_MESSAGES_NOISY))
|
||||
}
|
||||
is RoomListQuickSharedAction.NotificationsAll -> {
|
||||
is RoomListQuickActionsSharedAction.NotificationsAll -> {
|
||||
roomListViewModel.accept(RoomListActions.ChangeRoomNotificationState(quickAction.roomId, RoomNotificationState.ALL_MESSAGES))
|
||||
}
|
||||
is RoomListQuickSharedAction.NotificationsMentionsOnly -> {
|
||||
is RoomListQuickActionsSharedAction.NotificationsMentionsOnly -> {
|
||||
roomListViewModel.accept(RoomListActions.ChangeRoomNotificationState(quickAction.roomId, RoomNotificationState.MENTIONS_ONLY))
|
||||
}
|
||||
is RoomListQuickSharedAction.NotificationsMute -> {
|
||||
is RoomListQuickActionsSharedAction.NotificationsMute -> {
|
||||
roomListViewModel.accept(RoomListActions.ChangeRoomNotificationState(quickAction.roomId, RoomNotificationState.MUTE))
|
||||
}
|
||||
is RoomListQuickSharedAction.Settings -> {
|
||||
is RoomListQuickActionsSharedAction.Settings -> {
|
||||
vectorBaseActivity.notImplemented("Opening room settings")
|
||||
}
|
||||
is RoomListQuickSharedAction.Leave -> {
|
||||
is RoomListQuickActionsSharedAction.Leave -> {
|
||||
AlertDialog.Builder(requireContext())
|
||||
.setTitle(R.string.room_participants_leave_prompt_title)
|
||||
.setMessage(R.string.room_participants_leave_prompt_msg)
|
||||
|
|
|
@ -82,7 +82,7 @@ class RoomListQuickActionsBottomSheet : VectorBaseBottomSheetDialogFragment(), R
|
|||
super.invalidate()
|
||||
}
|
||||
|
||||
override fun didSelectMenuAction(quickAction: RoomListQuickSharedAction) {
|
||||
override fun didSelectMenuAction(quickAction: RoomListQuickActionsSharedAction) {
|
||||
actionsDispatcher.post(quickAction)
|
||||
dismiss()
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class RoomListQuickActionsEpoxyController @Inject constructor(private val avatar
|
|||
roomName(roomSummary.displayName)
|
||||
avatarUrl(roomSummary.avatarUrl)
|
||||
roomId(roomSummary.roomId)
|
||||
settingsClickListener(View.OnClickListener { listener?.didSelectMenuAction(RoomListQuickSharedAction.Settings(roomSummary.roomId)) })
|
||||
settingsClickListener(View.OnClickListener { listener?.didSelectMenuAction(RoomListQuickActionsSharedAction.Settings(roomSummary.roomId)) })
|
||||
}
|
||||
|
||||
// Notifications
|
||||
|
@ -51,26 +51,26 @@ class RoomListQuickActionsEpoxyController @Inject constructor(private val avatar
|
|||
}
|
||||
|
||||
val selectedRoomState = state.roomNotificationState()
|
||||
RoomListQuickSharedAction.NotificationsAllNoisy(roomSummary.roomId).toBottomSheetItem(0, selectedRoomState)
|
||||
RoomListQuickSharedAction.NotificationsAll(roomSummary.roomId).toBottomSheetItem(1, selectedRoomState)
|
||||
RoomListQuickSharedAction.NotificationsMentionsOnly(roomSummary.roomId).toBottomSheetItem(2, selectedRoomState)
|
||||
RoomListQuickSharedAction.NotificationsMute(roomSummary.roomId).toBottomSheetItem(3, selectedRoomState)
|
||||
RoomListQuickActionsSharedAction.NotificationsAllNoisy(roomSummary.roomId).toBottomSheetItem(0, selectedRoomState)
|
||||
RoomListQuickActionsSharedAction.NotificationsAll(roomSummary.roomId).toBottomSheetItem(1, selectedRoomState)
|
||||
RoomListQuickActionsSharedAction.NotificationsMentionsOnly(roomSummary.roomId).toBottomSheetItem(2, selectedRoomState)
|
||||
RoomListQuickActionsSharedAction.NotificationsMute(roomSummary.roomId).toBottomSheetItem(3, selectedRoomState)
|
||||
|
||||
// Leave
|
||||
bottomSheetItemSeparator {
|
||||
id("leave_separator")
|
||||
}
|
||||
RoomListQuickSharedAction.Leave(roomSummary.roomId).toBottomSheetItem(5)
|
||||
RoomListQuickActionsSharedAction.Leave(roomSummary.roomId).toBottomSheetItem(5)
|
||||
}
|
||||
|
||||
private fun RoomListQuickSharedAction.toBottomSheetItem(index: Int, roomNotificationState: RoomNotificationState? = null) {
|
||||
private fun RoomListQuickActionsSharedAction.toBottomSheetItem(index: Int, roomNotificationState: RoomNotificationState? = null) {
|
||||
val selected = when (this) {
|
||||
is RoomListQuickSharedAction.NotificationsAllNoisy -> roomNotificationState == RoomNotificationState.ALL_MESSAGES_NOISY
|
||||
is RoomListQuickSharedAction.NotificationsAll -> roomNotificationState == RoomNotificationState.ALL_MESSAGES
|
||||
is RoomListQuickSharedAction.NotificationsMentionsOnly -> roomNotificationState == RoomNotificationState.MENTIONS_ONLY
|
||||
is RoomListQuickSharedAction.NotificationsMute -> roomNotificationState == RoomNotificationState.MUTE
|
||||
is RoomListQuickSharedAction.Settings,
|
||||
is RoomListQuickSharedAction.Leave -> false
|
||||
is RoomListQuickActionsSharedAction.NotificationsAllNoisy -> roomNotificationState == RoomNotificationState.ALL_MESSAGES_NOISY
|
||||
is RoomListQuickActionsSharedAction.NotificationsAll -> roomNotificationState == RoomNotificationState.ALL_MESSAGES
|
||||
is RoomListQuickActionsSharedAction.NotificationsMentionsOnly -> roomNotificationState == RoomNotificationState.MENTIONS_ONLY
|
||||
is RoomListQuickActionsSharedAction.NotificationsMute -> roomNotificationState == RoomNotificationState.MUTE
|
||||
is RoomListQuickActionsSharedAction.Settings,
|
||||
is RoomListQuickActionsSharedAction.Leave -> false
|
||||
}
|
||||
return bottomSheetItemAction {
|
||||
id("action_$index")
|
||||
|
@ -83,6 +83,6 @@ class RoomListQuickActionsEpoxyController @Inject constructor(private val avatar
|
|||
}
|
||||
|
||||
interface Listener {
|
||||
fun didSelectMenuAction(quickAction: RoomListQuickSharedAction)
|
||||
fun didSelectMenuAction(quickAction: RoomListQuickActionsSharedAction)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,34 +21,34 @@ import androidx.annotation.StringRes
|
|||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.platform.VectorSharedAction
|
||||
|
||||
sealed class RoomListQuickSharedAction(@StringRes val titleRes: Int, @DrawableRes val iconResId: Int, val destructive: Boolean = false) : VectorSharedAction {
|
||||
sealed class RoomListQuickActionsSharedAction(@StringRes val titleRes: Int, @DrawableRes val iconResId: Int, val destructive: Boolean = false) : VectorSharedAction {
|
||||
|
||||
data class NotificationsAllNoisy(val roomId: String) : RoomListQuickSharedAction(
|
||||
data class NotificationsAllNoisy(val roomId: String) : RoomListQuickActionsSharedAction(
|
||||
R.string.room_list_quick_actions_notifications_all_noisy,
|
||||
R.drawable.ic_room_actions_notifications_all_noisy
|
||||
)
|
||||
|
||||
data class NotificationsAll(val roomId: String) : RoomListQuickSharedAction(
|
||||
data class NotificationsAll(val roomId: String) : RoomListQuickActionsSharedAction(
|
||||
R.string.room_list_quick_actions_notifications_all,
|
||||
R.drawable.ic_room_actions_notifications_all
|
||||
)
|
||||
|
||||
data class NotificationsMentionsOnly(val roomId: String) : RoomListQuickSharedAction(
|
||||
data class NotificationsMentionsOnly(val roomId: String) : RoomListQuickActionsSharedAction(
|
||||
R.string.room_list_quick_actions_notifications_mentions,
|
||||
R.drawable.ic_room_actions_notifications_mentions
|
||||
)
|
||||
|
||||
data class NotificationsMute(val roomId: String) : RoomListQuickSharedAction(
|
||||
data class NotificationsMute(val roomId: String) : RoomListQuickActionsSharedAction(
|
||||
R.string.room_list_quick_actions_notifications_mute,
|
||||
R.drawable.ic_room_actions_notifications_mutes
|
||||
)
|
||||
|
||||
data class Settings(val roomId: String) : RoomListQuickSharedAction(
|
||||
data class Settings(val roomId: String) : RoomListQuickActionsSharedAction(
|
||||
R.string.room_list_quick_actions_settings,
|
||||
R.drawable.ic_room_actions_settings
|
||||
)
|
||||
|
||||
data class Leave(val roomId: String) : RoomListQuickSharedAction(
|
||||
data class Leave(val roomId: String) : RoomListQuickActionsSharedAction(
|
||||
R.string.room_list_quick_actions_leave,
|
||||
R.drawable.ic_room_actions_leave,
|
||||
true
|
|
@ -21,4 +21,4 @@ import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
|||
/**
|
||||
* Activity shared view model to handle room list quick actions
|
||||
*/
|
||||
class RoomListQuickActionsStore : VectorSharedActionViewModel<RoomListQuickSharedAction>()
|
||||
class RoomListQuickActionsStore : VectorSharedActionViewModel<RoomListQuickActionsSharedAction>()
|
||||
|
|
Loading…
Reference in a new issue