[Settings] Do not create fragment twice
Bug: 353141266 Test: manual Flag: EXEMPT bugfix Change-Id: Id300fa4ae7b6edc7663da2efe6bd5ce5401d4947
This commit is contained in:
@@ -39,6 +39,7 @@ public class LocalePickerWithRegionActivity extends SettingsBaseActivity
|
|||||||
implements LocalePickerWithRegion.LocaleSelectedListener, MenuItem.OnActionExpandListener {
|
implements LocalePickerWithRegion.LocaleSelectedListener, MenuItem.OnActionExpandListener {
|
||||||
private static final String TAG = LocalePickerWithRegionActivity.class.getSimpleName();
|
private static final String TAG = LocalePickerWithRegionActivity.class.getSimpleName();
|
||||||
private static final String PARENT_FRAGMENT_NAME = "localeListEditor";
|
private static final String PARENT_FRAGMENT_NAME = "localeListEditor";
|
||||||
|
private static final String CHILD_FRAGMENT_NAME = "LocalePickerWithRegion";
|
||||||
|
|
||||||
private LocalePickerWithRegion mSelector;
|
private LocalePickerWithRegion mSelector;
|
||||||
|
|
||||||
@@ -68,13 +69,16 @@ public class LocalePickerWithRegionActivity extends SettingsBaseActivity
|
|||||||
explicitLocales,
|
explicitLocales,
|
||||||
null /* appPackageName */,
|
null /* appPackageName */,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
|
if (getFragmentManager().findFragmentByTag(CHILD_FRAGMENT_NAME) == null) {
|
||||||
getFragmentManager()
|
getFragmentManager()
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
|
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
|
||||||
.replace(R.id.content_frame, mSelector)
|
.replace(R.id.content_frame, mSelector, CHILD_FRAGMENT_NAME)
|
||||||
.addToBackStack(PARENT_FRAGMENT_NAME)
|
.addToBackStack(PARENT_FRAGMENT_NAME)
|
||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
Reference in New Issue
Block a user