Cleanup API
This commit is contained in:
parent
0f42f379c6
commit
23f726a2f0
|
@ -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<VB : ViewBinding> : AppCompatActivity(), Maver
|
|||
bugReporter.inMultiWindowMode = isInMultiWindowMode
|
||||
}
|
||||
|
||||
protected fun createFragment(fragmentClass: Class<out Fragment>, args: Bundle?): Fragment {
|
||||
protected fun createFragment(fragmentClass: Class<out Fragment>, argsParcelable: Parcelable? = null): Fragment {
|
||||
return fragmentFactory.instantiate(classLoader, fragmentClass.name).apply {
|
||||
arguments = args
|
||||
arguments = argsParcelable?.toMvRxBundle()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -345,12 +345,12 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
|
|||
super.invalidate()
|
||||
}
|
||||
|
||||
private fun showFragment(fragmentClass: KClass<out Fragment>, parcelable: Parcelable? = null) {
|
||||
private fun showFragment(fragmentClass: KClass<out Fragment>, argsParcelable: Parcelable? = null) {
|
||||
if (childFragmentManager.findFragmentByTag(fragmentClass.simpleName) == null) {
|
||||
childFragmentManager.commitTransaction {
|
||||
replace(R.id.bottomSheetFragmentContainer,
|
||||
fragmentClass.java,
|
||||
parcelable?.toMvRxBundle(),
|
||||
argsParcelable?.toMvRxBundle(),
|
||||
fragmentClass.simpleName
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class SpaceCreationActivity : SimpleFragmentActivity() {
|
|||
}
|
||||
|
||||
private fun navigateToFragment(fragmentClass: Class<out Fragment>) {
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue