mirror of
https://github.com/element-hq/element-android
synced 2024-11-25 02:45:37 +03:00
Fix crash
This commit is contained in:
parent
ea7213a5ae
commit
a6df63f6d9
27 changed files with 59 additions and 48 deletions
|
@ -27,6 +27,10 @@ import im.vector.riotx.features.crypto.keysbackup.restore.KeysBackupRestoreFromP
|
||||||
import im.vector.riotx.features.crypto.keysbackup.restore.KeysBackupRestoreSharedViewModel
|
import im.vector.riotx.features.crypto.keysbackup.restore.KeysBackupRestoreSharedViewModel
|
||||||
import im.vector.riotx.features.crypto.keysbackup.setup.KeysBackupSetupSharedViewModel
|
import im.vector.riotx.features.crypto.keysbackup.setup.KeysBackupSetupSharedViewModel
|
||||||
import im.vector.riotx.features.crypto.verification.SasVerificationViewModel
|
import im.vector.riotx.features.crypto.verification.SasVerificationViewModel
|
||||||
|
import im.vector.riotx.features.home.HomeSharedActionViewModel
|
||||||
|
import im.vector.riotx.features.home.createdirect.CreateDirectRoomSharedActionViewModel
|
||||||
|
import im.vector.riotx.features.home.room.detail.timeline.action.MessageSharedActionViewModel
|
||||||
|
import im.vector.riotx.features.home.room.list.actions.RoomListQuickActionsSharedActionViewModel
|
||||||
import im.vector.riotx.features.reactions.EmojiChooserViewModel
|
import im.vector.riotx.features.reactions.EmojiChooserViewModel
|
||||||
import im.vector.riotx.features.workers.signout.SignOutViewModel
|
import im.vector.riotx.features.workers.signout.SignOutViewModel
|
||||||
|
|
||||||
|
@ -82,4 +86,24 @@ interface ViewModelModule {
|
||||||
@IntoMap
|
@IntoMap
|
||||||
@ViewModelKey(ConfigurationViewModel::class)
|
@ViewModelKey(ConfigurationViewModel::class)
|
||||||
fun bindConfigurationViewModel(viewModel: ConfigurationViewModel): ViewModel
|
fun bindConfigurationViewModel(viewModel: ConfigurationViewModel): ViewModel
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@ViewModelKey(CreateDirectRoomSharedActionViewModel::class)
|
||||||
|
fun bindCreateDirectRoomSharedActionViewModel(viewModel: CreateDirectRoomSharedActionViewModel): ViewModel
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@ViewModelKey(HomeSharedActionViewModel::class)
|
||||||
|
fun bindHomeSharedActionViewModel(viewModel: HomeSharedActionViewModel): ViewModel
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@ViewModelKey(MessageSharedActionViewModel::class)
|
||||||
|
fun bindMessageSharedActionViewModel(viewModel: MessageSharedActionViewModel): ViewModel
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@ViewModelKey(RoomListQuickActionsSharedActionViewModel::class)
|
||||||
|
fun bindRoomListQuickActionsSharedActionViewModel(viewModel: RoomListQuickActionsSharedActionViewModel): ViewModel
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import androidx.annotation.CallSuper
|
import androidx.annotation.CallSuper
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import com.airbnb.mvrx.MvRx
|
import com.airbnb.mvrx.MvRx
|
||||||
import com.airbnb.mvrx.MvRxView
|
import com.airbnb.mvrx.MvRxView
|
||||||
import com.airbnb.mvrx.MvRxViewModelStore
|
import com.airbnb.mvrx.MvRxViewModelStore
|
||||||
|
@ -30,7 +31,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
import im.vector.riotx.core.di.DaggerScreenComponent
|
import im.vector.riotx.core.di.DaggerScreenComponent
|
||||||
import im.vector.riotx.core.di.ScreenComponent
|
import im.vector.riotx.core.di.ScreenComponent
|
||||||
import im.vector.riotx.core.utils.DimensionConverter
|
import im.vector.riotx.core.utils.DimensionConverter
|
||||||
import java.util.UUID
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add MvRx capabilities to bottomsheetdialog (like BaseMvRxFragment)
|
* Add MvRx capabilities to bottomsheetdialog (like BaseMvRxFragment)
|
||||||
|
@ -40,6 +41,7 @@ abstract class VectorBaseBottomSheetDialogFragment : BottomSheetDialogFragment()
|
||||||
override val mvrxViewModelStore by lazy { MvRxViewModelStore(viewModelStore) }
|
override val mvrxViewModelStore by lazy { MvRxViewModelStore(viewModelStore) }
|
||||||
private lateinit var mvrxPersistedViewId: String
|
private lateinit var mvrxPersistedViewId: String
|
||||||
private lateinit var screenComponent: ScreenComponent
|
private lateinit var screenComponent: ScreenComponent
|
||||||
|
protected lateinit var viewModelFactory: ViewModelProvider.Factory
|
||||||
final override val mvrxViewId: String by lazy { mvrxPersistedViewId }
|
final override val mvrxViewId: String by lazy { mvrxPersistedViewId }
|
||||||
|
|
||||||
private var bottomSheetBehavior: BottomSheetBehavior<FrameLayout>? = null
|
private var bottomSheetBehavior: BottomSheetBehavior<FrameLayout>? = null
|
||||||
|
@ -52,6 +54,7 @@ abstract class VectorBaseBottomSheetDialogFragment : BottomSheetDialogFragment()
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
screenComponent = DaggerScreenComponent.factory().create(vectorBaseActivity.getVectorComponent(), vectorBaseActivity)
|
screenComponent = DaggerScreenComponent.factory().create(vectorBaseActivity.getVectorComponent(), vectorBaseActivity)
|
||||||
|
viewModelFactory = screenComponent.viewModelFactory()
|
||||||
super.onAttach(context)
|
super.onAttach(context)
|
||||||
injectWith(screenComponent)
|
injectWith(screenComponent)
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,7 @@ class KeysBackupRestoreFromKeyFragment @Inject constructor()
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
viewModel = ViewModelProviders.of(this, viewModelFactory).get(KeysBackupRestoreFromKeyViewModel::class.java)
|
viewModel = ViewModelProviders.of(this, viewModelFactory).get(KeysBackupRestoreFromKeyViewModel::class.java)
|
||||||
sharedViewModel = activity?.run {
|
sharedViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(KeysBackupRestoreSharedViewModel::class.java)
|
||||||
ViewModelProviders.of(this, viewModelFactory).get(KeysBackupRestoreSharedViewModel::class.java)
|
|
||||||
} ?: throw Exception("Invalid Activity")
|
|
||||||
|
|
||||||
mKeyTextEdit.setText(viewModel.recoveryCode.value)
|
mKeyTextEdit.setText(viewModel.recoveryCode.value)
|
||||||
mKeyTextEdit.setOnEditorActionListener { _, actionId, _ ->
|
mKeyTextEdit.setOnEditorActionListener { _, actionId, _ ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||||
|
|
|
@ -65,9 +65,7 @@ class KeysBackupRestoreFromPassphraseFragment @Inject constructor(): VectorBaseF
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
|
|
||||||
viewModel = ViewModelProviders.of(this, viewModelFactory).get(KeysBackupRestoreFromPassphraseViewModel::class.java)
|
viewModel = ViewModelProviders.of(this, viewModelFactory).get(KeysBackupRestoreFromPassphraseViewModel::class.java)
|
||||||
sharedViewModel = activity?.run {
|
sharedViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(KeysBackupRestoreSharedViewModel::class.java)
|
||||||
ViewModelProviders.of(this, viewModelFactory).get(KeysBackupRestoreSharedViewModel::class.java)
|
|
||||||
} ?: throw Exception("Invalid Activity")
|
|
||||||
|
|
||||||
viewModel.passphraseErrorText.observe(viewLifecycleOwner, Observer { newValue ->
|
viewModel.passphraseErrorText.observe(viewLifecycleOwner, Observer { newValue ->
|
||||||
mPassphraseInputLayout.error = newValue
|
mPassphraseInputLayout.error = newValue
|
||||||
|
|
|
@ -38,9 +38,7 @@ class KeysBackupRestoreSuccessFragment @Inject constructor() : VectorBaseFragmen
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
sharedViewModel = activity?.run {
|
sharedViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(KeysBackupRestoreSharedViewModel::class.java)
|
||||||
ViewModelProviders.of(this, viewModelFactory).get(KeysBackupRestoreSharedViewModel::class.java)
|
|
||||||
} ?: throw Exception("Invalid Activity")
|
|
||||||
|
|
||||||
sharedViewModel.importKeyResult?.let {
|
sharedViewModel.importKeyResult?.let {
|
||||||
val part1 = resources.getQuantityString(R.plurals.keys_backup_restore_success_description_part1,
|
val part1 = resources.getQuantityString(R.plurals.keys_backup_restore_success_description_part1,
|
||||||
|
|
|
@ -44,9 +44,7 @@ class KeysBackupSetupStep1Fragment @Inject constructor() : VectorBaseFragment()
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
|
|
||||||
viewModel = activity?.run {
|
viewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(KeysBackupSetupSharedViewModel::class.java)
|
||||||
ViewModelProviders.of(this, viewModelFactory).get(KeysBackupSetupSharedViewModel::class.java)
|
|
||||||
} ?: throw Exception("Invalid Activity")
|
|
||||||
|
|
||||||
viewModel.showManualExport.observe(viewLifecycleOwner, Observer {
|
viewModel.showManualExport.observe(viewLifecycleOwner, Observer {
|
||||||
val showOption = it ?: false
|
val showOption = it ?: false
|
||||||
|
|
|
@ -79,9 +79,7 @@ class KeysBackupSetupStep2Fragment @Inject constructor() : VectorBaseFragment()
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
|
|
||||||
viewModel = activity?.run {
|
viewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(KeysBackupSetupSharedViewModel::class.java)
|
||||||
ViewModelProviders.of(this, viewModelFactory).get(KeysBackupSetupSharedViewModel::class.java)
|
|
||||||
} ?: throw Exception("Invalid Activity")
|
|
||||||
|
|
||||||
viewModel.shouldPromptOnBack = true
|
viewModel.shouldPromptOnBack = true
|
||||||
bindViewToViewModel()
|
bindViewToViewModel()
|
||||||
|
|
|
@ -58,9 +58,7 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment()
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
viewModel = activity?.run {
|
viewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(KeysBackupSetupSharedViewModel::class.java)
|
||||||
ViewModelProviders.of(this, viewModelFactory).get(KeysBackupSetupSharedViewModel::class.java)
|
|
||||||
} ?: throw Exception("Invalid Activity")
|
|
||||||
|
|
||||||
viewModel.shouldPromptOnBack = false
|
viewModel.shouldPromptOnBack = false
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,7 @@ class SASVerificationIncomingFragment @Inject constructor(
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
|
|
||||||
viewModel = activity?.run {
|
viewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(SasVerificationViewModel::class.java)
|
||||||
ViewModelProviders.of(this, viewModelFactory).get(SasVerificationViewModel::class.java)
|
|
||||||
} ?: throw Exception("Invalid Activity")
|
|
||||||
|
|
||||||
otherUserDisplayNameTextView.text = viewModel.otherUser?.displayName ?: viewModel.otherUserId
|
otherUserDisplayNameTextView.text = viewModel.otherUser?.displayName ?: viewModel.otherUserId
|
||||||
otherUserIdTextView.text = viewModel.otherUserId
|
otherUserIdTextView.text = viewModel.otherUserId
|
||||||
|
|
|
@ -62,9 +62,7 @@ class SASVerificationShortCodeFragment @Inject constructor(): VectorBaseFragment
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
viewModel = activity?.run {
|
viewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(SasVerificationViewModel::class.java)
|
||||||
ViewModelProviders.of(this, viewModelFactory).get(SasVerificationViewModel::class.java)
|
|
||||||
} ?: throw Exception("Invalid Activity")
|
|
||||||
|
|
||||||
viewModel.transaction?.let {
|
viewModel.transaction?.let {
|
||||||
if (it.supportsEmoji()) {
|
if (it.supportsEmoji()) {
|
||||||
|
|
|
@ -31,9 +31,7 @@ class SASVerificationVerifiedFragment @Inject constructor() : VectorBaseFragment
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
|
|
||||||
viewModel = activity?.run {
|
viewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(SasVerificationViewModel::class.java)
|
||||||
ViewModelProviders.of(this, viewModelFactory).get(SasVerificationViewModel::class.java)
|
|
||||||
} ?: throw Exception("Invalid Activity")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.sas_verification_verified_done_button)
|
@OnClick(R.id.sas_verification_verified_done_button)
|
||||||
|
|
|
@ -69,7 +69,7 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
FcmHelper.ensureFcmTokenIsRetrieved(this, pushManager)
|
FcmHelper.ensureFcmTokenIsRetrieved(this, pushManager)
|
||||||
sharedActionViewModel = ViewModelProviders.of(this).get(HomeSharedActionViewModel::class.java)
|
sharedActionViewModel = ViewModelProviders.of(this, viewModelFactory).get(HomeSharedActionViewModel::class.java)
|
||||||
drawerLayout.addDrawerListener(drawerListener)
|
drawerLayout.addDrawerListener(drawerListener)
|
||||||
if (isFirstCreation()) {
|
if (isFirstCreation()) {
|
||||||
replaceFragment(R.id.homeDetailFragmentContainer, LoadingFragment::class.java)
|
replaceFragment(R.id.homeDetailFragmentContainer, LoadingFragment::class.java)
|
||||||
|
@ -147,7 +147,7 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force remote backup state update to update the banner if needed
|
// Force remote backup state update to update the banner if needed
|
||||||
ViewModelProviders.of(this).get(SignOutViewModel::class.java).refreshRemoteStateIfNeeded()
|
ViewModelProviders.of(this, viewModelFactory).get(SignOutViewModel::class.java).refreshRemoteStateIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun configure(toolbar: Toolbar) {
|
override fun configure(toolbar: Toolbar) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ class HomeDetailFragment @Inject constructor(
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
|
|
||||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(HomeSharedActionViewModel::class.java)
|
sharedActionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(HomeSharedActionViewModel::class.java)
|
||||||
|
|
||||||
setupBottomNavigationView()
|
setupBottomNavigationView()
|
||||||
setupToolbar()
|
setupToolbar()
|
||||||
|
|
|
@ -17,5 +17,6 @@
|
||||||
package im.vector.riotx.features.home
|
package im.vector.riotx.features.home
|
||||||
|
|
||||||
import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
class HomeSharedActionViewModel : VectorSharedActionViewModel<HomeActivitySharedAction>()
|
class HomeSharedActionViewModel @Inject constructor() : VectorSharedActionViewModel<HomeActivitySharedAction>()
|
||||||
|
|
|
@ -17,5 +17,6 @@
|
||||||
package im.vector.riotx.features.home.createdirect
|
package im.vector.riotx.features.home.createdirect
|
||||||
|
|
||||||
import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
class CreateDirectRoomSharedActionViewModel : VectorSharedActionViewModel<CreateDirectRoomSharedAction>()
|
class CreateDirectRoomSharedActionViewModel @Inject constructor() : VectorSharedActionViewModel<CreateDirectRoomSharedAction>()
|
||||||
|
|
|
@ -43,7 +43,7 @@ class GroupListFragment @Inject constructor(
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(HomeSharedActionViewModel::class.java)
|
sharedActionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(HomeSharedActionViewModel::class.java)
|
||||||
groupController.callback = this
|
groupController.callback = this
|
||||||
stateView.contentView = groupListEpoxyRecyclerView
|
stateView.contentView = groupListEpoxyRecyclerView
|
||||||
groupListEpoxyRecyclerView.setController(groupController)
|
groupListEpoxyRecyclerView.setController(groupController)
|
||||||
|
|
|
@ -206,7 +206,7 @@ class RoomDetailFragment @Inject constructor(
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(MessageSharedActionViewModel::class.java)
|
sharedActionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(MessageSharedActionViewModel::class.java)
|
||||||
attachmentsHelper = AttachmentsHelper.create(this, this).register()
|
attachmentsHelper = AttachmentsHelper.create(this, this).register()
|
||||||
keyboardStateUtils = KeyboardStateUtils(requireActivity())
|
keyboardStateUtils = KeyboardStateUtils(requireActivity())
|
||||||
setupToolbar(roomToolbar)
|
setupToolbar(roomToolbar)
|
||||||
|
|
|
@ -61,7 +61,7 @@ class MessageActionsBottomSheet : VectorBaseBottomSheetDialogFragment(), Message
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(MessageSharedActionViewModel::class.java)
|
sharedActionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(MessageSharedActionViewModel::class.java)
|
||||||
recyclerView.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
|
recyclerView.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
|
||||||
recyclerView.adapter = messageActionsEpoxyController.adapter
|
recyclerView.adapter = messageActionsEpoxyController.adapter
|
||||||
// Disable item animation
|
// Disable item animation
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
package im.vector.riotx.features.home.room.detail.timeline.action
|
package im.vector.riotx.features.home.room.detail.timeline.action
|
||||||
|
|
||||||
import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity shared view model to handle message actions
|
* Activity shared view model to handle message actions
|
||||||
*/
|
*/
|
||||||
class MessageSharedActionViewModel : VectorSharedActionViewModel<EventSharedAction>()
|
class MessageSharedActionViewModel @Inject constructor() : VectorSharedActionViewModel<EventSharedAction>()
|
||||||
|
|
|
@ -100,7 +100,7 @@ class RoomListFragment @Inject constructor(
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(RoomListQuickActionsSharedActionViewModel::class.java)
|
sharedActionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(RoomListQuickActionsSharedActionViewModel::class.java)
|
||||||
setupCreateRoomButton()
|
setupCreateRoomButton()
|
||||||
setupRecyclerView()
|
setupRecyclerView()
|
||||||
roomListViewModel.subscribe { renderState(it) }
|
roomListViewModel.subscribe { renderState(it) }
|
||||||
|
|
|
@ -69,7 +69,7 @@ class RoomListQuickActionsBottomSheet : VectorBaseBottomSheetDialogFragment(), R
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(RoomListQuickActionsSharedActionViewModel::class.java)
|
sharedActionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(RoomListQuickActionsSharedActionViewModel::class.java)
|
||||||
recyclerView.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
|
recyclerView.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
|
||||||
recyclerView.adapter = roomListActionsEpoxyController.adapter
|
recyclerView.adapter = roomListActionsEpoxyController.adapter
|
||||||
// Disable item animation
|
// Disable item animation
|
||||||
|
|
|
@ -17,8 +17,9 @@
|
||||||
package im.vector.riotx.features.home.room.list.actions
|
package im.vector.riotx.features.home.room.list.actions
|
||||||
|
|
||||||
import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity shared view model to handle room list quick actions
|
* Activity shared view model to handle room list quick actions
|
||||||
*/
|
*/
|
||||||
class RoomListQuickActionsSharedActionViewModel : VectorSharedActionViewModel<RoomListQuickActionsSharedAction>()
|
class RoomListQuickActionsSharedActionViewModel @Inject constructor() : VectorSharedActionViewModel<RoomListQuickActionsSharedAction>()
|
||||||
|
|
|
@ -30,9 +30,7 @@ class EmojiChooserFragment @Inject constructor() : VectorBaseFragment() {
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
viewModel = activity?.run {
|
viewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(EmojiChooserViewModel::class.java)
|
||||||
ViewModelProviders.of(this, viewModelFactory).get(EmojiChooserViewModel::class.java)
|
|
||||||
} ?: throw Exception("Invalid Activity")
|
|
||||||
viewModel.initWithContext(context!!)
|
viewModel.initWithContext(context!!)
|
||||||
(view as? RecyclerView)?.let {
|
(view as? RecyclerView)?.let {
|
||||||
it.adapter = viewModel.adapter
|
it.adapter = viewModel.adapter
|
||||||
|
|
|
@ -93,7 +93,7 @@ class PublicRoomsFragment @Inject constructor(
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(RoomDirectorySharedActionViewModel::class.java)
|
sharedActionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(RoomDirectorySharedActionViewModel::class.java)
|
||||||
setupRecyclerView()
|
setupRecyclerView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,5 +17,6 @@
|
||||||
package im.vector.riotx.features.roomdirectory
|
package im.vector.riotx.features.roomdirectory
|
||||||
|
|
||||||
import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
import im.vector.riotx.core.platform.VectorSharedActionViewModel
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
class RoomDirectorySharedActionViewModel : VectorSharedActionViewModel<RoomDirectorySharedAction>()
|
class RoomDirectorySharedActionViewModel @Inject constructor() : VectorSharedActionViewModel<RoomDirectorySharedAction>()
|
||||||
|
|
|
@ -43,7 +43,7 @@ class CreateRoomFragment @Inject constructor(private val createRoomController: C
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
vectorBaseActivity.setSupportActionBar(createRoomToolbar)
|
vectorBaseActivity.setSupportActionBar(createRoomToolbar)
|
||||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(RoomDirectorySharedActionViewModel::class.java)
|
sharedActionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(RoomDirectorySharedActionViewModel::class.java)
|
||||||
setupRecyclerView()
|
setupRecyclerView()
|
||||||
createRoomClose.setOnClickListener {
|
createRoomClose.setOnClickListener {
|
||||||
sharedActionViewModel.post(RoomDirectorySharedAction.Back)
|
sharedActionViewModel.post(RoomDirectorySharedAction.Back)
|
||||||
|
|
|
@ -72,7 +72,7 @@ class RoomDirectoryPickerFragment @Inject constructor(val roomDirectoryPickerVie
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
sharedActionViewModel = ViewModelProviders.of(requireActivity()).get(RoomDirectorySharedActionViewModel::class.java)
|
sharedActionViewModel = ViewModelProviders.of(requireActivity(), viewModelFactory).get(RoomDirectorySharedActionViewModel::class.java)
|
||||||
setupRecyclerView()
|
setupRecyclerView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue