mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-19 05:39:10 +00:00
Fix bug #20: Back arrow closes app
This commit is contained in:
parent
33fc7b1548
commit
2437d84bb0
2 changed files with 4 additions and 21 deletions
|
@ -1828,7 +1828,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
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 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
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 class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
startActivityOnTheSameDisplay(intent);
|
||||
break;
|
||||
case 1:
|
||||
launchSettings(SettingsActivity.EXTRA_ENTRY_VALUE_LONG_PRESS_COMMA);
|
||||
launchSettings();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue