[Regional Preference] Do not get child fragment if the fragment is not
added Bug: 279376395 Test: local test Change-Id: I352597dedf2ba7770936d44d09aa111762f94502
This commit is contained in:
@@ -51,20 +51,27 @@ public class LocaleDialogFragment extends InstrumentedDialogFragment {
|
|||||||
static final String ARG_TARGET_LOCALE = "arg_target_locale";
|
static final String ARG_TARGET_LOCALE = "arg_target_locale";
|
||||||
static final String ARG_RESULT_RECEIVER = "arg_result_receiver";
|
static final String ARG_RESULT_RECEIVER = "arg_result_receiver";
|
||||||
|
|
||||||
|
public static LocaleDialogFragment newInstance() {
|
||||||
|
return new LocaleDialogFragment();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show dialog
|
* Show dialog
|
||||||
*/
|
*/
|
||||||
public static void show(
|
public void show(
|
||||||
@NonNull RestrictedSettingsFragment fragment,
|
@NonNull RestrictedSettingsFragment fragment,
|
||||||
int dialogType,
|
int dialogType,
|
||||||
LocaleStore.LocaleInfo localeInfo) {
|
LocaleStore.LocaleInfo localeInfo) {
|
||||||
|
if (!isAdded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
show(fragment, dialogType, localeInfo, null);
|
show(fragment, dialogType, localeInfo, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show dialog
|
* Show dialog
|
||||||
*/
|
*/
|
||||||
public static void show(
|
public void show(
|
||||||
@NonNull RestrictedSettingsFragment fragment,
|
@NonNull RestrictedSettingsFragment fragment,
|
||||||
int dialogType,
|
int dialogType,
|
||||||
LocaleStore.LocaleInfo localeInfo,
|
LocaleStore.LocaleInfo localeInfo,
|
||||||
|
@@ -319,8 +319,9 @@ class LocaleDragAndDropAdapter
|
|||||||
|
|
||||||
public void doTheUpdateWithMovingLocaleItem() {
|
public void doTheUpdateWithMovingLocaleItem() {
|
||||||
LocaleStore.LocaleInfo localeInfo = mFeedItemList.get(0);
|
LocaleStore.LocaleInfo localeInfo = mFeedItemList.get(0);
|
||||||
|
final LocaleDialogFragment fragment = LocaleDialogFragment.newInstance();
|
||||||
if (!localeInfo.getLocale().equals(LocalePicker.getLocales().get(0))) {
|
if (!localeInfo.getLocale().equals(LocalePicker.getLocales().get(0))) {
|
||||||
LocaleDialogFragment.show(mParent,
|
fragment.show(mParent,
|
||||||
LocaleDialogFragment.DIALOG_CONFIRM_SYSTEM_DEFAULT,
|
LocaleDialogFragment.DIALOG_CONFIRM_SYSTEM_DEFAULT,
|
||||||
localeInfo,
|
localeInfo,
|
||||||
new ResultReceiver(new Handler(Looper.getMainLooper())) {
|
new ResultReceiver(new Handler(Looper.getMainLooper())) {
|
||||||
@@ -332,7 +333,7 @@ class LocaleDragAndDropAdapter
|
|||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
doTheUpdate();
|
doTheUpdate();
|
||||||
if (!localeInfo.isTranslated()) {
|
if (!localeInfo.isTranslated()) {
|
||||||
LocaleDialogFragment.show(mParent,
|
fragment.show(mParent,
|
||||||
LocaleDialogFragment
|
LocaleDialogFragment
|
||||||
.DIALOG_NOT_AVAILABLE_LOCALE,
|
.DIALOG_NOT_AVAILABLE_LOCALE,
|
||||||
localeInfo);
|
localeInfo);
|
||||||
|
Reference in New Issue
Block a user