Merge change 1114 into donut
* changes: Fix keyboard redraw bug on long-press of CapsLock.
This commit is contained in:
@@ -61016,6 +61016,30 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="invalidateAllKeys"
|
||||||
|
return="void"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</method>
|
||||||
|
<method name="invalidateKey"
|
||||||
|
return="void"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="keyIndex" type="int">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
<method name="isPreviewEnabled"
|
<method name="isPreviewEnabled"
|
||||||
return="boolean"
|
return="boolean"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ public class KeyboardView extends View implements View.OnClickListener {
|
|||||||
// Release buffer, just in case the new keyboard has a different size.
|
// Release buffer, just in case the new keyboard has a different size.
|
||||||
// It will be reallocated on the next draw.
|
// It will be reallocated on the next draw.
|
||||||
mBuffer = null;
|
mBuffer = null;
|
||||||
invalidateAll();
|
invalidateAllKeys();
|
||||||
computeProximityThreshold(keyboard);
|
computeProximityThreshold(keyboard);
|
||||||
mMiniKeyboardCache.clear(); // Not really necessary to do every time, but will free up views
|
mMiniKeyboardCache.clear(); // Not really necessary to do every time, but will free up views
|
||||||
}
|
}
|
||||||
@@ -431,7 +431,7 @@ public class KeyboardView extends View implements View.OnClickListener {
|
|||||||
if (mKeyboard != null) {
|
if (mKeyboard != null) {
|
||||||
if (mKeyboard.setShifted(shifted)) {
|
if (mKeyboard.setShifted(shifted)) {
|
||||||
// The whole keyboard probably needs to be redrawn
|
// The whole keyboard probably needs to be redrawn
|
||||||
invalidateAll();
|
invalidateAllKeys();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -573,7 +573,7 @@ public class KeyboardView extends View implements View.OnClickListener {
|
|||||||
if (mBuffer == null) {
|
if (mBuffer == null) {
|
||||||
mBuffer = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
|
mBuffer = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
|
||||||
mCanvas = new Canvas(mBuffer);
|
mCanvas = new Canvas(mBuffer);
|
||||||
invalidateAll();
|
invalidateAllKeys();
|
||||||
}
|
}
|
||||||
final Canvas canvas = mCanvas;
|
final Canvas canvas = mCanvas;
|
||||||
canvas.clipRect(mDirtyRect, Op.REPLACE);
|
canvas.clipRect(mDirtyRect, Op.REPLACE);
|
||||||
@@ -874,13 +874,27 @@ public class KeyboardView extends View implements View.OnClickListener {
|
|||||||
mPreviewText.setVisibility(VISIBLE);
|
mPreviewText.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invalidateAll() {
|
/**
|
||||||
|
* Requests a redraw of the entire keyboard. Calling {@link #invalidate} is not sufficient
|
||||||
|
* because the keyboard renders the keys to an off-screen buffer and an invalidate() only
|
||||||
|
* draws the cached buffer.
|
||||||
|
* @see #invalidateKey(int)
|
||||||
|
*/
|
||||||
|
public void invalidateAllKeys() {
|
||||||
mDirtyRect.union(0, 0, getWidth(), getHeight());
|
mDirtyRect.union(0, 0, getWidth(), getHeight());
|
||||||
mDrawPending = true;
|
mDrawPending = true;
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invalidateKey(int keyIndex) {
|
/**
|
||||||
|
* Invalidates a key so that it will be redrawn on the next repaint. Use this method if only
|
||||||
|
* one key is changing it's content. Any changes that affect the position or size of the key
|
||||||
|
* may not be honored.
|
||||||
|
* @param keyIndex the index of the key in the attached {@link Keyboard}.
|
||||||
|
* @see #invalidateAllKeys
|
||||||
|
*/
|
||||||
|
public void invalidateKey(int keyIndex) {
|
||||||
|
if (mKeys == null) return;
|
||||||
if (keyIndex < 0 || keyIndex >= mKeys.length) {
|
if (keyIndex < 0 || keyIndex >= mKeys.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -991,7 +1005,7 @@ public class KeyboardView extends View implements View.OnClickListener {
|
|||||||
mPopupKeyboard.showAtLocation(this, Gravity.NO_GRAVITY, x, y);
|
mPopupKeyboard.showAtLocation(this, Gravity.NO_GRAVITY, x, y);
|
||||||
mMiniKeyboardOnScreen = true;
|
mMiniKeyboardOnScreen = true;
|
||||||
//mMiniKeyboard.onTouchEvent(getTranslatedEvent(me));
|
//mMiniKeyboard.onTouchEvent(getTranslatedEvent(me));
|
||||||
invalidateAll();
|
invalidateAllKeys();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -1164,7 +1178,7 @@ public class KeyboardView extends View implements View.OnClickListener {
|
|||||||
if (mPopupKeyboard.isShowing()) {
|
if (mPopupKeyboard.isShowing()) {
|
||||||
mPopupKeyboard.dismiss();
|
mPopupKeyboard.dismiss();
|
||||||
mMiniKeyboardOnScreen = false;
|
mMiniKeyboardOnScreen = false;
|
||||||
invalidateAll();
|
invalidateAllKeys();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user