Rename KeyStyle.getFlag to getFlags

Change-Id: Iff3d850466cb6016a53bf86104cd5d22363f96a8
main
Tadashi G. Takaoka 2013-08-19 11:02:44 +09:00
parent 606a056b53
commit 0cfd2b08af
3 changed files with 11 additions and 14 deletions

View File

@ -269,11 +269,11 @@ public class Key implements Comparable<Key> {
final int previewIconId = KeySpecParser.getIconId(style.getString(keyAttr, final int previewIconId = KeySpecParser.getIconId(style.getString(keyAttr,
R.styleable.Keyboard_Key_keyIconPreview)); R.styleable.Keyboard_Key_keyIconPreview));
mLabelFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags) mLabelFlags = style.getFlags(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags)
| row.getDefaultKeyLabelFlags(); | row.getDefaultKeyLabelFlags();
final boolean needsToUpperCase = needsToUpperCase(mLabelFlags, params.mId.mElementId); final boolean needsToUpperCase = needsToUpperCase(mLabelFlags, params.mId.mElementId);
final Locale locale = params.mId.mLocale; final Locale locale = params.mId.mLocale;
int actionFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyActionFlags); int actionFlags = style.getFlags(keyAttr, R.styleable.Keyboard_Key_keyActionFlags);
String[] moreKeys = style.getStringArray(keyAttr, R.styleable.Keyboard_Key_moreKeys); String[] moreKeys = style.getStringArray(keyAttr, R.styleable.Keyboard_Key_moreKeys);
int moreKeysColumn = style.getInt(keyAttr, int moreKeysColumn = style.getInt(keyAttr,

View File

@ -24,7 +24,7 @@ public abstract class KeyStyle {
public abstract String[] getStringArray(TypedArray a, int index); public abstract String[] getStringArray(TypedArray a, int index);
public abstract String getString(TypedArray a, int index); public abstract String getString(TypedArray a, int index);
public abstract int getInt(TypedArray a, int index, int defaultValue); public abstract int getInt(TypedArray a, int index, int defaultValue);
public abstract int getFlag(TypedArray a, int index); public abstract int getFlags(TypedArray a, int index);
protected KeyStyle(final KeyboardTextsSet textsSet) { protected KeyStyle(final KeyboardTextsSet textsSet) {
mTextsSet = textsSet; mTextsSet = textsSet;

View File

@ -66,7 +66,7 @@ public final class KeyStylesSet {
} }
@Override @Override
public int getFlag(final TypedArray a, final int index) { public int getFlags(final TypedArray a, final int index) {
return a.getInt(index, 0); return a.getInt(index, 0);
} }
} }
@ -123,14 +123,11 @@ public final class KeyStylesSet {
} }
@Override @Override
public int getFlag(final TypedArray a, final int index) { public int getFlags(final TypedArray a, final int index) {
int flags = a.getInt(index, 0); final Integer value = (Integer)mStyleAttributes.get(index);
final Object value = mStyleAttributes.get(index); final int flags = a.getInt(index, (value != null) ? value : 0);
if (value != null) {
flags |= (Integer)value;
}
final KeyStyle parentStyle = mStyles.get(mParentStyleName); final KeyStyle parentStyle = mStyles.get(mParentStyleName);
return flags | parentStyle.getFlag(a, index); return flags | parentStyle.getFlags(a, index);
} }
public void readKeyAttributes(final TypedArray keyAttr) { public void readKeyAttributes(final TypedArray keyAttr) {
@ -142,13 +139,13 @@ public final class KeyStylesSet {
readString(keyAttr, R.styleable.Keyboard_Key_keyHintLabel); readString(keyAttr, R.styleable.Keyboard_Key_keyHintLabel);
readStringArray(keyAttr, R.styleable.Keyboard_Key_moreKeys); readStringArray(keyAttr, R.styleable.Keyboard_Key_moreKeys);
readStringArray(keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys); readStringArray(keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys);
readFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags); readFlags(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags);
readString(keyAttr, R.styleable.Keyboard_Key_keyIcon); readString(keyAttr, R.styleable.Keyboard_Key_keyIcon);
readString(keyAttr, R.styleable.Keyboard_Key_keyIconDisabled); readString(keyAttr, R.styleable.Keyboard_Key_keyIconDisabled);
readString(keyAttr, R.styleable.Keyboard_Key_keyIconPreview); readString(keyAttr, R.styleable.Keyboard_Key_keyIconPreview);
readInt(keyAttr, R.styleable.Keyboard_Key_maxMoreKeysColumn); readInt(keyAttr, R.styleable.Keyboard_Key_maxMoreKeysColumn);
readInt(keyAttr, R.styleable.Keyboard_Key_backgroundType); readInt(keyAttr, R.styleable.Keyboard_Key_backgroundType);
readFlag(keyAttr, R.styleable.Keyboard_Key_keyActionFlags); readFlags(keyAttr, R.styleable.Keyboard_Key_keyActionFlags);
} }
private void readString(final TypedArray a, final int index) { private void readString(final TypedArray a, final int index) {
@ -163,7 +160,7 @@ public final class KeyStylesSet {
} }
} }
private void readFlag(final TypedArray a, final int index) { private void readFlags(final TypedArray a, final int index) {
if (a.hasValue(index)) { if (a.hasValue(index)) {
final Integer value = (Integer)mStyleAttributes.get(index); final Integer value = (Integer)mStyleAttributes.get(index);
mStyleAttributes.put(index, a.getInt(index, 0) | (value != null ? value : 0)); mStyleAttributes.put(index, a.getInt(index, 0) | (value != null ? value : 0));