[bus/shuttle/charter/taxi] 各端fragment初始化bug
This commit is contained in:
@@ -6,6 +6,7 @@ import android.content.Context;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
@@ -77,14 +78,23 @@ public class MogoOCHBusPassenger implements IMogoOCH {
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
if (mPassengerFragment == null) {
|
||||
FragmentManager supportFragmentManager = mActivity.getSupportFragmentManager();
|
||||
if(mPassengerFragment == null){
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "准备add fragment======");
|
||||
mPassengerFragment = new BusPassengerRouteFragment();
|
||||
mActivity.getSupportFragmentManager().beginTransaction().add(mContainerId, mPassengerFragment).commitAllowingStateLoss();
|
||||
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(BusPassengerRouteFragment.TAG);
|
||||
if (fragmentByTag instanceof BusPassengerRouteFragment){
|
||||
mPassengerFragment = (BusPassengerRouteFragment)fragmentByTag;
|
||||
}else {
|
||||
mPassengerFragment = new BusPassengerRouteFragment();
|
||||
}
|
||||
if (!mPassengerFragment.isAdded()){
|
||||
supportFragmentManager.beginTransaction().add(mContainerId, mPassengerFragment,BusPassengerRouteFragment.TAG).commitAllowingStateLoss();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "准备show fragment");
|
||||
mActivity.getSupportFragmentManager().beginTransaction().show(mPassengerFragment).commitAllowingStateLoss();
|
||||
supportFragmentManager.beginTransaction().show(mPassengerFragment).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
private void hideFragment(){
|
||||
|
||||
@@ -40,7 +40,7 @@ public class BusPassengerRouteFragment extends
|
||||
BusPassengerBaseFragment<BusPassengerRouteFragment, BaseBusPassengerPresenter>
|
||||
implements IBusPassengerMapViewCallback {
|
||||
|
||||
private final String TAG = "BusPassengerRouteFragment";
|
||||
public static final String TAG = "BusPassengerRouteFragment";
|
||||
|
||||
private final List<BusPassengerStation> mStationsList = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.och.bus.passenger
|
||||
import android.content.Context
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
|
||||
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager.stepInDayMode
|
||||
@@ -51,16 +52,26 @@ class MogoOCHBusPassenger : IMogoOCH {
|
||||
}
|
||||
|
||||
private fun showFragment() {
|
||||
val supportFragmentManager: FragmentManager? = mActivity?.supportFragmentManager
|
||||
|
||||
if (mPassengerFragment == null) {
|
||||
d(SceneConstant.M_TAXI_P + TAG, "准备add fragment======")
|
||||
mPassengerFragment = MainFragment()
|
||||
mActivity!!.supportFragmentManager.beginTransaction()
|
||||
.add(mContainerId, mPassengerFragment!!).commitAllowingStateLoss()
|
||||
var fragmentByTag: Fragment? = supportFragmentManager?.findFragmentByTag(MainFragment.TAG)
|
||||
mPassengerFragment = if (fragmentByTag is MainFragment){
|
||||
fragmentByTag
|
||||
}else{
|
||||
MainFragment()
|
||||
}
|
||||
|
||||
if (!mPassengerFragment?.isAdded!!){
|
||||
supportFragmentManager?.beginTransaction()
|
||||
?.add(mContainerId, mPassengerFragment!!, MainFragment.TAG)?.commitAllowingStateLoss()
|
||||
}
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_TAXI_P + TAG, "准备show fragment")
|
||||
mActivity!!.supportFragmentManager.beginTransaction().show(mPassengerFragment!!)
|
||||
.commitAllowingStateLoss()
|
||||
supportFragmentManager?.beginTransaction()?.show(mPassengerFragment!!)
|
||||
?.commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
private fun hideFragment() {
|
||||
|
||||
@@ -255,6 +255,6 @@ class MainFragment :
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "BusPassengerRouteFragment"
|
||||
public const val TAG = "BusPassengerRouteFragment"
|
||||
}
|
||||
}
|
||||
@@ -41,12 +41,13 @@ class CharterProvider: ICharterOCH{
|
||||
} else {
|
||||
DriverM1Fragment()
|
||||
}
|
||||
if (!driverM1Fragment!!.isAdded) {
|
||||
if (!driverM1Fragment?.isAdded!!) {
|
||||
mContainerId?.let {
|
||||
supportFragmentManager?.beginTransaction()
|
||||
?.add(it, driverM1Fragment!!, DriverM1Fragment.TAG)?.commitAllowingStateLoss()
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
d(TAG, "准备show fragment")
|
||||
supportFragmentManager?.beginTransaction()?.show(driverM1Fragment!!)?.commitAllowingStateLoss()
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Context;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
@@ -77,14 +78,24 @@ public class MogoOCHBusPassenger implements IMogoOCH {
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
if (mPassengerFragment == null) {
|
||||
FragmentManager supportFragmentManager = mActivity.getSupportFragmentManager();
|
||||
if(mPassengerFragment == null){
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "准备add fragment======");
|
||||
mPassengerFragment = new BusPassengerRouteFragment();
|
||||
mActivity.getSupportFragmentManager().beginTransaction().add(mContainerId, mPassengerFragment).commitAllowingStateLoss();
|
||||
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(BusPassengerRouteFragment.TAG);
|
||||
if (fragmentByTag instanceof BusPassengerRouteFragment){
|
||||
mPassengerFragment = (BusPassengerRouteFragment)fragmentByTag;
|
||||
}else {
|
||||
mPassengerFragment = new BusPassengerRouteFragment();
|
||||
}
|
||||
if (!mPassengerFragment.isAdded()){
|
||||
supportFragmentManager.beginTransaction().add(mContainerId, mPassengerFragment
|
||||
,BusPassengerRouteFragment.TAG).commitAllowingStateLoss();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "准备show fragment");
|
||||
mActivity.getSupportFragmentManager().beginTransaction().show(mPassengerFragment).commitAllowingStateLoss();
|
||||
supportFragmentManager.beginTransaction().show(mPassengerFragment).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
private void hideFragment(){
|
||||
|
||||
@@ -41,7 +41,7 @@ public class BusPassengerRouteFragment extends
|
||||
BusPassengerBaseFragment<BusPassengerRouteFragment, BaseBusPassengerPresenter>
|
||||
implements IBusPassengerMapViewCallback {
|
||||
|
||||
private final String TAG = "BusPassengerRouteFragment";
|
||||
public static final String TAG = "BusPassengerRouteFragment";
|
||||
|
||||
private final List<BusStationBean> mStationsList = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.och.bus.passenger
|
||||
import android.content.Context
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
@@ -58,14 +59,27 @@ class MogoOCHBusPassenger : IMogoOCH, IMogoStatusChangedListener {
|
||||
}
|
||||
|
||||
private fun showFragment() {
|
||||
val supportFragmentManager: FragmentManager? = mActivity?.supportFragmentManager
|
||||
if (mPM2Fragment == null) {
|
||||
|
||||
d(SceneConstant.M_TAXI_P + TAG, "准备add fragment======")
|
||||
mPM2Fragment = PM2BaseFragment()
|
||||
mActivity?.supportFragmentManager?.beginTransaction()
|
||||
?.add(mContainerId, mPM2Fragment!!)?.commitAllowingStateLoss()
|
||||
|
||||
var fragmentByTag: Fragment? = supportFragmentManager?.findFragmentByTag(PM2BaseFragment.TAG)
|
||||
|
||||
mPM2Fragment = if (fragmentByTag is PM2BaseFragment){
|
||||
fragmentByTag
|
||||
}else{
|
||||
PM2BaseFragment()
|
||||
}
|
||||
|
||||
if (!mPM2Fragment?.isAdded!!){
|
||||
supportFragmentManager?.beginTransaction()
|
||||
?.add(mContainerId, mPM2Fragment!!, PM2BaseFragment.TAG)?.commitAllowingStateLoss()
|
||||
}
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_TAXI_P + TAG, "准备show fragment")
|
||||
mActivity?.supportFragmentManager?.beginTransaction()?.show(mPM2Fragment!!)
|
||||
supportFragmentManager?.beginTransaction()?.show(mPM2Fragment!!)
|
||||
?.commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,6 @@ class PM2BaseFragment :
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = PM2BaseFragment::class.java.simpleName
|
||||
public val TAG = PM2BaseFragment::class.java.simpleName
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
@@ -33,14 +34,25 @@ public class SweeperProvider implements IMogoOCH {
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
FragmentManager supportFragmentManager = activity.getSupportFragmentManager();
|
||||
if (sweeperFragment == null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "准备add fragment======");
|
||||
sweeperFragment = new SweeperFragment();
|
||||
activity.getSupportFragmentManager().beginTransaction().add(containerId, sweeperFragment).commitAllowingStateLoss();
|
||||
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(SweeperFragment.TAG);
|
||||
if (fragmentByTag instanceof SweeperFragment){
|
||||
sweeperFragment = (SweeperFragment) fragmentByTag;
|
||||
}else {
|
||||
sweeperFragment = new SweeperFragment();
|
||||
}
|
||||
|
||||
if (!sweeperFragment.isAdded()){
|
||||
supportFragmentManager.beginTransaction().add(containerId, sweeperFragment
|
||||
,SweeperFragment.TAG).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(TAG, "准备show fragment");
|
||||
activity.getSupportFragmentManager().beginTransaction().show(sweeperFragment).commitAllowingStateLoss();
|
||||
supportFragmentManager.beginTransaction().show(sweeperFragment).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
private void hideFragment() {
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.util.Objects;
|
||||
*/
|
||||
public class SweeperFragment extends BaseSweeperTabFragment<SweeperFragment, SweeperPresenter>
|
||||
implements SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener {
|
||||
private static final String TAG = "SweeperFragment";
|
||||
public static final String TAG = "SweeperFragment";
|
||||
|
||||
private TextView mCurrentStationName;
|
||||
private TextView mNextStationName;
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Context;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener;
|
||||
@@ -48,14 +49,23 @@ class MogoOCHTaxiPassenger implements IMogoOCH {
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
FragmentManager supportFragmentManager = mActivity.getSupportFragmentManager();
|
||||
if (ochTaxiPassengerFragment == null) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "准备add fragment======");
|
||||
ochTaxiPassengerFragment = new TaxiPassengerBaseFragment();
|
||||
mActivity.getSupportFragmentManager().beginTransaction().add(mContainerId, ochTaxiPassengerFragment).commitAllowingStateLoss();
|
||||
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(TaxiPassengerBaseFragment.TAG);
|
||||
if (fragmentByTag instanceof TaxiPassengerBaseFragment){
|
||||
ochTaxiPassengerFragment = (TaxiPassengerBaseFragment) fragmentByTag;
|
||||
}else {
|
||||
ochTaxiPassengerFragment = new TaxiPassengerBaseFragment();
|
||||
}
|
||||
if (!ochTaxiPassengerFragment.isAdded()){
|
||||
supportFragmentManager.beginTransaction().add(mContainerId, ochTaxiPassengerFragment
|
||||
,TaxiPassengerBaseFragment.TAG).commitAllowingStateLoss();
|
||||
}
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "准备show fragment");
|
||||
mActivity.getSupportFragmentManager().beginTransaction().show(ochTaxiPassengerFragment).commitAllowingStateLoss();
|
||||
supportFragmentManager.beginTransaction().show(ochTaxiPassengerFragment).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
private void hideFragment() {
|
||||
|
||||
@@ -54,7 +54,7 @@ import java.util.Objects;
|
||||
public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFragment, BaseTaxiPassengerPresenter>
|
||||
implements IMogoMapListener, TaxiPassengerTaxiView, ITPClickStartAutopilotCallback{
|
||||
|
||||
static final String TAG = "TaxiPassengerBaseFragment";
|
||||
public static final String TAG = "TaxiPassengerBaseFragment";
|
||||
|
||||
private MapBizView mapBizView;
|
||||
private ImageView mAutopilotImage;
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Context;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager;
|
||||
@@ -44,14 +45,24 @@ class TaxiProvider implements IMogoOCH {
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
FragmentManager supportFragmentManager = mActivity.getSupportFragmentManager();
|
||||
if (ochTaxiFragment == null) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "准备add fragment======");
|
||||
ochTaxiFragment = new TaxiFragment();
|
||||
mActivity.getSupportFragmentManager().beginTransaction().add(mContainerId, ochTaxiFragment).commitAllowingStateLoss();
|
||||
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(TaxiFragment.TAG);
|
||||
if (fragmentByTag instanceof TaxiFragment){
|
||||
ochTaxiFragment = (TaxiFragment) fragmentByTag;
|
||||
}else {
|
||||
ochTaxiFragment = new TaxiFragment();
|
||||
}
|
||||
|
||||
if (!ochTaxiFragment.isAdded()){
|
||||
supportFragmentManager.beginTransaction().add(mContainerId, ochTaxiFragment
|
||||
,TaxiFragment.TAG).commitAllowingStateLoss();
|
||||
}
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "准备show fragment");
|
||||
mActivity.getSupportFragmentManager().beginTransaction().show(ochTaxiFragment).commitAllowingStateLoss();
|
||||
supportFragmentManager.beginTransaction().show(ochTaxiFragment).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
private void hideFragment(){
|
||||
|
||||
Reference in New Issue
Block a user