aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java25
-rw-r--r--java/src/com/android/inputmethod/latin/DicTraverseSession.java14
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java1
3 files changed, 23 insertions, 17 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index b8eb9ec96..fcf97b99c 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -111,8 +111,6 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
// Drawing
/** True if the entire keyboard needs to be dimmed. */
private boolean mNeedsToDimEntireKeyboard;
- /** Whether the keyboard bitmap buffer needs to be redrawn before it's blitted. **/
- private boolean mBufferNeedsUpdate;
/** True if all keys should be drawn */
private boolean mInvalidateAllKeys;
/** The keys that should be drawn */
@@ -459,8 +457,9 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
onDrawKeyboard(canvas);
return;
}
- if (mBufferNeedsUpdate || mOffscreenBuffer == null) {
- mBufferNeedsUpdate = false;
+
+ final boolean bufferNeedsUpdates = mInvalidateAllKeys || !mInvalidatedKeys.isEmpty();
+ if (bufferNeedsUpdates || mOffscreenBuffer == null) {
if (maybeAllocateOffscreenBuffer()) {
mInvalidateAllKeys = true;
// TODO: Stop using the offscreen canvas even when in software rendering
@@ -524,13 +523,12 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
if (!isHardwareAccelerated) {
canvas.clipRegion(mClipRegion, Region.Op.REPLACE);
- }
-
- // Draw keyboard background.
- canvas.drawColor(Color.BLACK, PorterDuff.Mode.CLEAR);
- final Drawable background = getBackground();
- if (background != null) {
- background.draw(canvas);
+ // Draw keyboard background.
+ canvas.drawColor(Color.BLACK, PorterDuff.Mode.CLEAR);
+ final Drawable background = getBackground();
+ if (background != null) {
+ background.draw(canvas);
+ }
}
// TODO: Confirm if it's really required to draw all keys when hardware acceleration is on.
@@ -1048,7 +1046,6 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
public void invalidateAllKeys() {
mInvalidatedKeys.clear();
mInvalidateAllKeys = true;
- mBufferNeedsUpdate = true;
invalidate();
}
@@ -1066,9 +1063,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
mInvalidatedKeys.add(key);
final int x = key.mX + getPaddingLeft();
final int y = key.mY + getPaddingTop();
- mWorkingRect.set(x, y, x + key.mWidth, y + key.mHeight);
- mBufferNeedsUpdate = true;
- invalidate(mWorkingRect);
+ invalidate(x, y, x + key.mWidth, y + key.mHeight);
}
public void closing() {
diff --git a/java/src/com/android/inputmethod/latin/DicTraverseSession.java b/java/src/com/android/inputmethod/latin/DicTraverseSession.java
index ae68e69dd..437876e05 100644
--- a/java/src/com/android/inputmethod/latin/DicTraverseSession.java
+++ b/java/src/com/android/inputmethod/latin/DicTraverseSession.java
@@ -22,20 +22,30 @@ public class DicTraverseSession {
static {
JniUtils.loadNativeLibrary();
}
+ private native long setDicTraverseSessionNative(String locale);
+ private native void initDicTraverseSessionNative(
+ long nativeDicTraverseSession, int[] previousWord, int previwousWordLength);
+ private native void releaseDicTraverseSessionNative(long nativeDicTraverseSession);
private long mNativeDicTraverseSession;
public DicTraverseSession(Locale locale) {
mNativeDicTraverseSession = createNativeDicTraverseSession(
locale != null ? locale.toString() : "");
+ initSession();
}
public long getSession() {
return mNativeDicTraverseSession;
}
- private native long setDicTraverseSessionNative(String locale);
- private native void releaseDicTraverseSessionNative(long nativeDicTraverseSession);
+ public void initSession() {
+ initSession(null, 0);
+ }
+
+ public void initSession(int[] previousWord, int previousWordLength) {
+ initDicTraverseSessionNative(mNativeDicTraverseSession, previousWord, previousWordLength);
+ }
private final long createNativeDicTraverseSession(String locale) {
return setDicTraverseSessionNative(locale);
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 894b69b79..e0dbb8e6e 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -722,6 +722,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mHandler.cancelUpdateSuggestionStrip();
mHandler.cancelDoubleSpacesTimer();
+ mainKeyboardView.setMainDictionaryAvailability(mIsMainDictionaryAvailable);
mainKeyboardView.setKeyPreviewPopupEnabled(mCurrentSettings.mKeyPreviewPopupOn,
mCurrentSettings.mKeyPreviewPopupDismissDelay);
mainKeyboardView.setGestureHandlingEnabledByUser(mCurrentSettings.mGestureInputEnabled);