* commit 'eee0baad2e7ac239cda55e675faaebd9642c21d3': Show "navigate up" icon on settings activity
This commit is contained in:
commit
7c76da6d03
2 changed files with 34 additions and 11 deletions
|
@ -20,7 +20,6 @@ import static com.android.inputmethod.latin.Constants.ImeOption.FORCE_ASCII;
|
||||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE;
|
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE;
|
||||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE_COMPAT;
|
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE_COMPAT;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -1621,24 +1620,22 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
if (mainKeyboardView != null) {
|
if (mainKeyboardView != null) {
|
||||||
mainKeyboardView.closing();
|
mainKeyboardView.closing();
|
||||||
}
|
}
|
||||||
launchSubActivity(SettingsActivity.class);
|
final Intent intent = new Intent();
|
||||||
}
|
intent.setClass(LatinIME.this, SettingsActivity.class);
|
||||||
|
|
||||||
private void launchSubActivity(final Class<? extends Activity> activityClass) {
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setClass(LatinIME.this, activityClass);
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
||||||
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
intent.putExtra(SettingsActivity.EXTRA_SHOW_HOME_AS_UP, false);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showSubtypeSelectorAndSettings() {
|
private void showSubtypeSelectorAndSettings() {
|
||||||
final CharSequence title = getString(R.string.english_ime_input_options);
|
final CharSequence title = getString(R.string.english_ime_input_options);
|
||||||
|
// TODO: Should use new string "Select active input modes".
|
||||||
|
final CharSequence languageSelectionTitle = getString(R.string.language_selection_title);
|
||||||
final CharSequence[] items = new CharSequence[] {
|
final CharSequence[] items = new CharSequence[] {
|
||||||
// TODO: Should use new string "Select active input modes".
|
languageSelectionTitle,
|
||||||
getString(R.string.language_selection_title),
|
getString(ApplicationUtils.getActivityTitleResId(this, SettingsActivity.class))
|
||||||
getString(ApplicationUtils.getActivityTitleResId(this, SettingsActivity.class)),
|
|
||||||
};
|
};
|
||||||
final OnClickListener listener = new OnClickListener() {
|
final OnClickListener listener = new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1651,6 +1648,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
||||||
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
intent.putExtra(Intent.EXTRA_TITLE, languageSelectionTitle);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -18,11 +18,36 @@ package com.android.inputmethod.latin.settings;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.utils.FragmentUtils;
|
import com.android.inputmethod.latin.utils.FragmentUtils;
|
||||||
|
|
||||||
|
import android.app.ActionBar;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
public final class SettingsActivity extends PreferenceActivity {
|
public final class SettingsActivity extends PreferenceActivity {
|
||||||
|
public static final String EXTRA_SHOW_HOME_AS_UP = "show_home_as_up";
|
||||||
private static final String DEFAULT_FRAGMENT = SettingsFragment.class.getName();
|
private static final String DEFAULT_FRAGMENT = SettingsFragment.class.getName();
|
||||||
|
private boolean mShowHomeAsUp;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(final Bundle savedState) {
|
||||||
|
super.onCreate(savedState);
|
||||||
|
final ActionBar actionBar = getActionBar();
|
||||||
|
if (actionBar != null) {
|
||||||
|
mShowHomeAsUp = getIntent().getBooleanExtra(EXTRA_SHOW_HOME_AS_UP, true);
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(mShowHomeAsUp);
|
||||||
|
actionBar.setHomeButtonEnabled(mShowHomeAsUp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||||
|
if (mShowHomeAsUp && item.getItemId() == android.R.id.home) {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Intent getIntent() {
|
public Intent getIntent() {
|
||||||
|
@ -36,7 +61,7 @@ public final class SettingsActivity extends PreferenceActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValidFragment(String fragmentName) {
|
public boolean isValidFragment(final String fragmentName) {
|
||||||
return FragmentUtils.isValidFragment(fragmentName);
|
return FragmentUtils.isValidFragment(fragmentName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue