diff --git a/CHANGES.md b/CHANGES.md index d8556e16bc..118917fb93 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ Bugfix 🐛: - Speakerphone is not used for ringback tone (#1644, #1645) - Back camera preview is not mirrored anymore (#1776) - Various report of people that cannot play video (#2107) + - Fix stuck on loader when launching home Translations 🗣: - diff --git a/vector/src/main/java/im/vector/app/core/extensions/Activity.kt b/vector/src/main/java/im/vector/app/core/extensions/Activity.kt index 02806d81a9..cc67f633eb 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/Activity.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/Activity.kt @@ -22,27 +22,53 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentTransaction import im.vector.app.core.platform.VectorBaseActivity -fun VectorBaseActivity.addFragment(frameId: Int, fragment: Fragment, allowStateLoss: Boolean = false) { +fun VectorBaseActivity.addFragment( + frameId: Int, + fragment: Fragment, + allowStateLoss: Boolean = false +) { supportFragmentManager.commitTransaction(allowStateLoss) { add(frameId, fragment) } } -fun VectorBaseActivity.addFragment(frameId: Int, fragmentClass: Class, params: Parcelable? = null, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseActivity.addFragment( + frameId: Int, + fragmentClass: Class, + params: Parcelable? = null, + tag: String? = null, + allowStateLoss: Boolean = false +) { supportFragmentManager.commitTransaction(allowStateLoss) { add(frameId, fragmentClass, params.toMvRxBundle(), tag) } } -fun VectorBaseActivity.replaceFragment(frameId: Int, fragment: Fragment, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseActivity.replaceFragment( + frameId: Int, + fragment: Fragment, + tag: String? = null, + allowStateLoss: Boolean = false +) { supportFragmentManager.commitTransaction(allowStateLoss) { replace(frameId, fragment, tag) } } -fun VectorBaseActivity.replaceFragment(frameId: Int, fragmentClass: Class, params: Parcelable? = null, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseActivity.replaceFragment( + frameId: Int, + fragmentClass: Class, + params: Parcelable? = null, + tag: String? = null, + allowStateLoss: Boolean = false +) { supportFragmentManager.commitTransaction(allowStateLoss) { replace(frameId, fragmentClass, params.toMvRxBundle(), tag) } } -fun VectorBaseActivity.addFragmentToBackstack(frameId: Int, fragment: Fragment, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseActivity.addFragmentToBackstack( + frameId: Int, + fragment: Fragment, + tag: String? = null, + allowStateLoss: Boolean = false +) { supportFragmentManager.commitTransaction(allowStateLoss) { replace(frameId, fragment).addToBackStack(tag) } } diff --git a/vector/src/main/java/im/vector/app/core/extensions/Fragment.kt b/vector/src/main/java/im/vector/app/core/extensions/Fragment.kt index b3e34ab6a9..fbcd6900c1 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/Fragment.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/Fragment.kt @@ -26,61 +26,125 @@ import java.text.SimpleDateFormat import java.util.Date import java.util.Locale -fun VectorBaseFragment.addFragment(frameId: Int, fragment: Fragment, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.addFragment( + frameId: Int, + fragment: Fragment, + allowStateLoss: Boolean = false +) { parentFragmentManager.commitTransaction(allowStateLoss) { add(frameId, fragment) } } -fun VectorBaseFragment.addFragment(frameId: Int, fragmentClass: Class, params: Parcelable? = null, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.addFragment( + frameId: Int, + fragmentClass: Class, + params: Parcelable? = null, + tag: String? = null, + allowStateLoss: Boolean = false +) { parentFragmentManager.commitTransaction(allowStateLoss) { add(frameId, fragmentClass, params.toMvRxBundle(), tag) } } -fun VectorBaseFragment.replaceFragment(frameId: Int, fragment: Fragment, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.replaceFragment( + frameId: Int, + fragment: Fragment, + allowStateLoss: Boolean = false +) { parentFragmentManager.commitTransaction(allowStateLoss) { replace(frameId, fragment) } } -fun VectorBaseFragment.replaceFragment(frameId: Int, fragmentClass: Class, params: Parcelable? = null, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.replaceFragment( + frameId: Int, + fragmentClass: Class, + params: Parcelable? = null, + tag: String? = null, + allowStateLoss: Boolean = false +) { parentFragmentManager.commitTransaction(allowStateLoss) { replace(frameId, fragmentClass, params.toMvRxBundle(), tag) } } -fun VectorBaseFragment.addFragmentToBackstack(frameId: Int, fragment: Fragment, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.addFragmentToBackstack( + frameId: Int, + fragment: Fragment, + tag: String? = null, + allowStateLoss: Boolean = false +) { parentFragmentManager.commitTransaction(allowStateLoss) { replace(frameId, fragment, tag).addToBackStack(tag) } } -fun VectorBaseFragment.addFragmentToBackstack(frameId: Int, fragmentClass: Class, params: Parcelable? = null, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.addFragmentToBackstack( + frameId: Int, + fragmentClass: Class, + params: Parcelable? = null, + tag: String? = null, + allowStateLoss: Boolean = false +) { parentFragmentManager.commitTransaction(allowStateLoss) { replace(frameId, fragmentClass, params.toMvRxBundle(), tag).addToBackStack(tag) } } -fun VectorBaseFragment.addChildFragment(frameId: Int, fragment: Fragment, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.addChildFragment( + frameId: Int, + fragment: Fragment, + tag: String? = null, + allowStateLoss: Boolean = false +) { childFragmentManager.commitTransaction(allowStateLoss) { add(frameId, fragment, tag) } } -fun VectorBaseFragment.addChildFragment(frameId: Int, fragmentClass: Class, params: Parcelable? = null, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.addChildFragment( + frameId: Int, + fragmentClass: Class, + params: Parcelable? = null, + tag: String? = null, + allowStateLoss: Boolean = false +) { childFragmentManager.commitTransaction(allowStateLoss) { add(frameId, fragmentClass, params.toMvRxBundle(), tag) } } -fun VectorBaseFragment.replaceChildFragment(frameId: Int, fragment: Fragment, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.replaceChildFragment( + frameId: Int, + fragment: Fragment, + tag: String? = null, + allowStateLoss: Boolean = false +) { childFragmentManager.commitTransaction(allowStateLoss) { replace(frameId, fragment, tag) } } -fun VectorBaseFragment.replaceChildFragment(frameId: Int, fragmentClass: Class, params: Parcelable? = null, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.replaceChildFragment( + frameId: Int, + fragmentClass: Class, + params: Parcelable? = null, + tag: String? = null, + allowStateLoss: Boolean = false +) { childFragmentManager.commitTransaction(allowStateLoss) { replace(frameId, fragmentClass, params.toMvRxBundle(), tag) } } -fun VectorBaseFragment.addChildFragmentToBackstack(frameId: Int, fragment: Fragment, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.addChildFragmentToBackstack( + frameId: Int, + fragment: Fragment, + tag: String? = null, + allowStateLoss: Boolean = false +) { childFragmentManager.commitTransaction(allowStateLoss) { replace(frameId, fragment).addToBackStack(tag) } } -fun VectorBaseFragment.addChildFragmentToBackstack(frameId: Int, fragmentClass: Class, params: Parcelable? = null, tag: String? = null, allowStateLoss: Boolean = false) { +fun VectorBaseFragment.addChildFragmentToBackstack( + frameId: Int, + fragmentClass: Class, + params: Parcelable? = null, + tag: String? = null, + allowStateLoss: Boolean = false +) { childFragmentManager.commitTransaction(allowStateLoss) { replace(frameId, fragmentClass, params.toMvRxBundle(), tag).addToBackStack(tag) }