[automerge] [Panlingual] Fix the back button press 2p: c0214ff9f3

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17615237

Bug: 226894999
Change-Id: I81b99b74f45acdd9f7073aea1d4f5bebd1cd13b1
This commit is contained in:
tom hsu
2022-04-06 15:37:24 +00:00
committed by Presubmit Automerger Backend

View File

@@ -95,26 +95,12 @@ public class AppLocalePickerActivity extends SettingsBaseActivity
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) { if (item.getItemId() == android.R.id.home) {
handleBackPressed(); super.onBackPressed();
return true; return true;
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@Override
public void onBackPressed() {
handleBackPressed();
}
private void handleBackPressed() {
if (getFragmentManager().getBackStackEntryCount() > 1) {
super.onBackPressed();
} else {
setResult(RESULT_CANCELED);
finish();
}
}
@Override @Override
public void onLocaleSelected(LocaleStore.LocaleInfo localeInfo) { public void onLocaleSelected(LocaleStore.LocaleInfo localeInfo) {
if (localeInfo == null || localeInfo.getLocale() == null || localeInfo.isSystemLocale()) { if (localeInfo == null || localeInfo.getLocale() == null || localeInfo.isSystemLocale()) {