This commit is contained in:
张玉久
2020-08-31 18:31:55 +08:00
parent f699841427
commit ec805653bb
26 changed files with 294 additions and 136 deletions

View File

@ -7,11 +7,11 @@ import android.text.TextUtils;
import android.view.MenuItem;
import android.view.MotionEvent;
import androidx.fragment.app.Fragment;
import com.gh.base.ToolBarActivity;
import com.gh.gamecenter.normal.NormalFragment;
import androidx.fragment.app.Fragment;
/**
* Created by khy on 17/10/17.
*/
@ -94,8 +94,11 @@ public abstract class NormalActivity extends ToolBarActivity {
if (bundle == null) bundle = getIntent().getExtras();
if (TextUtils.isEmpty(fraName)) return;
}
mTargetFragment = Fragment.instantiate(this, fraName, bundle);
getSupportFragmentManager().beginTransaction().replace(getFragmentPlaceholderId(), mTargetFragment).commitNowAllowingStateLoss();
mTargetFragment = getSupportFragmentManager().findFragmentByTag(fraName);
if (mTargetFragment == null) {
mTargetFragment = Fragment.instantiate(this, fraName, bundle);
}
getSupportFragmentManager().beginTransaction().replace(getFragmentPlaceholderId(), mTargetFragment, fraName).commitNowAllowingStateLoss();
}
@Override