use of org.holoeverywhere.text.AllCapsTransformationMethod in project HoloEverywhere by Prototik.
the class TextView method setTextAppearance.
public static <T extends android.widget.TextView & FontStyleProvider> void setTextAppearance(T textView, TypedArray appearance) {
int color = appearance.getColor(R.styleable.TextAppearance_android_textColorHighlight, 0);
if (color != 0) {
textView.setHighlightColor(color);
}
ColorStateList colors = appearance.getColorStateList(R.styleable.TextAppearance_android_textColor);
if (colors != null) {
textView.setTextColor(colors);
}
int ts = appearance.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, 0);
if (ts != 0) {
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, ts);
}
colors = appearance.getColorStateList(R.styleable.TextAppearance_android_textColorHint);
if (colors != null) {
textView.setHintTextColor(colors);
}
colors = appearance.getColorStateList(R.styleable.TextAppearance_android_textColorLink);
if (colors != null) {
textView.setLinkTextColor(colors);
}
if (appearance.getBoolean(R.styleable.TextAppearance_android_textAllCaps, false)) {
textView.setTransformationMethod(new AllCapsTransformationMethod(textView.getContext()));
}
Object[] font = parseFontStyle(appearance);
textView.setFontStyle((String) font[2], (Integer) font[1] | ((Boolean) font[0] ? 0 : textView.getFontStyle()));
}
use of org.holoeverywhere.text.AllCapsTransformationMethod in project HoloEverywhere by Prototik.
the class Switch method setSwitchTextAppearance.
public void setSwitchTextAppearance(Context context, int resid) {
TypedArray appearance = context.obtainStyledAttributes(resid, R.styleable.TextAppearance);
ColorStateList colors;
int ts;
colors = appearance.getColorStateList(R.styleable.TextAppearance_android_textColor);
if (colors != null) {
mTextColors = colors;
} else {
mTextColors = getTextColors();
}
ts = appearance.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, 0);
if (ts != 0) {
if (ts != mTextPaint.getTextSize()) {
mTextPaint.setTextSize(ts);
requestLayout();
}
}
int typefaceIndex, styleIndex;
typefaceIndex = appearance.getInt(R.styleable.TextAppearance_android_typeface, -1);
styleIndex = appearance.getInt(R.styleable.TextAppearance_android_textStyle, -1);
setSwitchTypefaceByIndex(typefaceIndex, styleIndex);
boolean allCaps = appearance.getBoolean(R.styleable.TextAppearance_android_textAllCaps, false);
if (allCaps) {
mSwitchTransformationMethod = new AllCapsTransformationMethod(getContext());
mSwitchTransformationMethod.setLengthChangesAllowed(true);
} else {
mSwitchTransformationMethod = null;
}
appearance.recycle();
}
Aggregations