diff --git a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt index 0fd660effb..a56c2f0432 100644 --- a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt +++ b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt @@ -22,6 +22,7 @@ import android.content.Context import android.content.res.Configuration import android.os.Build import android.os.Bundle +import android.os.Parcelable import android.view.Menu import android.view.MenuItem import android.view.View @@ -60,6 +61,7 @@ import im.vector.app.core.extensions.registerStartForActivityResult import im.vector.app.core.extensions.restart import im.vector.app.core.extensions.setTextOrHide import im.vector.app.core.extensions.singletonEntryPoint +import im.vector.app.core.extensions.toMvRxBundle import im.vector.app.core.flow.throttleFirst import im.vector.app.core.utils.toast import im.vector.app.features.MainActivity @@ -385,9 +387,9 @@ abstract class VectorBaseActivity : AppCompatActivity(), Maver bugReporter.inMultiWindowMode = isInMultiWindowMode } - protected fun createFragment(fragmentClass: Class, args: Bundle?): Fragment { + protected fun createFragment(fragmentClass: Class, argsParcelable: Parcelable? = null): Fragment { return fragmentFactory.instantiate(classLoader, fragmentClass.name).apply { - arguments = args + arguments = argsParcelable?.toMvRxBundle() } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt index e90ec99680..65e3fbabba 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt @@ -345,12 +345,12 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment, parcelable: Parcelable? = null) { + private fun showFragment(fragmentClass: KClass, argsParcelable: Parcelable? = null) { if (childFragmentManager.findFragmentByTag(fragmentClass.simpleName) == null) { childFragmentManager.commitTransaction { replace(R.id.bottomSheetFragmentContainer, fragmentClass.java, - parcelable?.toMvRxBundle(), + argsParcelable?.toMvRxBundle(), fragmentClass.simpleName ) } diff --git a/vector/src/main/java/im/vector/app/features/devtools/RoomDevToolActivity.kt b/vector/src/main/java/im/vector/app/features/devtools/RoomDevToolActivity.kt index 2c7a15e6ad..9e0ccf1e79 100644 --- a/vector/src/main/java/im/vector/app/features/devtools/RoomDevToolActivity.kt +++ b/vector/src/main/java/im/vector/app/features/devtools/RoomDevToolActivity.kt @@ -109,15 +109,15 @@ class RoomDevToolActivity : SimpleFragmentActivity(), FragmentManager.OnBackStac } RoomDevToolViewState.Mode.StateEventList, RoomDevToolViewState.Mode.StateEventListByType -> { - val frag = createFragment(RoomDevToolStateEventListFragment::class.java, Bundle().toMvRxBundle()) + val frag = createFragment(RoomDevToolStateEventListFragment::class.java) navigateTo(frag) } RoomDevToolViewState.Mode.EditEventContent -> { - val frag = createFragment(RoomDevToolEditFragment::class.java, Bundle().toMvRxBundle()) + val frag = createFragment(RoomDevToolEditFragment::class.java) navigateTo(frag) } is RoomDevToolViewState.Mode.SendEventForm -> { - val frag = createFragment(RoomDevToolSendFormFragment::class.java, Bundle().toMvRxBundle()) + val frag = createFragment(RoomDevToolSendFormFragment::class.java) navigateTo(frag) } } diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceCreationActivity.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceCreationActivity.kt index 44acfa8ee3..59363e28c8 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpaceCreationActivity.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceCreationActivity.kt @@ -121,7 +121,7 @@ class SpaceCreationActivity : SimpleFragmentActivity() { } private fun navigateToFragment(fragmentClass: Class) { - val frag = supportFragmentManager.findFragmentByTag(fragmentClass.name) ?: createFragment(fragmentClass, Bundle().toMvRxBundle()) + val frag = supportFragmentManager.findFragmentByTag(fragmentClass.name) ?: createFragment(fragmentClass) supportFragmentManager.beginTransaction() .setCustomAnimations(R.anim.fade_in, R.anim.fade_out, R.anim.fade_in, R.anim.fade_out) .replace(R.id.container,