am 75c4b5fe
: am 5ad37baf
: Merge "Release bitmap buffer when KeyboardView is detached from Window" into ics-mr0
* commit '75c4b5fe1bbc7736d05abd7940825a30339c65fc': Release bitmap buffer when KeyboardView is detached from Window
This commit is contained in:
commit
432fa42cb0
2 changed files with 12 additions and 8 deletions
|
@ -974,5 +974,9 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
if (mPreviewPlacer != null) {
|
if (mPreviewPlacer != null) {
|
||||||
mPreviewPlacer.removeAllViews();
|
mPreviewPlacer.removeAllViews();
|
||||||
}
|
}
|
||||||
|
if (mBuffer != null) {
|
||||||
|
mBuffer.recycle();
|
||||||
|
mBuffer = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,8 @@ public class LatinKeyboard extends Keyboard {
|
||||||
private final int mSpacebarTextColor;
|
private final int mSpacebarTextColor;
|
||||||
private final int mSpacebarTextShadowColor;
|
private final int mSpacebarTextShadowColor;
|
||||||
private float mSpacebarTextFadeFactor = 0.0f;
|
private float mSpacebarTextFadeFactor = 0.0f;
|
||||||
private final HashMap<Integer, SoftReference<BitmapDrawable>> mSpaceDrawableCache =
|
private final HashMap<Integer, BitmapDrawable> mSpaceDrawableCache =
|
||||||
new HashMap<Integer, SoftReference<BitmapDrawable>>();
|
new HashMap<Integer, BitmapDrawable>();
|
||||||
private final boolean mIsSpacebarTriggeringPopupByLongPress;
|
private final boolean mIsSpacebarTriggeringPopupByLongPress;
|
||||||
|
|
||||||
/* Shortcut key and its icons if available */
|
/* Shortcut key and its icons if available */
|
||||||
|
@ -249,13 +249,13 @@ public class LatinKeyboard extends Keyboard {
|
||||||
private BitmapDrawable getSpaceDrawable(Locale locale, boolean isAutoCorrection) {
|
private BitmapDrawable getSpaceDrawable(Locale locale, boolean isAutoCorrection) {
|
||||||
final Integer hashCode = Arrays.hashCode(
|
final Integer hashCode = Arrays.hashCode(
|
||||||
new Object[] { locale, isAutoCorrection, mSpacebarTextFadeFactor });
|
new Object[] { locale, isAutoCorrection, mSpacebarTextFadeFactor });
|
||||||
final SoftReference<BitmapDrawable> ref = mSpaceDrawableCache.get(hashCode);
|
final BitmapDrawable cached = mSpaceDrawableCache.get(hashCode);
|
||||||
BitmapDrawable drawable = (ref == null) ? null : ref.get();
|
if (cached != null) {
|
||||||
if (drawable == null) {
|
return cached;
|
||||||
drawable = new BitmapDrawable(mRes, drawSpacebar(
|
|
||||||
locale, isAutoCorrection, mSpacebarTextFadeFactor));
|
|
||||||
mSpaceDrawableCache.put(hashCode, new SoftReference<BitmapDrawable>(drawable));
|
|
||||||
}
|
}
|
||||||
|
final BitmapDrawable drawable = new BitmapDrawable(mRes, drawSpacebar(
|
||||||
|
locale, isAutoCorrection, mSpacebarTextFadeFactor));
|
||||||
|
mSpaceDrawableCache.put(hashCode, drawable);
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue