aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/AndroidManifest.xml8
-rw-r--r--java/res/values-v20/platform-theme.xml (renamed from java/res/values-v21/platform-theme.xml)16
-rw-r--r--java/res/values/platform-theme.xml1
-rw-r--r--java/res/xml/prefs.xml154
-rw-r--r--java/res/xml/prefs_for_debug.xml24
-rw-r--r--java/res/xml/spell_checker_settings.xml8
-rw-r--r--java/src/com/android/inputmethod/keyboard/MainKeyboardView.java6
-rw-r--r--java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java11
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java2
-rw-r--r--java/src/com/android/inputmethod/latin/settings/SettingsFragment.java36
10 files changed, 110 insertions, 156 deletions
diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml
index 5d8ef43f5..6f4e602ce 100644
--- a/java/AndroidManifest.xml
+++ b/java/AndroidManifest.xml
@@ -86,7 +86,7 @@
</receiver>
<activity android:name=".settings.SettingsActivity"
- android:theme="@style/platformSettingsTheme"
+ android:theme="@style/platformActivityTheme"
android:label="@string/english_ime_settings"
android:uiOptions="splitActionBarWhenNarrow">
<intent-filter>
@@ -95,7 +95,7 @@
</activity>
<activity android:name=".spellcheck.SpellCheckerSettingsActivity"
- android:theme="@style/platformSettingsTheme"
+ android:theme="@style/platformActivityTheme"
android:label="@string/android_spell_checker_settings">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -103,7 +103,7 @@
</activity>
<activity android:name=".settings.DebugSettingsActivity"
- android:theme="@style/platformSettingsTheme"
+ android:theme="@style/platformActivityTheme"
android:label="@string/english_ime_debug_settings">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -150,7 +150,7 @@
</receiver>
<activity android:name="com.android.inputmethod.dictionarypack.DictionarySettingsActivity"
- android:theme="@style/platformSettingsTheme"
+ android:theme="@style/platformActivityTheme"
android:label="@string/dictionary_settings_title"
android:uiOptions="splitActionBarWhenNarrow">
<intent-filter>
diff --git a/java/res/values-v21/platform-theme.xml b/java/res/values-v20/platform-theme.xml
index a49e36459..52e7f3521 100644
--- a/java/res/values-v21/platform-theme.xml
+++ b/java/res/values-v20/platform-theme.xml
@@ -18,21 +18,9 @@
*/
-->
+<!-- TODO: This file is temporarily placed under values-v20. -->
+<!-- TODO: It might be moved under values-v21. -->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="platformActivityTheme" parent="@android:style/Theme.Material.Light" />
- <!-- From packages/apps/Settings -->
- <style name="platformSettingsTheme" parent="@android:style/Theme.Material.Settings">
- <item name="android:actionBarStyle">@android:style/Widget.Material.Light.ActionBar.Solid</item>
- <item name="android:alertDialogTheme">@style/Theme.AlertDialog</item>
- </style>
- <!-- From packages/apps/Settings -->
- <style name="Theme.AlertDialog" parent="@*android:style/Theme.Material.Light.Dialog.Alert">
- <!-- Used by the ActionBar: @color/theme_primary -->
- <item name="android:colorPrimary">#ff263238</item>
- <!-- Used by the StatusBar: @color/theme_primary_dark -->
- <item name="android:colorPrimaryDark">#ff21272b</item>
- <!-- Used by controls, e.g. CheckBox, ProgressBar, etc.: @color/theme_accent -->
- <item name="android:colorAccent">#ff009688</item>
- </style>
<style name="platformDialogTheme" parent="@android:style/Theme.Material.Light.Dialog" />
</resources>
diff --git a/java/res/values/platform-theme.xml b/java/res/values/platform-theme.xml
index e68859712..8e131a2b0 100644
--- a/java/res/values/platform-theme.xml
+++ b/java/res/values/platform-theme.xml
@@ -20,6 +20,5 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="platformActivityTheme" parent="@android:style/Theme.Holo" />
- <style name="platformSettingsTheme" parent="@android:style/Theme.Holo" />
<style name="platformDialogTheme" parent="@android:style/Theme.Holo.Dialog" />
</resources>
diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index cb951d264..e71d9517c 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -21,77 +21,61 @@
<PreferenceScreen
android:title="@string/settings_screen_input"
android:key="screen_input">
- <SwitchPreference
+ <CheckBoxPreference
android:key="auto_cap"
android:title="@string/auto_cap"
android:summary="@string/auto_cap_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
- <SwitchPreference
+ android:defaultValue="true"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="pref_key_use_double_space_period"
android:title="@string/use_double_space_period"
android:summary="@string/use_double_space_period_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
- <SwitchPreference
+ android:defaultValue="true"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="vibrate_on"
android:title="@string/vibrate_on_keypress"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="@bool/config_default_vibration_enabled" />
- <SwitchPreference
+ android:defaultValue="@bool/config_default_vibration_enabled"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="sound_on"
android:title="@string/sound_on_keypress"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="@bool/config_default_sound_enabled" />
- <SwitchPreference
+ android:defaultValue="@bool/config_default_sound_enabled"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="popup_on"
android:title="@string/popup_on_keypress"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="@bool/config_default_key_preview_popup" />
- <SwitchPreference
+ android:defaultValue="@bool/config_default_key_preview_popup"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="pref_voice_input_key"
android:title="@string/voice_input"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
+ android:defaultValue="true"
+ android:persistent="true" />
</PreferenceScreen>
<ListPreference
android:key="pref_keyboard_theme"
android:title="@string/keyboard_theme"
- android:persistent="true"
android:entryValues="@array/keyboard_theme_ids"
- android:entries="@array/keyboard_theme_names" />
+ android:entries="@array/keyboard_theme_names"
+ android:persistent="true" />
<PreferenceScreen
android:title="@string/settings_screen_multi_lingual"
android:key="screen_multi_lingual">
- <SwitchPreference
+ <CheckBoxPreference
android:key="pref_show_language_switch_key"
android:title="@string/show_language_switch_key"
android:summary="@string/show_language_switch_key_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
- <SwitchPreference
+ android:defaultValue="true"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="pref_include_other_imes_in_language_switch_list"
android:dependency="pref_show_language_switch_key"
android:title="@string/include_other_imes_in_language_switch_list"
android:summary="@string/include_other_imes_in_language_switch_list_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="false" />
+ android:defaultValue="false"
+ android:persistent="true" />
<PreferenceScreen
android:fragment="com.android.inputmethod.latin.settings.AdditionalSubtypeSettings"
android:key="custom_input_styles"
@@ -100,31 +84,25 @@
<PreferenceScreen
android:title="@string/settings_screen_gesture"
android:key="screen_gesture">
- <SwitchPreference
+ <CheckBoxPreference
android:key="gesture_input"
android:title="@string/gesture_input"
android:summary="@string/gesture_input_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
- <SwitchPreference
+ android:defaultValue="true"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="pref_gesture_floating_preview_text"
android:dependency="gesture_input"
android:title="@string/gesture_floating_preview_text"
android:summary="@string/gesture_floating_preview_text_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
- <SwitchPreference
+ android:defaultValue="true"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="pref_gesture_preview_trail"
android:dependency="gesture_input"
android:title="@string/gesture_preview_trail"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
+ android:defaultValue="true"
+ android:persistent="true" />
</PreferenceScreen>
<PreferenceScreen
android:title="@string/settings_screen_correction"
@@ -145,55 +123,47 @@
android:value="@string/dictionary_pack_client_id" />
</intent>
</PreferenceScreen>
- <SwitchPreference
+ <CheckBoxPreference
android:key="pref_key_block_potentially_offensive"
android:title="@string/prefs_block_potentially_offensive_title"
android:summary="@string/prefs_block_potentially_offensive_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="@bool/config_block_potentially_offensive" />
+ android:defaultValue="@bool/config_block_potentially_offensive"
+ android:persistent="true" />
<ListPreference
android:key="auto_correction_threshold"
android:title="@string/auto_correction"
android:summary="@string/auto_correction_summary"
- android:persistent="true"
android:entryValues="@array/auto_correction_threshold_mode_indexes"
android:entries="@array/auto_correction_threshold_modes"
- android:defaultValue="@string/auto_correction_threshold_mode_index_modest" />
+ android:defaultValue="@string/auto_correction_threshold_mode_index_modest"
+ android:persistent="true" />
<ListPreference
android:key="show_suggestions_setting"
android:summary="@string/prefs_show_suggestions_summary"
android:title="@string/prefs_show_suggestions"
- android:persistent="true"
android:entryValues="@array/prefs_suggestion_visibility_values"
android:entries="@array/prefs_suggestion_visibilities"
- android:defaultValue="@string/prefs_suggestion_visibility_default_value" />
- <SwitchPreference
+ android:defaultValue="@string/prefs_suggestion_visibility_default_value"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="pref_key_use_personalized_dicts"
android:title="@string/use_personalized_dicts"
android:summary="@string/use_personalized_dicts_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
- <SwitchPreference
+ android:defaultValue="true"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="pref_key_use_contacts_dict"
android:title="@string/use_contacts_dict"
android:summary="@string/use_contacts_dict_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
- <SwitchPreference
+ android:defaultValue="true"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="next_word_prediction"
android:title="@string/bigram_prediction"
android:summary="@string/bigram_prediction_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
- </PreferenceScreen>
+ android:defaultValue="true"
+ android:persistent="true" />
+ </PreferenceScreen>
<PreferenceScreen
android:title="@string/settings_screen_advanced"
android:key="screen_advanced">
@@ -211,24 +181,20 @@
latin:maxValue="100" /> <!-- percent -->
<!-- The settigs for showing setup wizard application icon shouldn't be persistent and
the default value is added programmatically. -->
- <SwitchPreference
+ <CheckBoxPreference
android:key="pref_show_setup_wizard_icon"
android:title="@string/show_setup_wizard_icon"
- android:summary="@string/show_setup_wizard_icon_summary"
- android:switchTextOn=""
- android:switchTextOff="" />
+ android:summary="@string/show_setup_wizard_icon_summary" />
<!-- title will be set programmatically to embed application name -->
- <SwitchPreference
+ <CheckBoxPreference
android:key="pref_enable_metrics_logging"
android:summary="@string/enable_metrics_logging_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
+ android:defaultValue="true"
+ android:persistent="true" />
<PreferenceScreen
android:key="screen_debug"
android:title="Debug settings"
- android:persistent="true"
- android:defaultValue="false" />
- </PreferenceScreen>
+ android:defaultValue="false"
+ android:persistent="true" />
+ </PreferenceScreen>
</PreferenceScreen>
diff --git a/java/res/xml/prefs_for_debug.xml b/java/res/xml/prefs_for_debug.xml
index be4c8b3e1..ae29a8a82 100644
--- a/java/res/xml/prefs_for_debug.xml
+++ b/java/res/xml/prefs_for_debug.xml
@@ -20,28 +20,22 @@
android:title="@string/prefs_debug_mode"
android:key="english_ime_debug_settings"
>
- <SwitchPreference
+ <CheckBoxPreference
android:key="debug_mode"
android:title="@string/prefs_debug_mode"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="false" />
- <SwitchPreference
+ android:defaultValue="false"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="force_non_distinct_multitouch"
android:title="@string/prefs_force_non_distinct_multitouch"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="false" />
- <SwitchPreference
+ android:defaultValue="false"
+ android:persistent="true" />
+ <CheckBoxPreference
android:key="pref_sliding_key_input_preview"
android:title="@string/sliding_key_input_preview"
android:summary="@string/sliding_key_input_preview_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
+ android:defaultValue="true"
+ android:persistent="true" />
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
android:key="pref_key_longpress_timeout"
android:title="@string/prefs_key_longpress_timeout_settings"
diff --git a/java/res/xml/spell_checker_settings.xml b/java/res/xml/spell_checker_settings.xml
index e3db4850b..3d9501857 100644
--- a/java/res/xml/spell_checker_settings.xml
+++ b/java/res/xml/spell_checker_settings.xml
@@ -17,12 +17,10 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
>
- <SwitchPreference
+ <CheckBoxPreference
android:key="pref_spellcheck_use_contacts"
android:title="@string/use_contacts_for_spellchecking_option_title"
android:summary="@string/use_contacts_for_spellchecking_option_summary"
- android:switchTextOn=""
- android:switchTextOff=""
- android:persistent="true"
- android:defaultValue="true" />
+ android:defaultValue="true"
+ android:persistent="true" />
</PreferenceScreen>
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 81825934f..702efb3d7 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -451,7 +451,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
locatePreviewPlacerView();
getLocationInWindow(mOriginCoords);
- mKeyPreviewChoreographer.placeKeyPreviewAndShow(key, keyboard.mIconsSet, mKeyDrawParams,
+ mKeyPreviewChoreographer.placeAndShowKeyPreview(key, keyboard.mIconsSet, mKeyDrawParams,
getWidth(), mOriginCoords, mDrawingPreviewPlacerView, isHardwareAccelerated());
}
@@ -554,11 +554,11 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
// though there may be some chances that the value is zero. <code>width == 0</code>
// will cause zero-division error at
// {@link MoreKeysKeyboardParams#setParameters(int,int,int,int,int,int,boolean,int)}.
- final boolean singleMoreKeyWithPreview = mKeyPreviewDrawParams.isPopupEnabled()
+ final boolean isSingleMoreKeyWithPreview = mKeyPreviewDrawParams.isPopupEnabled()
&& !key.noKeyPreview() && moreKeys.length == 1
&& mKeyPreviewDrawParams.getVisibleWidth() > 0;
final MoreKeysKeyboard.Builder builder = new MoreKeysKeyboard.Builder(
- context, key, getKeyboard(), singleMoreKeyWithPreview,
+ context, key, getKeyboard(), isSingleMoreKeyWithPreview,
mKeyPreviewDrawParams.getVisibleWidth(),
mKeyPreviewDrawParams.getVisibleHeight(), newLabelPaint(key));
moreKeysKeyboard = builder.build();
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
index 353e07cf7..e0184d7f1 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
@@ -261,13 +261,13 @@ public final class MoreKeysKeyboard extends Keyboard {
* @param context the context of {@link MoreKeysKeyboardView}.
* @param key the {@link Key} that invokes more keys keyboard.
* @param keyboard the {@link Keyboard} that contains the parentKey.
- * @param singleMoreKeyWithPreview true if the <code>key</code> has only one more key
- * and key popup preview is enabled.
+ * @param isSingleMoreKeyWithPreview true if the <code>key</code> has just a single
+ * "more key" and its key popup preview is enabled.
* @param keyPreviewDrawParams the parameter to place key preview.
- * @param paintToMeasure the {@link Paint} object to measure a more key width
+ * @param paintToMeasure the {@link Paint} object to measure a "more key" width
*/
public Builder(final Context context, final Key key, final Keyboard keyboard,
- final boolean singleMoreKeyWithPreview, final int keyPreviewVisibleWidth,
+ final boolean isSingleMoreKeyWithPreview, final int keyPreviewVisibleWidth,
final int keyPreviewVisibleHeight, final Paint paintToMeasure) {
super(context, new MoreKeysKeyboardParams());
load(keyboard.mMoreKeysTemplate, keyboard.mId);
@@ -275,10 +275,11 @@ public final class MoreKeysKeyboard extends Keyboard {
// TODO: More keys keyboard's vertical gap is currently calculated heuristically.
// Should revise the algorithm.
mParams.mVerticalGap = keyboard.mVerticalGap / 2;
+ // This {@link MoreKeysKeyboard} is invoked from the <code>key</code>.
mParentKey = key;
final int keyWidth, rowHeight;
- if (singleMoreKeyWithPreview) {
+ if (isSingleMoreKeyWithPreview) {
// Use pre-computed width and height if this more keys keyboard has only one key to
// mitigate visual flicker between key preview and more keys keyboard.
// Caveats for the visual assets: To achieve this effect, both the key preview
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
index 6fc300beb..cd29c8d17 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
@@ -105,7 +105,7 @@ public final class KeyPreviewChoreographer {
mFreeKeyPreviewViews.add(keyPreviewView);
}
- public void placeKeyPreviewAndShow(final Key key, final KeyboardIconsSet iconsSet,
+ public void placeAndShowKeyPreview(final Key key, final KeyboardIconsSet iconsSet,
final KeyDrawParams drawParams, final int keyboardViewWidth, final int[] keyboardOrigin,
final ViewGroup placerView, final boolean withAnimation) {
final KeyPreviewView keyPreviewView = getKeyPreviewView(key, placerView);
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
index 9d824121c..689f878be 100644
--- a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
@@ -126,9 +126,17 @@ public final class SettingsFragment extends InputMethodSettingsFragment
final PreferenceScreen inputScreen =
(PreferenceScreen) findPreference(Settings.SCREEN_INPUT);
+ final PreferenceScreen multiLingualScreen =
+ (PreferenceScreen) findPreference(Settings.SCREEN_MULTI_LINGUAL);
+ final PreferenceScreen gestureScreen =
+ (PreferenceScreen) findPreference(Settings.SCREEN_GESTURE);
+ final PreferenceScreen correctionScreen =
+ (PreferenceScreen) findPreference(Settings.SCREEN_CORRECTION);
final PreferenceScreen advancedScreen =
(PreferenceScreen) findPreference(Settings.SCREEN_ADVANCED);
- final Preference debugScreen = findPreference(Settings.SCREEN_DEBUG);
+ final PreferenceScreen debugScreen =
+ (PreferenceScreen) findPreference(Settings.SCREEN_DEBUG);
+
if (Settings.isInternal(prefs)) {
final Intent debugSettingsIntent = new Intent(Intent.ACTION_MAIN);
debugSettingsIntent.setClassName(
@@ -149,8 +157,6 @@ public final class SettingsFragment extends InputMethodSettingsFragment
removePreference(Settings.PREF_VIBRATION_DURATION_SETTINGS, advancedScreen);
}
if (!Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS) {
- final PreferenceScreen multiLingualScreen =
- (PreferenceScreen) findPreference(Settings.SCREEN_MULTI_LINGUAL);
removePreference(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, multiLingualScreen);
removePreference(
Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, multiLingualScreen);
@@ -185,8 +191,6 @@ public final class SettingsFragment extends InputMethodSettingsFragment
removePreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON, advancedScreen);
}
- final PreferenceScreen correctionScreen =
- (PreferenceScreen) findPreference(Settings.SCREEN_CORRECTION);
final PreferenceScreen dictionaryLink =
(PreferenceScreen) findPreference(Settings.PREF_CONFIGURE_DICTIONARIES_KEY);
final Intent intent = dictionaryLink.getIntent();
@@ -221,7 +225,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment
}
if (!Settings.readFromBuildConfigIfGestureInputEnabled(res)) {
- removePreference(Settings.SCREEN_GESTURE, getPreferenceScreen());
+ getPreferenceScreen().removePreference(gestureScreen);
}
AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this);
@@ -462,13 +466,14 @@ public final class SettingsFragment extends InputMethodSettingsFragment
@Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
- if (!FeedbackUtils.isFeedbackFormSupported()) {
- return;
+ if (FeedbackUtils.isFeedbackFormSupported()) {
+ menu.add(NO_MENU_GROUP, MENU_FEEDBACK /* itemId */, MENU_FEEDBACK /* order */,
+ R.string.send_feedback);
+ }
+ final int aboutResId = FeedbackUtils.getAboutKeyboardTitleResId();
+ if (aboutResId != 0) {
+ menu.add(NO_MENU_GROUP, MENU_ABOUT /* itemId */, MENU_ABOUT /* order */, aboutResId);
}
- menu.add(NO_MENU_GROUP, MENU_FEEDBACK /* itemId */, MENU_FEEDBACK /* order */,
- R.string.send_feedback);
- menu.add(NO_MENU_GROUP, MENU_ABOUT /* itemId */, MENU_ABOUT /* order */,
- FeedbackUtils.getAboutKeyboardTitleResId());
}
@Override
@@ -479,8 +484,11 @@ public final class SettingsFragment extends InputMethodSettingsFragment
return true;
}
if (itemId == MENU_ABOUT) {
- startActivity(FeedbackUtils.getAboutKeyboardIntent(getActivity()));
- return true;
+ final Intent aboutIntent = FeedbackUtils.getAboutKeyboardIntent(getActivity());
+ if (aboutIntent != null) {
+ startActivity(aboutIntent);
+ return true;
+ }
}
return super.onOptionsItemSelected(item);
}