From 2437d84bb02038bdab6da6d0c5e63b7e27eb41f6 Mon Sep 17 00:00:00 2001 From: dslul Date: Sat, 18 Jan 2020 16:44:37 +0100 Subject: [PATCH] Fix bug #20: Back arrow closes app --- .../openboard/inputmethod/latin/LatinIME.java | 6 ++---- .../latin/settings/SettingsActivity.java | 19 ++----------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/LatinIME.java b/app/src/main/java/org/dslul/openboard/inputmethod/latin/LatinIME.java index 853ceea3c..a454e98d4 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/LatinIME.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/LatinIME.java @@ -1828,7 +1828,7 @@ private void startActivityOnTheSameDisplay(Intent intent) { ActivityOptions.makeBasic().setLaunchDisplayId(currentDisplayId).toBundle()); } - void launchSettings(final String extraEntryValue) { + void launchSettings() { mInputLogic.commitTyped(mSettings.getCurrent(), LastComposedWord.NOT_A_SEPARATOR); requestHideSelf(0); final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); @@ -1840,8 +1840,6 @@ void launchSettings(final String extraEntryValue) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); - intent.putExtra(SettingsActivity.EXTRA_SHOW_HOME_AS_UP, false); - intent.putExtra(SettingsActivity.EXTRA_ENTRY_KEY, extraEntryValue); startActivityOnTheSameDisplay(intent); } @@ -1869,7 +1867,7 @@ public void onClick(DialogInterface di, int position) { startActivityOnTheSameDisplay(intent); break; case 1: - launchSettings(SettingsActivity.EXTRA_ENTRY_VALUE_LONG_PRESS_COMMA); + launchSettings(); break; } } diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/SettingsActivity.java b/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/SettingsActivity.java index 81f1104f0..eb7780594 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/SettingsActivity.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/SettingsActivity.java @@ -32,7 +32,6 @@ public final class SettingsActivity extends PreferenceActivity implements ActivityCompat.OnRequestPermissionsResultCallback { private static final String DEFAULT_FRAGMENT = SettingsFragment.class.getName(); - public static final String EXTRA_SHOW_HOME_AS_UP = "show_home_as_up"; public static final String EXTRA_ENTRY_KEY = "entry"; public static final String EXTRA_ENTRY_VALUE_LONG_PRESS_COMMA = "long_press_comma"; public static final String EXTRA_ENTRY_VALUE_APP_ICON = "app_icon"; @@ -45,24 +44,10 @@ public final class SettingsActivity extends PreferenceActivity protected void onCreate(final Bundle savedState) { super.onCreate(savedState); final ActionBar actionBar = getActionBar(); - final Intent intent = getIntent(); if (actionBar != null) { - mShowHomeAsUp = intent.getBooleanExtra(EXTRA_SHOW_HOME_AS_UP, true); - actionBar.setDisplayHomeAsUpEnabled(mShowHomeAsUp); - actionBar.setHomeButtonEnabled(mShowHomeAsUp); + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setHomeButtonEnabled(true); } - StatsUtils.onSettingsActivity( - intent.hasExtra(EXTRA_ENTRY_KEY) ? intent.getStringExtra(EXTRA_ENTRY_KEY) - : EXTRA_ENTRY_VALUE_SYSTEM_SETTINGS); - } - - @Override - public boolean onOptionsItemSelected(final MenuItem item) { - if (mShowHomeAsUp && item.getItemId() == android.R.id.home) { - finish(); - return true; - } - return super.onOptionsItemSelected(item); } @Override