aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-10-18 21:15:19 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-10-18 21:15:19 -0700
commita1b6e32cf4d70c6a15ef9d36dd9d8466feeff23b (patch)
tree8e631f7be569d1b026012a26e407a4b4a34be827
parent5304d6968bdc1ece8f0335e8b133fa3fe8c1bba2 (diff)
parentcc02aa8af35b85cb564503c7b54e1eae6a6b6169 (diff)
downloadlatinime-a1b6e32cf4d70c6a15ef9d36dd9d8466feeff23b.tar.gz
latinime-a1b6e32cf4d70c6a15ef9d36dd9d8466feeff23b.tar.xz
latinime-a1b6e32cf4d70c6a15ef9d36dd9d8466feeff23b.zip
am cc02aa8a: Fix missing TypedArray.recycle calls
* commit 'cc02aa8af35b85cb564503c7b54e1eae6a6b6169': Fix missing TypedArray.recycle calls
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboard.java9
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java5
2 files changed, 9 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
index c51f1849b..762039625 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
@@ -38,7 +38,6 @@ import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SubtypeSwitcher;
import com.android.inputmethod.latin.Utils;
-import java.lang.ref.SoftReference;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Locale;
@@ -329,10 +328,12 @@ public class LatinKeyboard extends Keyboard {
Math.max(0, Math.min(y, mOccupiedHeight - 1)));
}
+ private static final int[] ATTR_TEXT_SIZE = { android.R.attr.textSize };
+
public static int getTextSizeFromTheme(Theme theme, int style, int defValue) {
- TypedArray array = theme.obtainStyledAttributes(
- style, new int[] { android.R.attr.textSize });
- int textSize = array.getDimensionPixelSize(array.getResourceId(0, 0), defValue);
+ final TypedArray a = theme.obtainStyledAttributes(style, ATTR_TEXT_SIZE);
+ final int textSize = a.getDimensionPixelSize(a.getResourceId(0, 0), defValue);
+ a.recycle();
return textSize;
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
index 613ce587b..c2e96f877 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
@@ -323,7 +323,10 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
if (TAG_KEYBOARD.equals(tag)) {
final TypedArray keyboardAttr = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.Keyboard);
- return keyboardAttr.getString(R.styleable.Keyboard_keyboardLocale);
+ final String locale = keyboardAttr.getString(
+ R.styleable.Keyboard_keyboardLocale);
+ keyboardAttr.recycle();
+ return locale;
} else {
throw new IllegalStartTag(parser, TAG_KEYBOARD);
}