diff --git a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/dialogfragment/M1ContainFragment.kt b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/dialogfragment/M1ContainFragment.kt index 58a05976a0..04e4d23ed1 100644 --- a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/dialogfragment/M1ContainFragment.kt +++ b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/dialogfragment/M1ContainFragment.kt @@ -34,6 +34,11 @@ class M1ContainFragment : var fragmentTag: String = M1VideoFragment.TAG var fragment: Fragment? = null + var videoFragment:M1VideoFragment? = null + var softFragment:M1SoftFragment? = null + var orderInfoFragment:OrderInfoFragment? = null + var orderLineFragment:M1OrderLineFragment? = null + override fun onCreate(savedInstanceState: Bundle?) { CallerLogger.d(M_BUS_P+ TAG, "onCreate") super.onCreate(savedInstanceState) @@ -50,29 +55,45 @@ class M1ContainFragment : CallerLogger.d(M_BUS_P+ TAG, "setCheckView") when (tab) { VIDEOTAB -> { - fragment = childFragmentManager.findFragmentByTag(M1VideoFragment.TAG) + fragment =videoFragment + ?: childFragmentManager.findFragmentByTag(M1VideoFragment.TAG) ?: M1VideoFragment.newInstance() + if(videoFragment==null&&fragment is M1VideoFragment){ + videoFragment = fragment as M1VideoFragment + } bb_bottom_bar.setCheckIndex(BottomBar.SelectView.VIDEO) cl_container.setBackgroundResource(R.drawable.m1_function_bg) fragmentTag = M1VideoFragment.TAG } SETTINGSOFTTAB -> { - fragment = childFragmentManager.findFragmentByTag(M1SoftFragment.TAG) + fragment =softFragment + ?: childFragmentManager.findFragmentByTag(M1SoftFragment.TAG) ?: M1SoftFragment.newInstance() + if(softFragment==null&&fragment is M1SoftFragment){ + softFragment = fragment as M1SoftFragment + } bb_bottom_bar.setCheckIndex(BottomBar.SelectView.SETTING) cl_container.setBackgroundResource(R.drawable.m1_function_bg) fragmentTag = M1SoftFragment.TAG } ORDERINFO -> { - fragment = childFragmentManager.findFragmentByTag(OrderInfoFragment.TAG) + fragment =orderInfoFragment + ?: childFragmentManager.findFragmentByTag(OrderInfoFragment.TAG) ?: OrderInfoFragment.newInstance() + if(orderInfoFragment==null&&fragment is OrderInfoFragment){ + orderInfoFragment = fragment as OrderInfoFragment + } bb_bottom_bar.setCheckIndex(BottomBar.SelectView.ORDERINFO) cl_container.background = null fragmentTag = OrderInfoFragment.TAG } SELECTLINE ->{ - fragment = childFragmentManager.findFragmentByTag(M1OrderLineFragment.TAG) + fragment =orderLineFragment + ?: childFragmentManager.findFragmentByTag(M1OrderLineFragment.TAG) ?: M1OrderLineFragment.newInstance() + if(orderLineFragment==null&&fragment is M1OrderLineFragment){ + orderLineFragment = fragment as M1OrderLineFragment + } bb_bottom_bar.setCheckIndex(BottomBar.SelectView.LINE) cl_container.background = null fragmentTag = M1OrderLineFragment.TAG