大致完成 整理 Fragment 实例化代码 https://gitlab.ghzs.com/halo/assistant-android/-/issues/20
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user