From 238d1d87c61b9280a0a70499cd27b9bbb25421f1 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 8 Nov 2019 13:31:39 +0100 Subject: [PATCH] Rename class --- .../home/room/list/RoomListFragment.kt | 16 +++++------ .../RoomListQuickActionsBottomSheet.kt | 2 +- .../RoomListQuickActionsEpoxyController.kt | 28 +++++++++---------- ...kt => RoomListQuickActionsSharedAction.kt} | 14 +++++----- .../list/actions/RoomListQuickActionsStore.kt | 2 +- 5 files changed, 31 insertions(+), 31 deletions(-) rename vector/src/main/java/im/vector/riotx/features/home/room/list/actions/{RoomListQuickSharedAction.kt => RoomListQuickActionsSharedAction.kt} (80%) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/list/RoomListFragment.kt b/vector/src/main/java/im/vector/riotx/features/home/room/list/RoomListFragment.kt index 23fabe4b97..f2bd02f9a3 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/list/RoomListFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/list/RoomListFragment.kt @@ -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) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsBottomSheet.kt b/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsBottomSheet.kt index 50d0503693..d23183f077 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsBottomSheet.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsBottomSheet.kt @@ -82,7 +82,7 @@ class RoomListQuickActionsBottomSheet : VectorBaseBottomSheetDialogFragment(), R super.invalidate() } - override fun didSelectMenuAction(quickAction: RoomListQuickSharedAction) { + override fun didSelectMenuAction(quickAction: RoomListQuickActionsSharedAction) { actionsDispatcher.post(quickAction) dismiss() } diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt b/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt index d54edce712..2e17464cc6 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsEpoxyController.kt @@ -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) } } diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickSharedAction.kt b/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsSharedAction.kt similarity index 80% rename from vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickSharedAction.kt rename to vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsSharedAction.kt index 4033434327..5e0ca770dc 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickSharedAction.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsSharedAction.kt @@ -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 diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsStore.kt b/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsStore.kt index 891ffc81f0..fb4b7c0455 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsStore.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/list/actions/RoomListQuickActionsStore.kt @@ -21,4 +21,4 @@ import im.vector.riotx.core.platform.VectorSharedActionViewModel /** * Activity shared view model to handle room list quick actions */ -class RoomListQuickActionsStore : VectorSharedActionViewModel() +class RoomListQuickActionsStore : VectorSharedActionViewModel()