Fix missing TypedArray.recycle calls
Change-Id: I333e55b4e7925dac5495e2e73ac57ffcef4fabb4
This commit is contained in:
parent
f6dffc3089
commit
cc02aa8af3
2 changed files with 9 additions and 5 deletions
|
@ -38,7 +38,6 @@ import com.android.inputmethod.latin.R;
|
||||||
import com.android.inputmethod.latin.SubtypeSwitcher;
|
import com.android.inputmethod.latin.SubtypeSwitcher;
|
||||||
import com.android.inputmethod.latin.Utils;
|
import com.android.inputmethod.latin.Utils;
|
||||||
|
|
||||||
import java.lang.ref.SoftReference;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
@ -329,10 +328,12 @@ public class LatinKeyboard extends Keyboard {
|
||||||
Math.max(0, Math.min(y, mOccupiedHeight - 1)));
|
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) {
|
public static int getTextSizeFromTheme(Theme theme, int style, int defValue) {
|
||||||
TypedArray array = theme.obtainStyledAttributes(
|
final TypedArray a = theme.obtainStyledAttributes(style, ATTR_TEXT_SIZE);
|
||||||
style, new int[] { android.R.attr.textSize });
|
final int textSize = a.getDimensionPixelSize(a.getResourceId(0, 0), defValue);
|
||||||
int textSize = array.getDimensionPixelSize(array.getResourceId(0, 0), defValue);
|
a.recycle();
|
||||||
return textSize;
|
return textSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,10 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
if (TAG_KEYBOARD.equals(tag)) {
|
if (TAG_KEYBOARD.equals(tag)) {
|
||||||
final TypedArray keyboardAttr = res.obtainAttributes(Xml.asAttributeSet(parser),
|
final TypedArray keyboardAttr = res.obtainAttributes(Xml.asAttributeSet(parser),
|
||||||
R.styleable.Keyboard);
|
R.styleable.Keyboard);
|
||||||
return keyboardAttr.getString(R.styleable.Keyboard_keyboardLocale);
|
final String locale = keyboardAttr.getString(
|
||||||
|
R.styleable.Keyboard_keyboardLocale);
|
||||||
|
keyboardAttr.recycle();
|
||||||
|
return locale;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStartTag(parser, TAG_KEYBOARD);
|
throw new IllegalStartTag(parser, TAG_KEYBOARD);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue