Loading src/com/android/settings/localepicker/LocalePickerWithRegionActivity.java +10 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,14 @@ package com.android.settings.localepicker; import static android.window.OnBackInvokedDispatcher.PRIORITY_DEFAULT; import static com.android.settings.regionalpreferences.RegionDialogFragment.ARG_CALLING_PAGE; import static com.android.settings.regionalpreferences.RegionDialogFragment.CALLING_PAGE_LANGUAGE_CHOOSE_A_REGION; import static com.android.settings.regionalpreferences.RegionDialogFragment.DIALOG_CHANGE_SYSTEM_LOCALE_REGION; import static com.android.settings.regionalpreferences.RegionDialogFragment.DIALOG_CHANGE_PREFERRED_LOCALE_REGION; import static com.android.settings.regionalpreferences.RegionDialogFragment.ARG_DIALOG_TYPE; import static com.android.settings.regionalpreferences.RegionDialogFragment.ARG_TARGET_LOCALE; import static com.android.settings.regionalpreferences.RegionDialogFragment.ARG_REPLACED_TARGET_LOCALE; import android.app.FragmentTransaction; import android.content.Intent; import android.os.Bundle; Loading Loading @@ -50,11 +58,6 @@ public class LocalePickerWithRegionActivity extends SettingsBaseActivity private static final String TAG = LocalePickerWithRegionActivity.class.getSimpleName(); private static final String PARENT_FRAGMENT_NAME = "localeListEditor"; private static final String CHILD_FRAGMENT_NAME = "LocalePickerWithRegion"; private static final int DIALOG_CHANGE_SYSTEM_LOCALE_REGION = 1; private static final int DIALOG_CHANGE_PREFERRED_LOCALE_REGION = 2; private static final String ARG_DIALOG_TYPE = "arg_dialog_type"; private static final String ARG_TARGET_LOCALE = "arg_target_locale"; private static final String ARG_REPLACED_TARGET_LOCALE = "arg_replaced_target_locale"; private static final String TAG_DIALOG_CHANGE_REGION = "dialog_change_region"; private static final int DISPOSE = -1; private static final int SHOW_DIALOG_FOR_SYSTEM_LANGUAGE = 0; Loading Loading @@ -139,6 +142,7 @@ public class LocalePickerWithRegionActivity extends SettingsBaseActivity LocaleStore.LocaleInfo locale, FragmentManager fragmentManager) { Bundle args = new Bundle(); args.putInt(ARG_DIALOG_TYPE, DIALOG_CHANGE_SYSTEM_LOCALE_REGION); args.putInt(ARG_CALLING_PAGE, CALLING_PAGE_LANGUAGE_CHOOSE_A_REGION); args.putSerializable(ARG_TARGET_LOCALE, locale); RegionDialogFragment regionDialogFragment = RegionDialogFragment.newInstance(); regionDialogFragment.setArguments(args); Loading @@ -149,6 +153,7 @@ public class LocalePickerWithRegionActivity extends SettingsBaseActivity LocaleStore.LocaleInfo locale, Locale replacedLocale, FragmentManager fragmentManager) { Bundle args = new Bundle(); args.putInt(ARG_DIALOG_TYPE, DIALOG_CHANGE_PREFERRED_LOCALE_REGION); args.putInt(ARG_CALLING_PAGE, CALLING_PAGE_LANGUAGE_CHOOSE_A_REGION); args.putSerializable(ARG_TARGET_LOCALE, locale); args.putSerializable(ARG_REPLACED_TARGET_LOCALE, replacedLocale); RegionDialogFragment regionDialogFragment = RegionDialogFragment.newInstance(); Loading src/com/android/settings/regionalpreferences/RegionDialogFragment.java +27 −11 Original line number Diff line number Diff line Loading @@ -16,8 +16,13 @@ package com.android.settings.regionalpreferences; import static android.app.settings.SettingsEnums.ACTION_CHANGE_PREFERRED_LANGUAGE_REGION_POSITIVE_BTN_CLICKED; import static android.app.settings.SettingsEnums.ACTION_CHANGE_PREFERRED_LANGUAGE_REGION_NEGATIVE_BTN_CLICKED; import static android.app.settings.SettingsEnums.ACTION_CHANGE_REGION_DIALOG_NEGATIVE_BTN_CLICKED; import static android.app.settings.SettingsEnums.ACTION_CHANGE_REGION_DIALOG_POSITIVE_BTN_CLICKED; import static android.app.settings.SettingsEnums.CHANGE_REGION_DIALOG; import android.app.Dialog; import android.app.settings.SettingsEnums; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; Loading Loading @@ -46,12 +51,17 @@ import java.util.Set; * Create a dialog for system region events. */ public class RegionDialogFragment extends InstrumentedDialogFragment { public static final String ARG_CALLING_PAGE = "arg_calling_page"; public static final int CALLING_PAGE_LANGUAGE_CHOOSE_A_REGION = 0; public static final int CALLING_PAGE_REGIONAL_PREFERENCES_REGION_PICKER = 1; public static final int DIALOG_CHANGE_SYSTEM_LOCALE_REGION = 1; public static final int DIALOG_CHANGE_PREFERRED_LOCALE_REGION = 2; public static final String ARG_DIALOG_TYPE = "arg_dialog_type"; public static final String ARG_TARGET_LOCALE = "arg_target_locale"; public static final String ARG_REPLACED_TARGET_LOCALE = "arg_replaced_target_locale"; private static final String TAG = "RegionDialogFragment"; static final int DIALOG_CHANGE_SYSTEM_LOCALE_REGION = 1; static final int DIALOG_CHANGE_PREFERRED_LOCALE_REGION = 2; static final String ARG_DIALOG_TYPE = "arg_dialog_type"; static final String ARG_TARGET_LOCALE = "arg_target_locale"; static final String ARG_REPLACED_TARGET_LOCALE = "arg_replaced_target_locale"; /** * Use this factory method to create a new instance of Loading @@ -66,7 +76,7 @@ public class RegionDialogFragment extends InstrumentedDialogFragment { @Override public int getMetricsCategory() { return SettingsEnums.CHANGE_REGION_DIALOG; return CHANGE_REGION_DIALOG; } @NonNull Loading Loading @@ -114,6 +124,7 @@ public class RegionDialogFragment extends InstrumentedDialogFragment { class RegionDialogController implements DialogInterface.OnClickListener { private final Context mContext; private final int mDialogType; private final int mCallingPage; private final LocaleStore.LocaleInfo mLocaleInfo; private final Locale mReplacedLocale; private final MetricsFeatureProvider mMetricsFeatureProvider; Loading @@ -123,6 +134,7 @@ public class RegionDialogFragment extends InstrumentedDialogFragment { mContext = context; Bundle arguments = dialogFragment.getArguments(); mDialogType = arguments.getInt(ARG_DIALOG_TYPE); mCallingPage = arguments.getInt(ARG_CALLING_PAGE); mLocaleInfo = (LocaleStore.LocaleInfo) arguments.getSerializable(ARG_TARGET_LOCALE); mReplacedLocale = (Locale) arguments.getSerializable(ARG_REPLACED_TARGET_LOCALE); mMetricsFeatureProvider = Loading @@ -137,8 +149,10 @@ public class RegionDialogFragment extends InstrumentedDialogFragment { updateRegion(mLocaleInfo.getLocale().toLanguageTag()); mMetricsFeatureProvider.action( mContext, SettingsEnums.ACTION_CHANGE_REGION_DIALOG_POSITIVE_BTN_CLICKED); // TODO: add new metrics for DIALOG_CHANGE_PREFERRED_LOCALE_REGION mDialogType == DIALOG_CHANGE_SYSTEM_LOCALE_REGION ? ACTION_CHANGE_REGION_DIALOG_POSITIVE_BTN_CLICKED : ACTION_CHANGE_PREFERRED_LANGUAGE_REGION_POSITIVE_BTN_CLICKED, mCallingPage); dismiss(); if (getActivity() != null) { getActivity().finish(); Loading @@ -146,8 +160,10 @@ public class RegionDialogFragment extends InstrumentedDialogFragment { } else { mMetricsFeatureProvider.action( mContext, SettingsEnums.ACTION_CHANGE_REGION_DIALOG_NEGATIVE_BTN_CLICKED); // TODO: add new metrics for DIALOG_CHANGE_PREFERRED_LOCALE_REGION mDialogType == DIALOG_CHANGE_SYSTEM_LOCALE_REGION ? ACTION_CHANGE_REGION_DIALOG_NEGATIVE_BTN_CLICKED : ACTION_CHANGE_PREFERRED_LANGUAGE_REGION_NEGATIVE_BTN_CLICKED, mCallingPage); dismiss(); } } Loading src/com/android/settings/regionalpreferences/RegionPickerBaseListPreferenceController.java +5 −1 Original line number Diff line number Diff line Loading @@ -167,8 +167,12 @@ public abstract class RegionPickerBaseListPreferenceController extends BasePrefe mFragmentManager = mParent.getChildFragmentManager(); Bundle args = new Bundle(); args.putInt(RegionDialogFragment.ARG_DIALOG_TYPE, args.putInt( RegionDialogFragment.ARG_DIALOG_TYPE, RegionDialogFragment.DIALOG_CHANGE_SYSTEM_LOCALE_REGION); args.putInt( RegionDialogFragment.ARG_CALLING_PAGE, RegionDialogFragment.CALLING_PAGE_REGIONAL_PREFERENCES_REGION_PICKER); args.putSerializable(RegionDialogFragment.ARG_TARGET_LOCALE, localeInfo); RegionDialogFragment regionDialogFragment = RegionDialogFragment.newInstance(); regionDialogFragment.setArguments(args); Loading Loading
src/com/android/settings/localepicker/LocalePickerWithRegionActivity.java +10 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,14 @@ package com.android.settings.localepicker; import static android.window.OnBackInvokedDispatcher.PRIORITY_DEFAULT; import static com.android.settings.regionalpreferences.RegionDialogFragment.ARG_CALLING_PAGE; import static com.android.settings.regionalpreferences.RegionDialogFragment.CALLING_PAGE_LANGUAGE_CHOOSE_A_REGION; import static com.android.settings.regionalpreferences.RegionDialogFragment.DIALOG_CHANGE_SYSTEM_LOCALE_REGION; import static com.android.settings.regionalpreferences.RegionDialogFragment.DIALOG_CHANGE_PREFERRED_LOCALE_REGION; import static com.android.settings.regionalpreferences.RegionDialogFragment.ARG_DIALOG_TYPE; import static com.android.settings.regionalpreferences.RegionDialogFragment.ARG_TARGET_LOCALE; import static com.android.settings.regionalpreferences.RegionDialogFragment.ARG_REPLACED_TARGET_LOCALE; import android.app.FragmentTransaction; import android.content.Intent; import android.os.Bundle; Loading Loading @@ -50,11 +58,6 @@ public class LocalePickerWithRegionActivity extends SettingsBaseActivity private static final String TAG = LocalePickerWithRegionActivity.class.getSimpleName(); private static final String PARENT_FRAGMENT_NAME = "localeListEditor"; private static final String CHILD_FRAGMENT_NAME = "LocalePickerWithRegion"; private static final int DIALOG_CHANGE_SYSTEM_LOCALE_REGION = 1; private static final int DIALOG_CHANGE_PREFERRED_LOCALE_REGION = 2; private static final String ARG_DIALOG_TYPE = "arg_dialog_type"; private static final String ARG_TARGET_LOCALE = "arg_target_locale"; private static final String ARG_REPLACED_TARGET_LOCALE = "arg_replaced_target_locale"; private static final String TAG_DIALOG_CHANGE_REGION = "dialog_change_region"; private static final int DISPOSE = -1; private static final int SHOW_DIALOG_FOR_SYSTEM_LANGUAGE = 0; Loading Loading @@ -139,6 +142,7 @@ public class LocalePickerWithRegionActivity extends SettingsBaseActivity LocaleStore.LocaleInfo locale, FragmentManager fragmentManager) { Bundle args = new Bundle(); args.putInt(ARG_DIALOG_TYPE, DIALOG_CHANGE_SYSTEM_LOCALE_REGION); args.putInt(ARG_CALLING_PAGE, CALLING_PAGE_LANGUAGE_CHOOSE_A_REGION); args.putSerializable(ARG_TARGET_LOCALE, locale); RegionDialogFragment regionDialogFragment = RegionDialogFragment.newInstance(); regionDialogFragment.setArguments(args); Loading @@ -149,6 +153,7 @@ public class LocalePickerWithRegionActivity extends SettingsBaseActivity LocaleStore.LocaleInfo locale, Locale replacedLocale, FragmentManager fragmentManager) { Bundle args = new Bundle(); args.putInt(ARG_DIALOG_TYPE, DIALOG_CHANGE_PREFERRED_LOCALE_REGION); args.putInt(ARG_CALLING_PAGE, CALLING_PAGE_LANGUAGE_CHOOSE_A_REGION); args.putSerializable(ARG_TARGET_LOCALE, locale); args.putSerializable(ARG_REPLACED_TARGET_LOCALE, replacedLocale); RegionDialogFragment regionDialogFragment = RegionDialogFragment.newInstance(); Loading
src/com/android/settings/regionalpreferences/RegionDialogFragment.java +27 −11 Original line number Diff line number Diff line Loading @@ -16,8 +16,13 @@ package com.android.settings.regionalpreferences; import static android.app.settings.SettingsEnums.ACTION_CHANGE_PREFERRED_LANGUAGE_REGION_POSITIVE_BTN_CLICKED; import static android.app.settings.SettingsEnums.ACTION_CHANGE_PREFERRED_LANGUAGE_REGION_NEGATIVE_BTN_CLICKED; import static android.app.settings.SettingsEnums.ACTION_CHANGE_REGION_DIALOG_NEGATIVE_BTN_CLICKED; import static android.app.settings.SettingsEnums.ACTION_CHANGE_REGION_DIALOG_POSITIVE_BTN_CLICKED; import static android.app.settings.SettingsEnums.CHANGE_REGION_DIALOG; import android.app.Dialog; import android.app.settings.SettingsEnums; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; Loading Loading @@ -46,12 +51,17 @@ import java.util.Set; * Create a dialog for system region events. */ public class RegionDialogFragment extends InstrumentedDialogFragment { public static final String ARG_CALLING_PAGE = "arg_calling_page"; public static final int CALLING_PAGE_LANGUAGE_CHOOSE_A_REGION = 0; public static final int CALLING_PAGE_REGIONAL_PREFERENCES_REGION_PICKER = 1; public static final int DIALOG_CHANGE_SYSTEM_LOCALE_REGION = 1; public static final int DIALOG_CHANGE_PREFERRED_LOCALE_REGION = 2; public static final String ARG_DIALOG_TYPE = "arg_dialog_type"; public static final String ARG_TARGET_LOCALE = "arg_target_locale"; public static final String ARG_REPLACED_TARGET_LOCALE = "arg_replaced_target_locale"; private static final String TAG = "RegionDialogFragment"; static final int DIALOG_CHANGE_SYSTEM_LOCALE_REGION = 1; static final int DIALOG_CHANGE_PREFERRED_LOCALE_REGION = 2; static final String ARG_DIALOG_TYPE = "arg_dialog_type"; static final String ARG_TARGET_LOCALE = "arg_target_locale"; static final String ARG_REPLACED_TARGET_LOCALE = "arg_replaced_target_locale"; /** * Use this factory method to create a new instance of Loading @@ -66,7 +76,7 @@ public class RegionDialogFragment extends InstrumentedDialogFragment { @Override public int getMetricsCategory() { return SettingsEnums.CHANGE_REGION_DIALOG; return CHANGE_REGION_DIALOG; } @NonNull Loading Loading @@ -114,6 +124,7 @@ public class RegionDialogFragment extends InstrumentedDialogFragment { class RegionDialogController implements DialogInterface.OnClickListener { private final Context mContext; private final int mDialogType; private final int mCallingPage; private final LocaleStore.LocaleInfo mLocaleInfo; private final Locale mReplacedLocale; private final MetricsFeatureProvider mMetricsFeatureProvider; Loading @@ -123,6 +134,7 @@ public class RegionDialogFragment extends InstrumentedDialogFragment { mContext = context; Bundle arguments = dialogFragment.getArguments(); mDialogType = arguments.getInt(ARG_DIALOG_TYPE); mCallingPage = arguments.getInt(ARG_CALLING_PAGE); mLocaleInfo = (LocaleStore.LocaleInfo) arguments.getSerializable(ARG_TARGET_LOCALE); mReplacedLocale = (Locale) arguments.getSerializable(ARG_REPLACED_TARGET_LOCALE); mMetricsFeatureProvider = Loading @@ -137,8 +149,10 @@ public class RegionDialogFragment extends InstrumentedDialogFragment { updateRegion(mLocaleInfo.getLocale().toLanguageTag()); mMetricsFeatureProvider.action( mContext, SettingsEnums.ACTION_CHANGE_REGION_DIALOG_POSITIVE_BTN_CLICKED); // TODO: add new metrics for DIALOG_CHANGE_PREFERRED_LOCALE_REGION mDialogType == DIALOG_CHANGE_SYSTEM_LOCALE_REGION ? ACTION_CHANGE_REGION_DIALOG_POSITIVE_BTN_CLICKED : ACTION_CHANGE_PREFERRED_LANGUAGE_REGION_POSITIVE_BTN_CLICKED, mCallingPage); dismiss(); if (getActivity() != null) { getActivity().finish(); Loading @@ -146,8 +160,10 @@ public class RegionDialogFragment extends InstrumentedDialogFragment { } else { mMetricsFeatureProvider.action( mContext, SettingsEnums.ACTION_CHANGE_REGION_DIALOG_NEGATIVE_BTN_CLICKED); // TODO: add new metrics for DIALOG_CHANGE_PREFERRED_LOCALE_REGION mDialogType == DIALOG_CHANGE_SYSTEM_LOCALE_REGION ? ACTION_CHANGE_REGION_DIALOG_NEGATIVE_BTN_CLICKED : ACTION_CHANGE_PREFERRED_LANGUAGE_REGION_NEGATIVE_BTN_CLICKED, mCallingPage); dismiss(); } } Loading
src/com/android/settings/regionalpreferences/RegionPickerBaseListPreferenceController.java +5 −1 Original line number Diff line number Diff line Loading @@ -167,8 +167,12 @@ public abstract class RegionPickerBaseListPreferenceController extends BasePrefe mFragmentManager = mParent.getChildFragmentManager(); Bundle args = new Bundle(); args.putInt(RegionDialogFragment.ARG_DIALOG_TYPE, args.putInt( RegionDialogFragment.ARG_DIALOG_TYPE, RegionDialogFragment.DIALOG_CHANGE_SYSTEM_LOCALE_REGION); args.putInt( RegionDialogFragment.ARG_CALLING_PAGE, RegionDialogFragment.CALLING_PAGE_REGIONAL_PREFERENCES_REGION_PICKER); args.putSerializable(RegionDialogFragment.ARG_TARGET_LOCALE, localeInfo); RegionDialogFragment regionDialogFragment = RegionDialogFragment.newInstance(); regionDialogFragment.setArguments(args); Loading