mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Rename stuff for code coherence
This commit is contained in:
parent
12376368c7
commit
631448335d
17 changed files with 60 additions and 60 deletions
|
@ -47,7 +47,7 @@ import javax.inject.Inject
|
|||
|
||||
class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
|
||||
|
||||
private lateinit var actionViewModel: HomeSharedActionViewModel
|
||||
private lateinit var sharedActionViewModel: HomeSharedActionViewModel
|
||||
|
||||
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
|
||||
@Inject lateinit var vectorUncaughtExceptionHandler: VectorUncaughtExceptionHandler
|
||||
|
@ -69,16 +69,16 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
FcmHelper.ensureFcmTokenIsRetrieved(this, pushManager)
|
||||
actionViewModel = ViewModelProviders.of(this).get(HomeSharedActionViewModel::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(this).get(HomeSharedActionViewModel::class.java)
|
||||
drawerLayout.addDrawerListener(drawerListener)
|
||||
if (isFirstCreation()) {
|
||||
replaceFragment(R.id.homeDetailFragmentContainer, LoadingFragment::class.java)
|
||||
replaceFragment(R.id.homeDrawerFragmentContainer, HomeDrawerFragment::class.java)
|
||||
}
|
||||
|
||||
actionViewModel.observe()
|
||||
.subscribe { navigation ->
|
||||
when (navigation) {
|
||||
sharedActionViewModel.observe()
|
||||
.subscribe { sharedAction ->
|
||||
when (sharedAction) {
|
||||
is HomeActivitySharedAction.OpenDrawer -> drawerLayout.openDrawer(GravityCompat.START)
|
||||
is HomeActivitySharedAction.OpenGroup -> {
|
||||
drawerLayout.closeDrawer(GravityCompat.START)
|
||||
|
|
|
@ -54,7 +54,7 @@ class HomeDetailFragment @Inject constructor(
|
|||
private val unreadCounterBadgeViews = arrayListOf<UnreadCounterBadgeView>()
|
||||
|
||||
private val viewModel: HomeDetailViewModel by fragmentViewModel()
|
||||
private lateinit var actionViewModel: HomeSharedActionViewModel
|
||||
private lateinit var sharedActionViewModel: HomeSharedActionViewModel
|
||||
|
||||
override fun getLayoutResId(): Int {
|
||||
return R.layout.fragment_home_detail
|
||||
|
@ -63,7 +63,7 @@ class HomeDetailFragment @Inject constructor(
|
|||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
|
||||
actionViewModel = ViewModelProviders.of(requireActivity()).get(HomeSharedActionViewModel::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(HomeSharedActionViewModel::class.java)
|
||||
|
||||
setupBottomNavigationView()
|
||||
setupToolbar()
|
||||
|
@ -129,7 +129,7 @@ class HomeDetailFragment @Inject constructor(
|
|||
}
|
||||
groupToolbar.title = ""
|
||||
groupToolbarAvatarImageView.setOnClickListener {
|
||||
actionViewModel.post(HomeActivitySharedAction.OpenDrawer)
|
||||
sharedActionViewModel.post(HomeActivitySharedAction.OpenDrawer)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import javax.inject.Inject
|
|||
class CreateDirectRoomActivity : SimpleFragmentActivity() {
|
||||
|
||||
private val viewModel: CreateDirectRoomViewModel by viewModel()
|
||||
private lateinit var actionViewModel: CreateDirectRoomSharedActionViewModel
|
||||
private lateinit var sharedActionViewModel: CreateDirectRoomSharedActionViewModel
|
||||
@Inject lateinit var createDirectRoomViewModelFactory: CreateDirectRoomViewModel.Factory
|
||||
@Inject lateinit var errorFormatter: ErrorFormatter
|
||||
|
||||
|
@ -51,10 +51,10 @@ class CreateDirectRoomActivity : SimpleFragmentActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
toolbar.visibility = View.GONE
|
||||
actionViewModel = ViewModelProviders.of(this, viewModelFactory).get(CreateDirectRoomSharedActionViewModel::class.java)
|
||||
actionViewModel.observe()
|
||||
.subscribe { navigation ->
|
||||
when (navigation) {
|
||||
sharedActionViewModel = ViewModelProviders.of(this, viewModelFactory).get(CreateDirectRoomSharedActionViewModel::class.java)
|
||||
sharedActionViewModel.observe()
|
||||
.subscribe { sharedAction ->
|
||||
when (sharedAction) {
|
||||
CreateDirectRoomSharedAction.OpenUsersDirectory -> addFragmentToBackstack(R.id.container, CreateDirectRoomDirectoryUsersFragment::class.java)
|
||||
CreateDirectRoomSharedAction.Close -> finish()
|
||||
CreateDirectRoomSharedAction.GoBack -> onBackPressed()
|
||||
|
|
|
@ -39,11 +39,11 @@ class CreateDirectRoomDirectoryUsersFragment @Inject constructor(
|
|||
|
||||
private val viewModel: CreateDirectRoomViewModel by activityViewModel()
|
||||
|
||||
private lateinit var actionViewModel: CreateDirectRoomSharedActionViewModel
|
||||
private lateinit var sharedActionViewModel: CreateDirectRoomSharedActionViewModel
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
actionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(CreateDirectRoomSharedActionViewModel::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(CreateDirectRoomSharedActionViewModel::class.java)
|
||||
setupRecyclerView()
|
||||
setupSearchByMatrixIdView()
|
||||
setupCloseView()
|
||||
|
@ -70,7 +70,7 @@ class CreateDirectRoomDirectoryUsersFragment @Inject constructor(
|
|||
|
||||
private fun setupCloseView() {
|
||||
createDirectRoomClose.setOnClickListener {
|
||||
actionViewModel.post(CreateDirectRoomSharedAction.GoBack)
|
||||
sharedActionViewModel.post(CreateDirectRoomSharedAction.GoBack)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ class CreateDirectRoomDirectoryUsersFragment @Inject constructor(
|
|||
override fun onItemClick(user: User) {
|
||||
view?.hideKeyboard()
|
||||
viewModel.handle(CreateDirectRoomAction.SelectUser(user))
|
||||
actionViewModel.post(CreateDirectRoomSharedAction.GoBack)
|
||||
sharedActionViewModel.post(CreateDirectRoomSharedAction.GoBack)
|
||||
}
|
||||
|
||||
override fun retryDirectoryUsersRequest() {
|
||||
|
|
|
@ -49,11 +49,11 @@ class CreateDirectRoomKnownUsersFragment @Inject constructor(
|
|||
override fun getMenuRes() = R.menu.vector_create_direct_room
|
||||
|
||||
private val viewModel: CreateDirectRoomViewModel by activityViewModel()
|
||||
private lateinit var actionViewModel: CreateDirectRoomSharedActionViewModel
|
||||
private lateinit var sharedActionViewModel: CreateDirectRoomSharedActionViewModel
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
actionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(CreateDirectRoomSharedActionViewModel::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(CreateDirectRoomSharedActionViewModel::class.java)
|
||||
vectorBaseActivity.setSupportActionBar(createDirectRoomToolbar)
|
||||
setupRecyclerView()
|
||||
setupFilterView()
|
||||
|
@ -89,7 +89,7 @@ class CreateDirectRoomKnownUsersFragment @Inject constructor(
|
|||
|
||||
private fun setupAddByMatrixIdView() {
|
||||
addByMatrixId.setOnClickListener {
|
||||
actionViewModel.post(CreateDirectRoomSharedAction.OpenUsersDirectory)
|
||||
sharedActionViewModel.post(CreateDirectRoomSharedAction.OpenUsersDirectory)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,20 +36,20 @@ class GroupListFragment @Inject constructor(
|
|||
private val groupController: GroupSummaryController
|
||||
) : VectorBaseFragment(), GroupSummaryController.Callback {
|
||||
|
||||
private lateinit var actionViewModel: HomeSharedActionViewModel
|
||||
private lateinit var sharedActionViewModel: HomeSharedActionViewModel
|
||||
private val viewModel: GroupListViewModel by fragmentViewModel()
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_group_list
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
actionViewModel = ViewModelProviders.of(requireActivity()).get(HomeSharedActionViewModel::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(HomeSharedActionViewModel::class.java)
|
||||
groupController.callback = this
|
||||
stateView.contentView = groupListEpoxyRecyclerView
|
||||
groupListEpoxyRecyclerView.setController(groupController)
|
||||
viewModel.subscribe { renderState(it) }
|
||||
viewModel.openGroupLiveData.observeEvent(this) {
|
||||
actionViewModel.post(HomeActivitySharedAction.OpenGroup)
|
||||
sharedActionViewModel.post(HomeActivitySharedAction.OpenGroup)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ import im.vector.riotx.features.home.room.detail.composer.TextComposerViewState
|
|||
import im.vector.riotx.features.home.room.detail.readreceipts.DisplayReadReceiptsBottomSheet
|
||||
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
||||
import im.vector.riotx.features.home.room.detail.timeline.action.MessageActionsBottomSheet
|
||||
import im.vector.riotx.features.home.room.detail.timeline.action.MessageActionsDispatcher
|
||||
import im.vector.riotx.features.home.room.detail.timeline.action.MessageSharedActionViewModel
|
||||
import im.vector.riotx.features.home.room.detail.timeline.action.EventSharedAction
|
||||
import im.vector.riotx.features.home.room.detail.timeline.edithistory.ViewEditHistoryBottomSheet
|
||||
import im.vector.riotx.features.home.room.detail.timeline.item.*
|
||||
|
@ -193,7 +193,7 @@ class RoomDetailFragment @Inject constructor(
|
|||
|
||||
override fun getMenuRes() = R.menu.menu_timeline
|
||||
|
||||
private lateinit var messageActionsDispatcher: MessageActionsDispatcher
|
||||
private lateinit var sharedActionViewModel: MessageSharedActionViewModel
|
||||
private lateinit var layoutManager: LinearLayoutManager
|
||||
private lateinit var attachmentsHelper: AttachmentsHelper
|
||||
private lateinit var keyboardStateUtils: KeyboardStateUtils
|
||||
|
@ -206,7 +206,7 @@ class RoomDetailFragment @Inject constructor(
|
|||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
messageActionsDispatcher = ViewModelProviders.of(requireActivity()).get(MessageActionsDispatcher::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(MessageSharedActionViewModel::class.java)
|
||||
attachmentsHelper = AttachmentsHelper.create(this, this).register()
|
||||
keyboardStateUtils = KeyboardStateUtils(requireActivity())
|
||||
setupToolbar(roomToolbar)
|
||||
|
@ -225,7 +225,7 @@ class RoomDetailFragment @Inject constructor(
|
|||
val message = requireContext().getString(pair.first, *pair.second.toTypedArray())
|
||||
showSnackWithMessage(message, Snackbar.LENGTH_LONG)
|
||||
}
|
||||
messageActionsDispatcher
|
||||
sharedActionViewModel
|
||||
.observe()
|
||||
.subscribe {
|
||||
handleActions(it)
|
||||
|
|
|
@ -47,7 +47,7 @@ class MessageActionsBottomSheet : VectorBaseBottomSheetDialogFragment(), Message
|
|||
|
||||
override val showExpanded = true
|
||||
|
||||
private lateinit var messageActionsStore: MessageActionsDispatcher
|
||||
private lateinit var sharedActionViewModel: MessageSharedActionViewModel
|
||||
|
||||
override fun injectWith(screenComponent: ScreenComponent) {
|
||||
screenComponent.inject(this)
|
||||
|
@ -61,7 +61,7 @@ class MessageActionsBottomSheet : VectorBaseBottomSheetDialogFragment(), Message
|
|||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
messageActionsStore = ViewModelProviders.of(requireActivity()).get(MessageActionsDispatcher::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(MessageSharedActionViewModel::class.java)
|
||||
recyclerView.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
|
||||
recyclerView.adapter = messageActionsEpoxyController.adapter
|
||||
// Disable item animation
|
||||
|
@ -74,7 +74,7 @@ class MessageActionsBottomSheet : VectorBaseBottomSheetDialogFragment(), Message
|
|||
// Toggle report menu
|
||||
viewModel.handle(MessageActionsAction.ToggleReportMenu)
|
||||
} else {
|
||||
messageActionsStore.post(eventAction)
|
||||
sharedActionViewModel.post(eventAction)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,4 +20,4 @@ import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
|||
/**
|
||||
* Activity shared view model to handle message actions
|
||||
*/
|
||||
class MessageActionsDispatcher : VectorSharedActionViewModel<EventSharedAction>()
|
||||
class MessageSharedActionViewModel : VectorSharedActionViewModel<EventSharedAction>()
|
|
@ -41,7 +41,7 @@ import im.vector.riotx.core.platform.StateView
|
|||
import im.vector.riotx.core.platform.VectorBaseFragment
|
||||
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.actions.RoomListQuickActionsSharedActionViewModel
|
||||
import im.vector.riotx.features.home.room.list.widget.FabMenuView
|
||||
import im.vector.riotx.features.notifications.NotificationDrawerManager
|
||||
import im.vector.riotx.features.share.SharedData
|
||||
|
@ -72,7 +72,7 @@ class RoomListFragment @Inject constructor(
|
|||
SHARE(/* Not used */ 0)
|
||||
}
|
||||
|
||||
private lateinit var quickActionsDispatcher: RoomListQuickActionsStore
|
||||
private lateinit var sharedActionViewModel: RoomListQuickActionsSharedActionViewModel
|
||||
private val roomListParams: RoomListParams by args()
|
||||
private val roomListViewModel: RoomListViewModel by fragmentViewModel()
|
||||
|
||||
|
@ -100,7 +100,7 @@ class RoomListFragment @Inject constructor(
|
|||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
quickActionsDispatcher = ViewModelProviders.of(requireActivity()).get(RoomListQuickActionsStore::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(RoomListQuickActionsSharedActionViewModel::class.java)
|
||||
setupCreateRoomButton()
|
||||
setupRecyclerView()
|
||||
roomListViewModel.subscribe { renderState(it) }
|
||||
|
@ -118,7 +118,7 @@ class RoomListFragment @Inject constructor(
|
|||
|
||||
createChatFabMenu.listener = this
|
||||
|
||||
quickActionsDispatcher
|
||||
sharedActionViewModel
|
||||
.observe()
|
||||
.subscribe { handleQuickActions(it) }
|
||||
.disposeOnDestroy()
|
||||
|
|
|
@ -45,7 +45,7 @@ data class RoomListActionsArgs(
|
|||
*/
|
||||
class RoomListQuickActionsBottomSheet : VectorBaseBottomSheetDialogFragment(), RoomListQuickActionsEpoxyController.Listener {
|
||||
|
||||
private lateinit var actionsDispatcher: RoomListQuickActionsStore
|
||||
private lateinit var sharedActionViewModel: RoomListQuickActionsSharedActionViewModel
|
||||
@Inject lateinit var roomListActionsViewModelFactory: RoomListQuickActionsViewModel.Factory
|
||||
@Inject lateinit var roomListActionsEpoxyController: RoomListQuickActionsEpoxyController
|
||||
@Inject lateinit var navigator: Navigator
|
||||
|
@ -69,7 +69,7 @@ class RoomListQuickActionsBottomSheet : VectorBaseBottomSheetDialogFragment(), R
|
|||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
actionsDispatcher = ViewModelProviders.of(requireActivity()).get(RoomListQuickActionsStore::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(RoomListQuickActionsSharedActionViewModel::class.java)
|
||||
recyclerView.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
|
||||
recyclerView.adapter = roomListActionsEpoxyController.adapter
|
||||
// Disable item animation
|
||||
|
@ -83,7 +83,7 @@ class RoomListQuickActionsBottomSheet : VectorBaseBottomSheetDialogFragment(), R
|
|||
}
|
||||
|
||||
override fun didSelectMenuAction(quickAction: RoomListQuickActionsSharedAction) {
|
||||
actionsDispatcher.post(quickAction)
|
||||
sharedActionViewModel.post(quickAction)
|
||||
dismiss()
|
||||
}
|
||||
|
||||
|
|
|
@ -21,4 +21,4 @@ import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
|||
/**
|
||||
* Activity shared view model to handle room list quick actions
|
||||
*/
|
||||
class RoomListQuickActionsStore : VectorSharedActionViewModel<RoomListQuickActionsSharedAction>()
|
||||
class RoomListQuickActionsSharedActionViewModel : VectorSharedActionViewModel<RoomListQuickActionsSharedAction>()
|
|
@ -47,7 +47,7 @@ class PublicRoomsFragment @Inject constructor(
|
|||
) : VectorBaseFragment(), PublicRoomsController.Callback {
|
||||
|
||||
private val viewModel: RoomDirectoryViewModel by activityViewModel()
|
||||
private lateinit var actionViewModel: RoomDirectorySharedActionViewModel
|
||||
private lateinit var sharedActionViewModel: RoomDirectorySharedActionViewModel
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_public_rooms
|
||||
|
||||
|
@ -71,7 +71,7 @@ class PublicRoomsFragment @Inject constructor(
|
|||
.disposeOnDestroy()
|
||||
|
||||
publicRoomsCreateNewRoom.setOnClickListener {
|
||||
actionViewModel.post(RoomDirectorySharedAction.CreateRoom)
|
||||
sharedActionViewModel.post(RoomDirectorySharedAction.CreateRoom)
|
||||
}
|
||||
|
||||
viewModel.joinRoomErrorLiveData.observeEvent(this) { throwable ->
|
||||
|
@ -83,7 +83,7 @@ class PublicRoomsFragment @Inject constructor(
|
|||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.menu_room_directory_change_protocol -> {
|
||||
actionViewModel.post(RoomDirectorySharedAction.ChangeProtocol)
|
||||
sharedActionViewModel.post(RoomDirectorySharedAction.ChangeProtocol)
|
||||
true
|
||||
}
|
||||
else ->
|
||||
|
@ -93,7 +93,7 @@ class PublicRoomsFragment @Inject constructor(
|
|||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
actionViewModel = ViewModelProviders.of(requireActivity()).get(RoomDirectorySharedActionViewModel::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(RoomDirectorySharedActionViewModel::class.java)
|
||||
setupRecyclerView()
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class RoomDirectoryActivity : VectorBaseActivity() {
|
|||
@Inject lateinit var roomDirectoryViewModelFactory: RoomDirectoryViewModel.Factory
|
||||
private val roomDirectoryViewModel: RoomDirectoryViewModel by viewModel()
|
||||
private val createRoomViewModel: CreateRoomViewModel by viewModel()
|
||||
private lateinit var actionViewModel: RoomDirectorySharedActionViewModel
|
||||
private lateinit var sharedActionViewModel: RoomDirectorySharedActionViewModel
|
||||
|
||||
override fun getLayoutRes() = R.layout.activity_simple
|
||||
|
||||
|
@ -48,15 +48,15 @@ class RoomDirectoryActivity : VectorBaseActivity() {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
actionViewModel = ViewModelProviders.of(this, viewModelFactory).get(RoomDirectorySharedActionViewModel::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(this, viewModelFactory).get(RoomDirectorySharedActionViewModel::class.java)
|
||||
|
||||
if (isFirstCreation()) {
|
||||
roomDirectoryViewModel.handle(RoomDirectoryAction.FilterWith(intent?.getStringExtra(INITIAL_FILTER) ?: ""))
|
||||
}
|
||||
|
||||
actionViewModel.observe()
|
||||
.subscribe { navigation ->
|
||||
when (navigation) {
|
||||
sharedActionViewModel.observe()
|
||||
.subscribe { sharedAction ->
|
||||
when (sharedAction) {
|
||||
is RoomDirectorySharedAction.Back -> onBackPressed()
|
||||
is RoomDirectorySharedAction.CreateRoom -> addFragmentToBackstack(R.id.simpleFragmentContainer, CreateRoomFragment::class.java)
|
||||
is RoomDirectorySharedAction.ChangeProtocol -> addFragmentToBackstack(R.id.simpleFragmentContainer, RoomDirectoryPickerFragment::class.java)
|
||||
|
|
|
@ -38,7 +38,7 @@ class CreateRoomActivity : VectorBaseActivity(), ToolbarConfigurable {
|
|||
@Inject lateinit var createRoomViewModelFactory: CreateRoomViewModel.Factory
|
||||
private val createRoomViewModel: CreateRoomViewModel by viewModel()
|
||||
|
||||
private lateinit var actionViewModel: RoomDirectorySharedActionViewModel
|
||||
private lateinit var sharedActionViewModel: RoomDirectorySharedActionViewModel
|
||||
|
||||
override fun getLayoutRes() = R.layout.activity_simple
|
||||
|
||||
|
@ -55,10 +55,10 @@ class CreateRoomActivity : VectorBaseActivity(), ToolbarConfigurable {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
actionViewModel = ViewModelProviders.of(this, viewModelFactory).get(RoomDirectorySharedActionViewModel::class.java)
|
||||
actionViewModel.observe()
|
||||
.subscribe { navigation ->
|
||||
when (navigation) {
|
||||
sharedActionViewModel = ViewModelProviders.of(this, viewModelFactory).get(RoomDirectorySharedActionViewModel::class.java)
|
||||
sharedActionViewModel.observe()
|
||||
.subscribe { sharedAction ->
|
||||
when (sharedAction) {
|
||||
is RoomDirectorySharedAction.Back,
|
||||
is RoomDirectorySharedAction.Close -> finish()
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import javax.inject.Inject
|
|||
|
||||
class CreateRoomFragment @Inject constructor(private val createRoomController: CreateRoomController) : VectorBaseFragment(), CreateRoomController.Listener {
|
||||
|
||||
private lateinit var actionViewModel: RoomDirectorySharedActionViewModel
|
||||
private lateinit var sharedActionViewModel: RoomDirectorySharedActionViewModel
|
||||
private val viewModel: CreateRoomViewModel by activityViewModel()
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_create_room
|
||||
|
@ -43,10 +43,10 @@ class CreateRoomFragment @Inject constructor(private val createRoomController: C
|
|||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
vectorBaseActivity.setSupportActionBar(createRoomToolbar)
|
||||
actionViewModel = ViewModelProviders.of(requireActivity()).get(RoomDirectorySharedActionViewModel::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(RoomDirectorySharedActionViewModel::class.java)
|
||||
setupRecyclerView()
|
||||
createRoomClose.setOnClickListener {
|
||||
actionViewModel.post(RoomDirectorySharedAction.Back)
|
||||
sharedActionViewModel.post(RoomDirectorySharedAction.Back)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ class CreateRoomFragment @Inject constructor(private val createRoomController: C
|
|||
// Navigate to freshly created room
|
||||
navigator.openRoom(requireActivity(), async())
|
||||
|
||||
actionViewModel.post(RoomDirectorySharedAction.Close)
|
||||
sharedActionViewModel.post(RoomDirectorySharedAction.Close)
|
||||
} else {
|
||||
// Populate list with Epoxy
|
||||
createRoomController.setData(state)
|
||||
|
|
|
@ -42,7 +42,7 @@ class RoomDirectoryPickerFragment @Inject constructor(val roomDirectoryPickerVie
|
|||
) : VectorBaseFragment(), RoomDirectoryPickerController.Callback {
|
||||
|
||||
private val viewModel: RoomDirectoryViewModel by activityViewModel()
|
||||
private lateinit var actionViewModel: RoomDirectorySharedActionViewModel
|
||||
private lateinit var sharedActionViewModel: RoomDirectorySharedActionViewModel
|
||||
private val pickerViewModel: RoomDirectoryPickerViewModel by fragmentViewModel()
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_room_directory_picker
|
||||
|
@ -72,7 +72,7 @@ class RoomDirectoryPickerFragment @Inject constructor(val roomDirectoryPickerVie
|
|||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
actionViewModel = ViewModelProviders.of(requireActivity()).get(RoomDirectorySharedActionViewModel::class.java)
|
||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(RoomDirectorySharedActionViewModel::class.java)
|
||||
setupRecyclerView()
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ class RoomDirectoryPickerFragment @Inject constructor(val roomDirectoryPickerVie
|
|||
Timber.v("onRoomDirectoryClicked: $roomDirectoryData")
|
||||
viewModel.handle(RoomDirectoryAction.SetRoomDirectoryData(roomDirectoryData))
|
||||
|
||||
actionViewModel.post(RoomDirectorySharedAction.Back)
|
||||
sharedActionViewModel.post(RoomDirectorySharedAction.Back)
|
||||
}
|
||||
|
||||
override fun retry() {
|
||||
|
|
Loading…
Reference in a new issue