aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/drawable-hdpi/more_suggestions_hint.pngbin242 -> 0 bytes
-rw-r--r--java/res/drawable-hdpi/more_suggestions_hint_holo.pngbin242 -> 0 bytes
-rw-r--r--java/res/drawable-mdpi/more_suggestions_hint.pngbin222 -> 0 bytes
-rw-r--r--java/res/drawable-mdpi/more_suggestions_hint_holo.pngbin222 -> 0 bytes
-rw-r--r--java/res/drawable-xhdpi/more_suggestions_hint.pngbin310 -> 0 bytes
-rw-r--r--java/res/drawable-xhdpi/more_suggestions_hint_holo.pngbin310 -> 0 bytes
-rw-r--r--java/res/drawable/btn_keyboard_key_gingerbread.xml9
-rw-r--r--java/res/drawable/btn_keyboard_key_stone.xml9
-rw-r--r--java/res/values-sw600dp/dimens.xml1
-rw-r--r--java/res/values-sw768dp/dimens.xml1
-rw-r--r--java/res/values/attrs.xml1
-rw-r--r--java/res/values/dimens.xml1
-rw-r--r--java/res/values/donottranslate.xml15
-rw-r--r--java/res/values/keypress-vibration-durations.xml26
-rw-r--r--java/res/values/styles.xml2
-rw-r--r--java/res/values/sudden-jumping-touch-event-device-list.xml2
-rw-r--r--java/res/xml/prefs_for_debug.xml2
-rw-r--r--java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java10
-rw-r--r--java/src/com/android/inputmethod/compat/VibratorCompatWrapper.java4
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java31
-rw-r--r--java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java2
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java74
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestionsView.java27
-rw-r--r--java/src/com/android/inputmethod/latin/WordComposer.java2
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java44
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/DictionaryPool.java9
26 files changed, 186 insertions, 86 deletions
diff --git a/java/res/drawable-hdpi/more_suggestions_hint.png b/java/res/drawable-hdpi/more_suggestions_hint.png
deleted file mode 100644
index 93604752b..000000000
--- a/java/res/drawable-hdpi/more_suggestions_hint.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-hdpi/more_suggestions_hint_holo.png b/java/res/drawable-hdpi/more_suggestions_hint_holo.png
deleted file mode 100644
index 93604752b..000000000
--- a/java/res/drawable-hdpi/more_suggestions_hint_holo.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-mdpi/more_suggestions_hint.png b/java/res/drawable-mdpi/more_suggestions_hint.png
deleted file mode 100644
index 7352810d3..000000000
--- a/java/res/drawable-mdpi/more_suggestions_hint.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-mdpi/more_suggestions_hint_holo.png b/java/res/drawable-mdpi/more_suggestions_hint_holo.png
deleted file mode 100644
index 7352810d3..000000000
--- a/java/res/drawable-mdpi/more_suggestions_hint_holo.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-xhdpi/more_suggestions_hint.png b/java/res/drawable-xhdpi/more_suggestions_hint.png
deleted file mode 100644
index 35fb42087..000000000
--- a/java/res/drawable-xhdpi/more_suggestions_hint.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-xhdpi/more_suggestions_hint_holo.png b/java/res/drawable-xhdpi/more_suggestions_hint_holo.png
deleted file mode 100644
index 35fb42087..000000000
--- a/java/res/drawable-xhdpi/more_suggestions_hint_holo.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable/btn_keyboard_key_gingerbread.xml b/java/res/drawable/btn_keyboard_key_gingerbread.xml
index 4a113a8a1..5b4399e1b 100644
--- a/java/res/drawable/btn_keyboard_key_gingerbread.xml
+++ b/java/res/drawable/btn_keyboard_key_gingerbread.xml
@@ -23,6 +23,13 @@
<item android:state_single="true"
android:drawable="@drawable/btn_keyboard_key_dark_normal" />
+ <!-- Action keys. -->
+
+ <item android:state_active="true" android:state_pressed="true"
+ android:drawable="@drawable/btn_keyboard_key_dark_pressed" />
+ <item android:state_active="true"
+ android:drawable="@drawable/btn_keyboard_key_dark_normal" />
+
<!-- Toggle keys. Use checkable/checked state. -->
<item android:state_checkable="true" android:state_checked="true" android:state_pressed="true"
@@ -34,7 +41,7 @@
<item android:state_checkable="true"
android:drawable="@drawable/btn_keyboard_key_dark_normal_off" />
- <!-- Normal keys -->
+ <!-- Normal keys. -->
<item android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_key_light_pressed" />
diff --git a/java/res/drawable/btn_keyboard_key_stone.xml b/java/res/drawable/btn_keyboard_key_stone.xml
index 27932e8da..9bc3f18d6 100644
--- a/java/res/drawable/btn_keyboard_key_stone.xml
+++ b/java/res/drawable/btn_keyboard_key_stone.xml
@@ -23,6 +23,13 @@
<item android:state_single="true"
android:drawable="@drawable/btn_keyboard_key_normal_stone" />
+ <!-- Action keys. -->
+
+ <item android:state_active="true" android:state_pressed="true"
+ android:drawable="@drawable/btn_keyboard_key_fulltrans_pressed" />
+ <item android:state_active="true"
+ android:drawable="@drawable/btn_keyboard_key_normal_stone" />
+
<!-- Toggle keys. Use checkable/checked state. -->
<item android:state_checkable="true" android:state_checked="true"
@@ -35,7 +42,7 @@
<item android:state_checkable="true"
android:drawable="@drawable/btn_keyboard_key_normal_off_stone" />
- <!-- Normal keys -->
+ <!-- Normal keys. -->
<item android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_key_fulltrans_pressed" />
diff --git a/java/res/values-sw600dp/dimens.xml b/java/res/values-sw600dp/dimens.xml
index d02b4eaad..e1bdecfd9 100644
--- a/java/res/values-sw600dp/dimens.xml
+++ b/java/res/values-sw600dp/dimens.xml
@@ -76,4 +76,5 @@
<dimen name="suggestion_min_width">0.3in</dimen>
<dimen name="suggestion_padding">12dip</dimen>
<dimen name="suggestion_text_size">22dip</dimen>
+ <dimen name="more_suggestions_hint_text_size">33dip</dimen>
</resources>
diff --git a/java/res/values-sw768dp/dimens.xml b/java/res/values-sw768dp/dimens.xml
index bfc2593db..b825b1457 100644
--- a/java/res/values-sw768dp/dimens.xml
+++ b/java/res/values-sw768dp/dimens.xml
@@ -79,4 +79,5 @@
<dimen name="suggestion_min_width">46dip</dimen>
<dimen name="suggestion_padding">8dip</dimen>
<dimen name="suggestion_text_size">22dip</dimen>
+ <dimen name="more_suggestions_hint_text_size">33dip</dimen>
</resources>
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 6e9461a33..e40cc95ab 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -132,7 +132,6 @@
<attr name="alphaObsoleted" format="integer" />
<attr name="suggestionsCountInStrip" format="integer" />
<attr name="centerSuggestionPercentile" format="integer" />
- <attr name="moreSuggestionsHint" format="reference" />
<attr name="maxMoreSuggestionsRow" format="integer" />
<attr name="minMoreSuggestionsWidth" format="float" />
</declare-styleable>
diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml
index 8488c777b..16cccc62a 100644
--- a/java/res/values/dimens.xml
+++ b/java/res/values/dimens.xml
@@ -92,6 +92,7 @@
<dimen name="suggestion_min_width">44dip</dimen>
<dimen name="suggestion_padding">6dip</dimen>
<dimen name="suggestion_text_size">18dip</dimen>
+ <dimen name="more_suggestions_hint_text_size">27dip</dimen>
<integer name="suggestions_count_in_strip">3</integer>
<integer name="center_suggestion_percentile">36</integer>
diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml
index 4072ea4b8..75e22ddd8 100644
--- a/java/res/values/donottranslate.xml
+++ b/java/res/values/donottranslate.xml
@@ -31,6 +31,21 @@
<!-- Word separator list is the union of all symbols except those that are not separators:
magic_space_swapping_symbols | magic_space_stripping_symbols |
magic_space_neutral_symbols \ symbols_excluded_from_word_separators -->
+ <!-- Symbol characters list that should switch back to the main layout -->
+ <!-- \u0022: Quotation mark (double quotation mark)
+ \u0027: Apostrophe (single quotation mark)
+ \u2018: Left single quotation mark
+ \u2019: Right single quotation mark
+ \u201a: Single low-9 quotation mark
+ \u201b: Single high-reversed-9 quotation mark
+ \u201c: Left double quotation mark
+ \u201d: Right double quotation mark
+ \u201e: Double low-9 quotation mark
+ \u201f: Double high-reversed-9 quotation mark
+ \u00ab: Left-pointing double angle quotation mark
+ \u00bb: Right-pointing double angle quotation mark -->
+ <!-- string name="layout_switch_back_symbols">\u0022\u0027\u2018\u2019\u201a\u201b\u201c\u201d\u201e\u201f\u00ab\u00bb</string> -->
+ <string name="layout_switch_back_symbols"></string>
<!-- Label for "switch to more symbol" modifier key. Must be short to fit on key! -->
<string name="label_to_more_symbol_key">= \\ &lt;</string>
diff --git a/java/res/values/keypress-vibration-durations.xml b/java/res/values/keypress-vibration-durations.xml
new file mode 100644
index 000000000..d50986629
--- /dev/null
+++ b/java/res/values/keypress-vibration-durations.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources>
+ <string-array name="keypress_vibration_durations" translatable="false">
+ <!-- Build.HARDWARE,duration_in_milliseconds -->
+ <item>herring,4</item>
+ <item>tuna,5</item>
+ </string-array>
+</resources>
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index 6aa967410..7b8bfa841 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -102,7 +102,6 @@
<item name="alphaObsoleted">50</item>
<item name="suggestionsCountInStrip">@integer/suggestions_count_in_strip</item>
<item name="centerSuggestionPercentile">@integer/center_suggestion_percentile</item>
- <item name="moreSuggestionsHint">@drawable/more_suggestions_hint</item>
<item name="maxMoreSuggestionsRow">@integer/max_more_suggestions_row</item>
<item name="minMoreSuggestionsWidth">@fraction/min_more_suggestions_width</item>
</style>
@@ -284,7 +283,6 @@
<item name="alphaObsoleted">70</item>
<item name="suggestionsCountInStrip">@integer/suggestions_count_in_strip</item>
<item name="centerSuggestionPercentile">@integer/center_suggestion_percentile</item>
- <item name="moreSuggestionsHint">@drawable/more_suggestions_hint_holo</item>
<item name="maxMoreSuggestionsRow">@integer/max_more_suggestions_row</item>
<item name="minMoreSuggestionsWidth">@fraction/min_more_suggestions_width</item>
</style>
diff --git a/java/res/values/sudden-jumping-touch-event-device-list.xml b/java/res/values/sudden-jumping-touch-event-device-list.xml
index af1eefc12..ba828a758 100644
--- a/java/res/values/sudden-jumping-touch-event-device-list.xml
+++ b/java/res/values/sudden-jumping-touch-event-device-list.xml
@@ -20,7 +20,7 @@
<resources>
<string-array name="sudden_jumping_touch_event_device_list" translatable="false">
<!-- Nexus One -->
- <item>passion</item>
+ <item>mahimahi</item>
<!-- Droid -->
<item>sholes</item>
</string-array>
diff --git a/java/res/xml/prefs_for_debug.xml b/java/res/xml/prefs_for_debug.xml
index 2dad17148..80613a56f 100644
--- a/java/res/xml/prefs_for_debug.xml
+++ b/java/res/xml/prefs_for_debug.xml
@@ -27,7 +27,7 @@
/>
<ListPreference
- android:key="pref_keyboard_layout_20100902"
+ android:key="pref_keyboard_layout_20110916"
android:title="@string/keyboard_layout"
android:persistent="true"
android:entryValues="@array/keyboard_layout_modes_values"
diff --git a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
index 194741087..bcdcef7dc 100644
--- a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
@@ -26,16 +26,12 @@ public class EditorInfoCompatUtils {
EditorInfo.class, "IME_FLAG_NAVIGATE_NEXT");
private static final Field FIELD_IME_FLAG_NAVIGATE_PREVIOUS = CompatUtils.getField(
EditorInfo.class, "IME_FLAG_NAVIGATE_PREVIOUS");
- private static final Field FIELD_IME_FLAG_NO_FULLSCREEN = CompatUtils.getField(
- EditorInfo.class, "IME_FLAG_NO_FULLSCREEN");
private static final Field FIELD_IME_ACTION_PREVIOUS = CompatUtils.getField(
EditorInfo.class, "IME_ACTION_PREVIOUS");
private static final Integer OBJ_IME_FLAG_NAVIGATE_NEXT = (Integer) CompatUtils
.getFieldValue(null, null, FIELD_IME_FLAG_NAVIGATE_NEXT);
private static final Integer OBJ_IME_FLAG_NAVIGATE_PREVIOUS = (Integer) CompatUtils
.getFieldValue(null, null, FIELD_IME_FLAG_NAVIGATE_PREVIOUS);
- private static final Integer OBJ_IME_FLAG_NO_FULLSCREEN = (Integer) CompatUtils
- .getFieldValue(null, null, FIELD_IME_FLAG_NO_FULLSCREEN);
private static final Integer OBJ_IME_ACTION_PREVIOUS = (Integer) CompatUtils
.getFieldValue(null, null, FIELD_IME_ACTION_PREVIOUS);
@@ -51,12 +47,6 @@ public class EditorInfoCompatUtils {
return (imeOptions & OBJ_IME_FLAG_NAVIGATE_PREVIOUS) != 0;
}
- public static boolean hasFlagNoFullscreen(int imeOptions) {
- if (FIELD_IME_FLAG_NO_FULLSCREEN == null)
- return false;
- return (imeOptions & OBJ_IME_FLAG_NO_FULLSCREEN) != 0;
- }
-
public static void performEditorActionNext(InputConnection ic) {
ic.performEditorAction(EditorInfo.IME_ACTION_NEXT);
}
diff --git a/java/src/com/android/inputmethod/compat/VibratorCompatWrapper.java b/java/src/com/android/inputmethod/compat/VibratorCompatWrapper.java
index a6304d877..2fb8b8710 100644
--- a/java/src/com/android/inputmethod/compat/VibratorCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/VibratorCompatWrapper.java
@@ -44,4 +44,8 @@ public class VibratorCompatWrapper {
return false;
return (Boolean) CompatUtils.invoke(mVibrator, true, METHOD_hasVibrator);
}
+
+ public void vibrate(long milliseconds) {
+ mVibrator.vibrate(milliseconds);
+ }
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index e43ae55a8..2d123699e 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -20,6 +20,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.ContextThemeWrapper;
@@ -48,7 +49,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private static final boolean DEBUG_CACHE = LatinImeLogger.sDBG;
public static final boolean DEBUG_STATE = false;
- public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20100902";
+ public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20110916";
private static final int[] KEYBOARD_THEMES = {
R.style.KeyboardTheme,
R.style.KeyboardTheme_HighContrast,
@@ -97,6 +98,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private static final int SWITCH_STATE_CHORDING_SYMBOL = 6;
private int mSwitchState = SWITCH_STATE_ALPHA;
+ private static String mLayoutSwitchBackSymbols;
+
private int mThemeIndex = -1;
private Context mThemeContext;
@@ -204,6 +207,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mMainKeyboardId = getKeyboardId(editorInfo, false, false, settingsValues);
mSymbolsKeyboardId = getKeyboardId(editorInfo, true, false, settingsValues);
mSymbolsShiftedKeyboardId = getKeyboardId(editorInfo, true, true, settingsValues);
+ mLayoutSwitchBackSymbols = mResources.getString(R.string.layout_switch_back_symbols);
setKeyboard(getKeyboard(mSavedKeyboardState.getKeyboardId()));
} catch (RuntimeException e) {
Log.w(TAG, "loading keyboard failed: " + mMainKeyboardId, e);
@@ -661,24 +665,9 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
return c == Keyboard.CODE_SPACE || c == Keyboard.CODE_ENTER;
}
- private static boolean isQuoteCharacter(int c) {
- // Apostrophe, quotation mark.
- if (c == Keyboard.CODE_SINGLE_QUOTE || c == Keyboard.CODE_DOUBLE_QUOTE)
- return true;
- // \u2018: Left single quotation mark
- // \u2019: Right single quotation mark
- // \u201a: Single low-9 quotation mark
- // \u201b: Single high-reversed-9 quotation mark
- // \u201c: Left double quotation mark
- // \u201d: Right double quotation mark
- // \u201e: Double low-9 quotation mark
- // \u201f: Double high-reversed-9 quotation mark
- if (c >= '\u2018' && c <= '\u201f')
- return true;
- // \u00ab: Left-pointing double angle quotation mark
- // \u00bb: Right-pointing double angle quotation mark
- if (c == '\u00ab' || c == '\u00bb')
- return true;
+ private static boolean isLayoutSwitchBackCharacter(int c) {
+ if (TextUtils.isEmpty(mLayoutSwitchBackSymbols)) return false;
+ if (mLayoutSwitchBackSymbols.indexOf(c) >= 0) return true;
return false;
}
@@ -736,7 +725,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mSwitchState = SWITCH_STATE_SYMBOL;
}
// Snap back to alpha keyboard mode immediately if user types a quote character.
- if (isQuoteCharacter(code)) {
+ if (isLayoutSwitchBackCharacter(code)) {
changeKeyboardMode();
}
break;
@@ -744,7 +733,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
case SWITCH_STATE_CHORDING_SYMBOL:
// Snap back to alpha keyboard mode if user types one or more non-space/enter
// characters followed by a space/enter or a quote character.
- if (isSpaceCharacter(code) || isQuoteCharacter(code)) {
+ if (isSpaceCharacter(code) || isLayoutSwitchBackCharacter(code)) {
changeKeyboardMode();
}
break;
diff --git a/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java b/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java
index c4251ccfc..62a9259f9 100644
--- a/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java
+++ b/java/src/com/android/inputmethod/keyboard/SuddenJumpingTouchEventHandler.java
@@ -51,7 +51,7 @@ public class SuddenJumpingTouchEventHandler {
mView = view;
final String[] deviceList = context.getResources().getStringArray(
R.array.sudden_jumping_touch_event_device_list);
- mNeedsSuddenJumpingHack = needsSuddenJumpingHack(Build.DEVICE, deviceList);
+ mNeedsSuddenJumpingHack = needsSuddenJumpingHack(Build.HARDWARE, deviceList);
}
private static boolean needsSuddenJumpingHack(String deviceName, String[] deviceList) {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index fdf58f6ef..733817edf 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -28,6 +28,7 @@ import android.content.res.Resources;
import android.inputmethodservice.InputMethodService;
import android.media.AudioManager;
import android.net.ConnectivityManager;
+import android.os.Build;
import android.os.Debug;
import android.os.Message;
import android.os.SystemClock;
@@ -56,6 +57,7 @@ import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
import com.android.inputmethod.compat.InputMethodServiceCompatWrapper;
import com.android.inputmethod.compat.InputTypeCompatUtils;
import com.android.inputmethod.compat.SuggestionSpanUtils;
+import com.android.inputmethod.compat.VibratorCompatWrapper;
import com.android.inputmethod.deprecated.LanguageSwitcherProxy;
import com.android.inputmethod.deprecated.VoiceProxy;
import com.android.inputmethod.deprecated.recorrection.Recorrection;
@@ -158,7 +160,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private View mKeyPreviewBackingView;
private View mSuggestionsContainer;
- private int mSuggestionsStripHeight;
private SuggestionsView mSuggestionsView;
private Suggest mSuggest;
private CompletionInfo[] mApplicationSpecifiedCompletions;
@@ -211,6 +212,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private static float mFxVolume = -1.0f; // just a default value to be updated runtime
private boolean mSilentModeOn; // System-wide current configuration
+ private VibratorCompatWrapper mVibrator;
+ private long mKeypressVibrationDuration = -1;
+
// TODO: Move this flag to VoiceProxy
private boolean mConfigurationChanging;
@@ -434,13 +438,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mSubtypeSwitcher = SubtypeSwitcher.getInstance();
mKeyboardSwitcher = KeyboardSwitcher.getInstance();
mRecorrection = Recorrection.getInstance();
+ mVibrator = VibratorCompatWrapper.getInstance(this);
DEBUG = LatinImeLogger.sDBG;
- loadSettings();
-
final Resources res = getResources();
mResources = res;
+ loadSettings();
+
Utils.GCUtils.getInstance().reset();
boolean tryGC = true;
for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
@@ -481,6 +486,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mSettingsValues = new Settings.Values(mPrefs, this, mSubtypeSwitcher.getInputLocaleStr());
resetContactsDictionary(null == mSuggest ? null : mSuggest.getContactsDictionary());
updateSoundEffectVolume();
+ updateKeypressVibrationDuration();
}
private void initSuggest() {
@@ -612,7 +618,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mSuggestionsView = (SuggestionsView) view.findViewById(R.id.suggestions_view);
if (mSuggestionsView != null)
mSuggestionsView.setListener(this, view);
- mSuggestionsStripHeight = (int)mResources.getDimension(R.dimen.suggestions_strip_height);
}
@Override
@@ -681,6 +686,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (mSuggestionsView != null)
mSuggestionsView.clear();
+ // The EditorInfo might have a flag that affects fullscreen mode.
+ updateFullscreenMode();
setSuggestionStripShownInternal(
isSuggestionsStripVisible(), /* needsInputViewShown */ false);
// Delay updating suggestions because keyboard input view may not be shown at this point.
@@ -945,14 +952,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
final boolean shouldShowSuggestions = shown
&& (needsInputViewShown ? mKeyboardSwitcher.isInputViewShown() : true);
if (isFullscreenMode()) {
- // No need to have extra space to show the key preview.
- mKeyPreviewBackingView.setVisibility(View.GONE);
mSuggestionsContainer.setVisibility(
shouldShowSuggestions ? View.VISIBLE : View.GONE);
} else {
- // We must control the visibility of the suggestion strip in order to avoid clipped
- // key previews, even when we don't show the suggestion strip.
- mKeyPreviewBackingView.setVisibility(View.VISIBLE);
mSuggestionsContainer.setVisibility(
shouldShowSuggestions ? View.VISIBLE : View.INVISIBLE);
}
@@ -971,12 +973,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return;
final int backingHeight = (mKeyPreviewBackingView.getVisibility() == View.GONE) ? 0
: mKeyPreviewBackingView.getHeight();
- final int extraHeight = mSuggestionsContainer.getHeight() + backingHeight;
+ final int suggestionsHeight = (mSuggestionsContainer.getVisibility() == View.GONE) ? 0
+ : mSuggestionsContainer.getHeight();
+ final int extraHeight = backingHeight + suggestionsHeight;
int touchY = extraHeight;
// Need to set touchable region only if input view is being shown
if (mKeyboardSwitcher.isInputViewShown()) {
if (mSuggestionsContainer.getVisibility() == View.VISIBLE) {
- touchY -= mSuggestionsStripHeight;
+ touchY -= suggestionsHeight;
}
final int touchWidth = inputView.getWidth();
final int touchHeight = inputView.getHeight() + extraHeight
@@ -994,16 +998,18 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override
public boolean onEvaluateFullscreenMode() {
- final EditorInfo ei = getCurrentInputEditorInfo();
- if (ei != null) {
- final int imeOptions = ei.imeOptions;
- if (EditorInfoCompatUtils.hasFlagNoFullscreen(imeOptions))
- return false;
- if ((imeOptions & EditorInfo.IME_FLAG_NO_EXTRACT_UI) != 0)
- return false;
- }
+ return super.onEvaluateFullscreenMode()
+ && mResources.getBoolean(R.bool.config_use_fullscreen_mode);
+ }
+
+ @Override
+ public void updateFullscreenMode() {
+ super.updateFullscreenMode();
- return mResources.getBoolean(R.bool.config_use_fullscreen_mode);
+ if (mKeyPreviewBackingView == null) return;
+ // In fullscreen mode, no need to have extra space to show the key preview.
+ // If not, we should have extra space above the keyboard to show the key preview.
+ mKeyPreviewBackingView.setVisibility(isFullscreenMode() ? View.GONE : View.VISIBLE);
}
@Override
@@ -2062,6 +2068,19 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mSilentModeOn = (mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL);
}
+ private void updateKeypressVibrationDuration() {
+ final String[] durationPerHardwareList = mResources.getStringArray(
+ R.array.keypress_vibration_durations);
+ final String hardwarePrefix = Build.HARDWARE + ",";
+ for (final String element : durationPerHardwareList) {
+ if (element.startsWith(hardwarePrefix)) {
+ mKeypressVibrationDuration =
+ Long.parseLong(element.substring(element.lastIndexOf(',') + 1));
+ break;
+ }
+ }
+ }
+
private void playKeyClick(int primaryCode) {
// if mAudioManager is null, we don't have the ringer state yet
// mAudioManager will be set by updateRingerMode
@@ -2091,11 +2110,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (!mSettingsValues.mVibrateOn) {
return;
}
- LatinKeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
- if (inputView != null) {
- inputView.performHapticFeedback(
- HapticFeedbackConstants.KEYBOARD_TAP,
- HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
+ if (mKeypressVibrationDuration < 0) {
+ // Go ahead with the system default
+ LatinKeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
+ if (inputView != null) {
+ inputView.performHapticFeedback(
+ HapticFeedbackConstants.KEYBOARD_TAP,
+ HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
+ }
+ } else if (mVibrator != null) {
+ mVibrator.vibrate(mKeypressVibrationDuration);
}
}
diff --git a/java/src/com/android/inputmethod/latin/SuggestionsView.java b/java/src/com/android/inputmethod/latin/SuggestionsView.java
index 13beb4479..6fc790030 100644
--- a/java/src/com/android/inputmethod/latin/SuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/SuggestionsView.java
@@ -19,8 +19,14 @@ package com.android.inputmethod.latin;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Paint.Align;
+import android.graphics.Rect;
import android.graphics.Typeface;
+import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Message;
import android.os.SystemClock;
@@ -167,6 +173,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
private final float mCenterSuggestionWeight;
private final int mCenterSuggestionIndex;
private final Drawable mMoreSuggestionsHint;
+ private static final String MORE_SUGGESTIONS_HINT = "\u2026";
private static final CharacterStyle BOLD_SPAN = new StyleSpan(Typeface.BOLD);
private static final CharacterStyle UNDERLINE_SPAN = new UnderlineSpan();
@@ -225,7 +232,6 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
mCenterSuggestionWeight = getPercent(a,
R.styleable.SuggestionsView_centerSuggestionPercentile,
DEFAULT_CENTER_SUGGESTION_PERCENTILE);
- mMoreSuggestionsHint = a.getDrawable(R.styleable.SuggestionsView_moreSuggestionsHint);
mMaxMoreSuggestionsRow = a.getInt(
R.styleable.SuggestionsView_maxMoreSuggestionsRow,
DEFAULT_MAX_MORE_SUGGESTIONS_ROW);
@@ -233,6 +239,8 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
R.styleable.SuggestionsView_minMoreSuggestionsWidth);
a.recycle();
+ mMoreSuggestionsHint = getMoreSuggestionsHint(res,
+ res.getDimension(R.dimen.more_suggestions_hint_text_size), mColorAutoCorrect);
mCenterSuggestionIndex = mSuggestionsCountInStrip / 2;
mMoreSuggestionsBottomGap = res.getDimensionPixelOffset(
R.dimen.more_suggestions_bottom_gap);
@@ -246,6 +254,23 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
mHintToSaveText = context.getText(R.string.hint_add_to_dictionary);
}
+ private static Drawable getMoreSuggestionsHint(Resources res, float textSize, int color) {
+ final Paint paint = new Paint();
+ paint.setAntiAlias(true);
+ paint.setTextAlign(Align.CENTER);
+ paint.setTextSize(textSize);
+ paint.setColor(color);
+ final Rect bounds = new Rect();
+ paint.getTextBounds(MORE_SUGGESTIONS_HINT, 0, 1, bounds);
+ final int width = Math.round(bounds.width() + 0.5f);
+ final int height = Math.round(bounds.height() + 0.5f);
+ final Bitmap buffer = Bitmap.createBitmap(
+ width, (height * 3 / 2), Bitmap.Config.ARGB_8888);
+ final Canvas canvas = new Canvas(buffer);
+ canvas.drawText(MORE_SUGGESTIONS_HINT, width / 2, height, paint);
+ return new BitmapDrawable(res, buffer);
+ }
+
// Read integer value in TypedArray as percent.
private static float getPercent(TypedArray a, int index, int defValue) {
return a.getInt(index, defValue) / 100.0f;
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index a79e6dc7f..adc5637f6 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -106,7 +106,7 @@ public class WordComposer {
private static boolean isFirstCharCapitalized(int index, int codePoint, boolean previous) {
if (index == 0) return Character.isUpperCase(codePoint);
- return previous && Character.isLowerCase(codePoint);
+ return previous && !Character.isUpperCase(codePoint);
}
/**
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index 1e5b87763..915c40572 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -60,8 +60,11 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
private static final int CAPITALIZE_ALL = 2; // All caps
private final static String[] EMPTY_STRING_ARRAY = new String[0];
- private final static SuggestionsInfo EMPTY_SUGGESTIONS_INFO =
+ private final static SuggestionsInfo NOT_IN_DICT_EMPTY_SUGGESTIONS =
new SuggestionsInfo(0, EMPTY_STRING_ARRAY);
+ private final static SuggestionsInfo IN_DICT_EMPTY_SUGGESTIONS =
+ new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY,
+ EMPTY_STRING_ARRAY);
private Map<String, DictionaryPool> mDictionaryPools =
Collections.synchronizedMap(new TreeMap<String, DictionaryPool>());
private Map<String, Dictionary> mUserDictionaries =
@@ -330,7 +333,12 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
try {
final String text = textInfo.getText();
- if (shouldFilterOut(text)) return EMPTY_SUGGESTIONS_INFO;
+ if (shouldFilterOut(text)) {
+ final DictAndProximity dictInfo = mDictionaryPool.takeOrGetNull();
+ if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS;
+ return dictInfo.mDictionary.isValidWord(text) ? IN_DICT_EMPTY_SUGGESTIONS
+ : NOT_IN_DICT_EMPTY_SUGGESTIONS;
+ }
final SuggestionsGatherer suggestionsGatherer =
new SuggestionsGatherer(suggestionsLimit);
@@ -353,23 +361,19 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
final int capitalizeType = getCapitalizationType(text);
boolean isInDict = true;
- try {
- final DictAndProximity dictInfo = mDictionaryPool.take();
- dictInfo.mDictionary.getWords(composer, suggestionsGatherer,
- dictInfo.mProximityInfo);
- isInDict = dictInfo.mDictionary.isValidWord(text);
- if (!isInDict && CAPITALIZE_NONE != capitalizeType) {
- // We want to test the word again if it's all caps or first caps only.
- // If it's fully down, we already tested it, if it's mixed case, we don't
- // want to test a lowercase version of it.
- isInDict = dictInfo.mDictionary.isValidWord(text.toLowerCase(mLocale));
- }
- if (!mDictionaryPool.offer(dictInfo)) {
- Log.e(TAG, "Can't re-insert a dictionary into its pool");
- }
- } catch (InterruptedException e) {
- // I don't think this can happen.
- return EMPTY_SUGGESTIONS_INFO;
+ final DictAndProximity dictInfo = mDictionaryPool.takeOrGetNull();
+ if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS;
+ dictInfo.mDictionary.getWords(composer, suggestionsGatherer,
+ dictInfo.mProximityInfo);
+ isInDict = dictInfo.mDictionary.isValidWord(text);
+ if (!isInDict && CAPITALIZE_NONE != capitalizeType) {
+ // We want to test the word again if it's all caps or first caps only.
+ // If it's fully down, we already tested it, if it's mixed case, we don't
+ // want to test a lowercase version of it.
+ isInDict = dictInfo.mDictionary.isValidWord(text.toLowerCase(mLocale));
+ }
+ if (!mDictionaryPool.offer(dictInfo)) {
+ Log.e(TAG, "Can't re-insert a dictionary into its pool");
}
final SuggestionsGatherer.Result result = suggestionsGatherer.getResults(text,
@@ -396,7 +400,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
throw e;
} else {
Log.e(TAG, "Exception while spellcheking: " + e);
- return EMPTY_SUGGESTIONS_INFO;
+ return NOT_IN_DICT_EMPTY_SUGGESTIONS;
}
}
}
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/DictionaryPool.java b/java/src/com/android/inputmethod/latin/spellcheck/DictionaryPool.java
index ee294f6b0..dec18c1d5 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/DictionaryPool.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/DictionaryPool.java
@@ -56,6 +56,15 @@ public class DictionaryPool extends LinkedBlockingQueue<DictAndProximity> {
}
}
+ // Convenience method
+ public DictAndProximity takeOrGetNull() {
+ try {
+ return take();
+ } catch (InterruptedException e) {
+ return null;
+ }
+ }
+
public void close() {
synchronized(this) {
mClosed = true;