diff --git a/vector/src/main/java/im/vector/app/core/extensions/BasicExtensions.kt b/vector/src/main/java/im/vector/app/core/extensions/BasicExtensions.kt index dbe90dfdc1..f8b8b83178 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/BasicExtensions.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/BasicExtensions.kt @@ -16,9 +16,7 @@ package im.vector.app.core.extensions -import android.os.Bundle import android.util.Patterns -import androidx.fragment.app.Fragment import com.google.i18n.phonenumbers.NumberParseException import com.google.i18n.phonenumbers.PhoneNumberUtil import org.matrix.android.sdk.api.extensions.ensurePrefix @@ -27,11 +25,6 @@ fun Boolean.toOnOff() = if (this) "ON" else "OFF" inline fun T.ooi(block: (T) -> Unit): T = also(block) -/** - * Apply argument to a Fragment - */ -fun T.withArgs(block: Bundle.() -> Unit) = apply { arguments = Bundle().apply(block) } - /** * Check if a CharSequence is an email */ 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/core/platform/VectorBaseBottomSheetDialogFragment.kt b/vector/src/main/java/im/vector/app/core/platform/VectorBaseBottomSheetDialogFragment.kt index 20697c6d11..95feb45ad6 100644 --- a/vector/src/main/java/im/vector/app/core/platform/VectorBaseBottomSheetDialogFragment.kt +++ b/vector/src/main/java/im/vector/app/core/platform/VectorBaseBottomSheetDialogFragment.kt @@ -28,13 +28,13 @@ import androidx.annotation.CallSuper import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import androidx.viewbinding.ViewBinding -import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.MavericksView import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialogFragment import dagger.hilt.android.EntryPointAccessors import im.vector.app.core.di.ActivityEntryPoint +import im.vector.app.core.extensions.toMvRxBundle import im.vector.app.core.flow.throttleFirst import im.vector.app.core.utils.DimensionConverter import kotlinx.coroutines.flow.launchIn @@ -159,7 +159,7 @@ abstract class VectorBaseBottomSheetDialogFragment : BottomShe } protected fun setArguments(args: Parcelable? = null) { - arguments = args?.let { Bundle().apply { putParcelable(Mavericks.KEY_ARG, it) } } + arguments = args.toMvRxBundle() } /* ========================================================================================== diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt index 50f9526da5..727180385d 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt @@ -38,6 +38,7 @@ import im.vector.app.R import im.vector.app.core.extensions.commitTransaction import im.vector.app.core.extensions.exhaustive import im.vector.app.core.extensions.registerStartForActivityResult +import im.vector.app.core.extensions.toMvRxBundle import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment import im.vector.app.databinding.BottomSheetBootstrapBinding import im.vector.app.features.auth.ReAuthActivity @@ -154,48 +155,48 @@ class BootstrapBottomSheet : VectorBaseBottomSheetDialogFragment { views.bootstrapIcon.isVisible = false views.bootstrapTitleText.text = getString(R.string.bottom_sheet_setup_secure_backup_title) - showFragment(BootstrapWaitingFragment::class, Bundle()) + showFragment(BootstrapWaitingFragment::class) } is BootstrapStep.FirstForm -> { views.bootstrapIcon.isVisible = false views.bootstrapTitleText.text = getString(R.string.bottom_sheet_setup_secure_backup_title) - showFragment(BootstrapSetupRecoveryKeyFragment::class, Bundle()) + showFragment(BootstrapSetupRecoveryKeyFragment::class) } is BootstrapStep.SetupPassphrase -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_security_phrase_24dp)) views.bootstrapTitleText.text = getString(R.string.set_a_security_phrase_title) - showFragment(BootstrapEnterPassphraseFragment::class, Bundle()) + showFragment(BootstrapEnterPassphraseFragment::class) } is BootstrapStep.ConfirmPassphrase -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_security_phrase_24dp)) views.bootstrapTitleText.text = getString(R.string.set_a_security_phrase_title) - showFragment(BootstrapConfirmPassphraseFragment::class, Bundle()) + showFragment(BootstrapConfirmPassphraseFragment::class) } is BootstrapStep.AccountReAuth -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_user)) views.bootstrapTitleText.text = getString(R.string.re_authentication_activity_title) - showFragment(BootstrapReAuthFragment::class, Bundle()) + showFragment(BootstrapReAuthFragment::class) } is BootstrapStep.Initializing -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_security_key_24dp)) views.bootstrapTitleText.text = getString(R.string.bootstrap_loading_title) - showFragment(BootstrapWaitingFragment::class, Bundle()) + showFragment(BootstrapWaitingFragment::class) } is BootstrapStep.SaveRecoveryKey -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_security_key_24dp)) views.bootstrapTitleText.text = getString(R.string.bottom_sheet_save_your_recovery_key_title) - showFragment(BootstrapSaveRecoveryKeyFragment::class, Bundle()) + showFragment(BootstrapSaveRecoveryKeyFragment::class) } is BootstrapStep.DoneSuccess -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_security_key_24dp)) views.bootstrapTitleText.text = getString(R.string.bootstrap_finish_title) - showFragment(BootstrapConclusionFragment::class, Bundle()) + showFragment(BootstrapConclusionFragment::class) } is BootstrapStep.GetBackupSecretForMigration -> { val isKey = state.step.useKey() @@ -206,7 +207,7 @@ class BootstrapBottomSheet : VectorBaseBottomSheetDialogFragment, bundle: Bundle) { + private fun showFragment(fragmentClass: KClass, argsParcelable: Parcelable? = null) { if (childFragmentManager.findFragmentByTag(fragmentClass.simpleName) == null) { childFragmentManager.commitTransaction { replace(R.id.bottomSheetFragmentContainer, fragmentClass.java, - bundle, + argsParcelable?.toMvRxBundle(), fragmentClass.simpleName ) } 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 4ef0109227..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 @@ -24,7 +24,6 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment -import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState import com.google.android.material.dialog.MaterialAlertDialogBuilder @@ -33,6 +32,7 @@ import im.vector.app.R import im.vector.app.core.extensions.commitTransaction import im.vector.app.core.extensions.exhaustive import im.vector.app.core.extensions.registerStartForActivityResult +import im.vector.app.core.extensions.toMvRxBundle import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment import im.vector.app.databinding.BottomSheetVerificationBinding @@ -178,36 +178,37 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment { - showFragment(VerificationEmojiCodeFragment::class, Bundle().apply { - putParcelable(Mavericks.KEY_ARG, VerificationArgs( - state.otherUserMxItem?.id ?: "", - // If it was outgoing it.transaction id would be null, but the pending request - // would be updated (from localId to txId) - state.pendingRequest.invoke()?.transactionId ?: state.transactionId)) - }) + showFragment( + VerificationEmojiCodeFragment::class, + VerificationArgs( + state.otherUserMxItem?.id ?: "", + // If it was outgoing it.transaction id would be null, but the pending request + // would be updated (from localId to txId) + state.pendingRequest.invoke()?.transactionId ?: state.transactionId + ) + ) } is VerificationTxState.Verified -> { - showFragment(VerificationConclusionFragment::class, Bundle().apply { - putParcelable(Mavericks.KEY_ARG, VerificationConclusionFragment.Args(true, null, state.isMe)) - }) + showFragment( + VerificationConclusionFragment::class, + VerificationConclusionFragment.Args(true, null, state.isMe) + ) } is VerificationTxState.Cancelled -> { - showFragment(VerificationConclusionFragment::class, Bundle().apply { - putParcelable(Mavericks.KEY_ARG, VerificationConclusionFragment.Args(false, state.sasTransactionState.cancelCode.value, state.isMe)) - }) + showFragment( + VerificationConclusionFragment::class, + VerificationConclusionFragment.Args(false, state.sasTransactionState.cancelCode.value, state.isMe) + ) } } @@ -254,29 +259,32 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment { - showFragment(VerificationQrScannedByOtherFragment::class, Bundle()) + showFragment(VerificationQrScannedByOtherFragment::class) return@withState } is VerificationTxState.Started, is VerificationTxState.WaitingOtherReciprocateConfirm -> { - showFragment(VerificationQRWaitingFragment::class, Bundle().apply { - putParcelable(Mavericks.KEY_ARG, VerificationQRWaitingFragment.Args( - isMe = state.isMe, - otherUserName = state.otherUserMxItem?.getBestName() ?: "" - )) - }) + showFragment( + VerificationQRWaitingFragment::class, + VerificationQRWaitingFragment.Args( + isMe = state.isMe, + otherUserName = state.otherUserMxItem?.getBestName() ?: "" + ) + ) return@withState } is VerificationTxState.Verified -> { - showFragment(VerificationConclusionFragment::class, Bundle().apply { - putParcelable(Mavericks.KEY_ARG, VerificationConclusionFragment.Args(true, null, state.isMe)) - }) + showFragment( + VerificationConclusionFragment::class, + VerificationConclusionFragment.Args(true, null, state.isMe) + ) return@withState } is VerificationTxState.Cancelled -> { - showFragment(VerificationConclusionFragment::class, Bundle().apply { - putParcelable(Mavericks.KEY_ARG, VerificationConclusionFragment.Args(false, state.qrTransactionState.cancelCode.value, state.isMe)) - }) + showFragment( + VerificationConclusionFragment::class, + VerificationConclusionFragment.Args(false, state.qrTransactionState.cancelCode.value, state.isMe) + ) return@withState } else -> Unit @@ -288,12 +296,14 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment, bundle: Bundle) { + private fun showFragment(fragmentClass: KClass, argsParcelable: Parcelable? = null) { if (childFragmentManager.findFragmentByTag(fragmentClass.simpleName) == null) { childFragmentManager.commitTransaction { replace(R.id.bottomSheetFragmentContainer, fragmentClass.java, - bundle, + argsParcelable?.toMvRxBundle(), fragmentClass.simpleName ) } @@ -342,37 +360,31 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment { - 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/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt index 3fcdefaf56..bb69bd5339 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt @@ -62,7 +62,6 @@ import com.airbnb.epoxy.EpoxyModel import com.airbnb.epoxy.OnModelBuildFinishedListener import com.airbnb.epoxy.addGlidePreloader import com.airbnb.epoxy.glidePreloader -import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.args import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState @@ -1635,10 +1634,11 @@ class RoomDetailFragment @Inject constructor( is RoomDetailAction.ResumeVerification -> { val otherUserId = data.otherUserId ?: return VerificationBottomSheet().apply { - arguments = Bundle().apply { - putParcelable(Mavericks.KEY_ARG, VerificationBottomSheet.VerificationArgs( - otherUserId, data.transactionId, roomId = roomDetailArgs.roomId)) - } + setArguments(VerificationBottomSheet.VerificationArgs( + otherUserId = otherUserId, + verificationId = data.transactionId, + roomId = roomDetailArgs.roomId + )) }.show(parentFragmentManager, "REQ") } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/readreceipts/DisplayReadReceiptsBottomSheet.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/readreceipts/DisplayReadReceiptsBottomSheet.kt index 6c315a4e76..db80b02a6b 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/readreceipts/DisplayReadReceiptsBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/readreceipts/DisplayReadReceiptsBottomSheet.kt @@ -21,7 +21,6 @@ import android.os.Parcelable import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.args import dagger.hilt.android.AndroidEntryPoint import im.vector.app.R @@ -81,12 +80,9 @@ class DisplayReadReceiptsBottomSheet : companion object { fun newInstance(readReceipts: List): DisplayReadReceiptsBottomSheet { - val args = Bundle() - val parcelableArgs = DisplayReadReceiptArgs( - readReceipts - ) - args.putParcelable(Mavericks.KEY_ARG, parcelableArgs) - return DisplayReadReceiptsBottomSheet().apply { arguments = args } + return DisplayReadReceiptsBottomSheet().apply { + setArguments(DisplayReadReceiptArgs(readReceipts = readReceipts)) + } } } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryBottomSheet.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryBottomSheet.kt index 63140edd8b..321745355e 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryBottomSheet.kt @@ -19,7 +19,6 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState import dagger.hilt.android.AndroidEntryPoint @@ -68,14 +67,13 @@ class ViewEditHistoryBottomSheet : companion object { fun newInstance(roomId: String, informationData: MessageInformationData): ViewEditHistoryBottomSheet { - val args = Bundle() - val parcelableArgs = TimelineEventFragmentArgs( - informationData.eventId, - roomId, - informationData - ) - args.putParcelable(Mavericks.KEY_ARG, parcelableArgs) - return ViewEditHistoryBottomSheet().apply { arguments = args } + return ViewEditHistoryBottomSheet().apply { + setArguments(TimelineEventFragmentArgs( + eventId = informationData.eventId, + roomId = roomId, + informationData = informationData + )) + } } } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsBottomSheet.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsBottomSheet.kt index 8071ed8809..6ae3cd227f 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsBottomSheet.kt @@ -20,7 +20,6 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState import dagger.hilt.android.AndroidEntryPoint @@ -82,14 +81,13 @@ class ViewReactionsBottomSheet : companion object { fun newInstance(roomId: String, informationData: MessageInformationData): ViewReactionsBottomSheet { - val args = Bundle() - val parcelableArgs = TimelineEventFragmentArgs( - informationData.eventId, - roomId, - informationData - ) - args.putParcelable(Mavericks.KEY_ARG, parcelableArgs) - return ViewReactionsBottomSheet().apply { arguments = args } + return ViewReactionsBottomSheet().apply { + setArguments(TimelineEventFragmentArgs( + eventId = informationData.eventId, + roomId = roomId, + informationData = informationData + )) + } } } } diff --git a/vector/src/main/java/im/vector/app/features/matrixto/MatrixToBottomSheet.kt b/vector/src/main/java/im/vector/app/features/matrixto/MatrixToBottomSheet.kt index 029234a66d..63e0398fc1 100644 --- a/vector/src/main/java/im/vector/app/features/matrixto/MatrixToBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/matrixto/MatrixToBottomSheet.kt @@ -24,7 +24,6 @@ import android.view.ViewGroup import androidx.core.view.isVisible import androidx.fragment.app.Fragment import com.airbnb.mvrx.Incomplete -import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState import com.google.android.material.dialog.MaterialAlertDialogBuilder @@ -66,15 +65,15 @@ class MatrixToBottomSheet : override fun invalidate() = withState(viewModel) { state -> super.invalidate() when (state.linkType) { - is PermalinkData.RoomLink -> { + is PermalinkData.RoomLink -> { views.matrixToCardContentLoading.isVisible = state.roomPeekResult is Incomplete showFragment(MatrixToRoomSpaceFragment::class, Bundle()) } - is PermalinkData.UserLink -> { + is PermalinkData.UserLink -> { views.matrixToCardContentLoading.isVisible = state.matrixItem is Incomplete showFragment(MatrixToUserFragment::class, Bundle()) } - is PermalinkData.GroupLink -> { + is PermalinkData.GroupLink -> { } is PermalinkData.FallbackLink -> { } @@ -98,16 +97,16 @@ class MatrixToBottomSheet : viewModel.observeViewEvents { when (it) { - is MatrixToViewEvents.NavigateToRoom -> { + is MatrixToViewEvents.NavigateToRoom -> { interactionListener?.mxToBottomSheetNavigateToRoom(it.roomId) dismiss() } - MatrixToViewEvents.Dismiss -> dismiss() + MatrixToViewEvents.Dismiss -> dismiss() is MatrixToViewEvents.NavigateToSpace -> { interactionListener?.mxToBottomSheetSwitchToSpace(it.spaceId) dismiss() } - is MatrixToViewEvents.ShowModalError -> { + is MatrixToViewEvents.ShowModalError -> { MaterialAlertDialogBuilder(requireContext()) .setMessage(it.error) .setPositiveButton(getString(R.string.ok), null) @@ -120,11 +119,7 @@ class MatrixToBottomSheet : companion object { fun withLink(matrixToLink: String): MatrixToBottomSheet { return MatrixToBottomSheet().apply { - arguments = Bundle().apply { - putParcelable(Mavericks.KEY_ARG, MatrixToArgs( - matrixToLink = matrixToLink - )) - } + setArguments(MatrixToArgs(matrixToLink = matrixToLink)) } } } diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListBottomSheet.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListBottomSheet.kt index f83ac8f19d..bb2317b59c 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListBottomSheet.kt @@ -24,7 +24,6 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment -import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState import dagger.hilt.android.AndroidEntryPoint @@ -115,9 +114,9 @@ class DeviceListBottomSheet : companion object { fun newInstance(userId: String, allowDeviceAction: Boolean = true): DeviceListBottomSheet { - val args = Bundle() - args.putParcelable(Mavericks.KEY_ARG, Args(userId, allowDeviceAction)) - return DeviceListBottomSheet().apply { arguments = args } + return DeviceListBottomSheet().apply { + setArguments(Args(userId, allowDeviceAction)) + } } } } diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheet.kt b/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheet.kt index 441a344660..e5a67675e6 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheet.kt @@ -21,7 +21,6 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.view.isVisible -import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.parentFragmentViewModel import com.airbnb.mvrx.withState @@ -76,10 +75,9 @@ class DeviceVerificationInfoBottomSheet : companion object { fun newInstance(userId: String, deviceId: String): DeviceVerificationInfoBottomSheet { - val args = Bundle() - val parcelableArgs = DeviceVerificationInfoArgs(userId, deviceId) - args.putParcelable(Mavericks.KEY_ARG, parcelableArgs) - return DeviceVerificationInfoBottomSheet().apply { arguments = args } + return DeviceVerificationInfoBottomSheet().apply { + setArguments(DeviceVerificationInfoArgs(userId, deviceId)) + } } } 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..82a3205681 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 @@ -26,7 +26,6 @@ import com.airbnb.mvrx.withState import com.google.android.material.dialog.MaterialAlertDialogBuilder import dagger.hilt.android.AndroidEntryPoint import im.vector.app.R -import im.vector.app.core.extensions.toMvRxBundle import im.vector.app.core.platform.SimpleFragmentActivity import im.vector.app.features.spaces.create.ChoosePrivateSpaceTypeFragment import im.vector.app.features.spaces.create.ChooseSpaceTypeFragment @@ -121,7 +120,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, diff --git a/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionBottomSheet.kt b/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionBottomSheet.kt index ae3028925a..58cfebba94 100644 --- a/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionBottomSheet.kt @@ -23,12 +23,10 @@ import android.text.style.BulletSpan import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.activityViewModel import com.airbnb.mvrx.withState import dagger.hilt.android.AndroidEntryPoint import im.vector.app.R -import im.vector.app.core.extensions.withArgs import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment import im.vector.app.databinding.BottomSheetRoomWidgetPermissionBinding import im.vector.app.features.home.AvatarRenderer @@ -111,8 +109,10 @@ class RoomWidgetPermissionBottomSheet : companion object { - fun newInstance(widgetArgs: WidgetArgs) = RoomWidgetPermissionBottomSheet().withArgs { - putParcelable(Mavericks.KEY_ARG, widgetArgs) + fun newInstance(widgetArgs: WidgetArgs): RoomWidgetPermissionBottomSheet { + return RoomWidgetPermissionBottomSheet().apply { + setArguments(widgetArgs) + } } } } diff --git a/vector/src/main/res/layout/fragment_bootstrap_enter_account_password.xml b/vector/src/main/res/layout/fragment_bootstrap_enter_account_password.xml index aed72d3183..9b8d6918f4 100644 --- a/vector/src/main/res/layout/fragment_bootstrap_enter_account_password.xml +++ b/vector/src/main/res/layout/fragment_bootstrap_enter_account_password.xml @@ -35,6 +35,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:imeOptions="actionDone" + android:inputType="textPassword" android:maxLines="3" android:singleLine="false" tools:hint="@string/passphrase_enter_passphrase" /> diff --git a/vector/src/main/res/layout/fragment_bootstrap_enter_passphrase.xml b/vector/src/main/res/layout/fragment_bootstrap_enter_passphrase.xml index 942a1a7e00..78782b0b45 100644 --- a/vector/src/main/res/layout/fragment_bootstrap_enter_passphrase.xml +++ b/vector/src/main/res/layout/fragment_bootstrap_enter_passphrase.xml @@ -33,6 +33,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:imeOptions="actionDone" + android:inputType="textPassword" android:maxLines="3" android:singleLine="false" tools:hint="@string/passphrase_enter_passphrase" /> diff --git a/vector/src/main/res/layout/fragment_bootstrap_migrate_backup.xml b/vector/src/main/res/layout/fragment_bootstrap_migrate_backup.xml index 1e6b1b6ddb..04f547d500 100644 --- a/vector/src/main/res/layout/fragment_bootstrap_migrate_backup.xml +++ b/vector/src/main/res/layout/fragment_bootstrap_migrate_backup.xml @@ -35,6 +35,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:imeOptions="actionDone" + android:inputType="textPassword" android:maxLines="3" android:singleLine="false" tools:hint="@string/keys_backup_restore_key_enter_hint" /> diff --git a/vector/src/main/res/layout/fragment_keys_backup_restore_from_passphrase.xml b/vector/src/main/res/layout/fragment_keys_backup_restore_from_passphrase.xml index f3061186ef..8360cb3a4f 100644 --- a/vector/src/main/res/layout/fragment_keys_backup_restore_from_passphrase.xml +++ b/vector/src/main/res/layout/fragment_keys_backup_restore_from_passphrase.xml @@ -56,6 +56,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/passphrase_enter_passphrase" + android:inputType="textPassword" android:maxLines="3" android:singleLine="false" /> diff --git a/vector/src/main/res/layout/fragment_keys_backup_setup_step2.xml b/vector/src/main/res/layout/fragment_keys_backup_setup_step2.xml index f0fa64426a..673c2fee29 100644 --- a/vector/src/main/res/layout/fragment_keys_backup_setup_step2.xml +++ b/vector/src/main/res/layout/fragment_keys_backup_setup_step2.xml @@ -58,6 +58,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/passphrase_create_passphrase" + android:inputType="textPassword" android:maxLines="3" /> @@ -86,6 +87,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/passphrase_confirm_passphrase" + android:inputType="textPassword" android:maxLines="3" /> diff --git a/vector/src/main/res/layout/fragment_ssss_access_from_passphrase.xml b/vector/src/main/res/layout/fragment_ssss_access_from_passphrase.xml index 37aa44af2e..cf7a5f695f 100644 --- a/vector/src/main/res/layout/fragment_ssss_access_from_passphrase.xml +++ b/vector/src/main/res/layout/fragment_ssss_access_from_passphrase.xml @@ -70,9 +70,9 @@ android:layout_height="wrap_content" android:hint="@string/passphrase_enter_passphrase" android:imeOptions="actionDone" + android:inputType="textPassword" android:maxLines="3" - android:singleLine="false" - tools:inputType="textPassword" /> + android:singleLine="false" />