diff --git a/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt b/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt index d0ccefeb5..3a397aa72 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt @@ -47,8 +47,6 @@ import javax.inject.Inject @AutoInjector(NextcloudTalkApplication::class) class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener { - lateinit var roomToken: String - @Inject lateinit var viewModelFactory: ViewModelProvider.Factory @@ -62,8 +60,8 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this) viewModel = ViewModelProvider(this, viewModelFactory)[PollCreateViewModel::class.java] - - roomToken = arguments?.getString(KEY_ROOM_TOKEN)!! + val roomToken = arguments?.getString(KEY_ROOM_TOKEN)!! + viewModel.initialize(roomToken) } @SuppressLint("InflateParams") @@ -89,8 +87,6 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener adapter = PollCreateOptionsAdapter(this) binding.pollCreateOptionsList.adapter = adapter - viewModel.initialize(roomToken) - setupListeners() setupStateObserver() }