Skip to content

Commit

Permalink
Merge branch 'textAllCapsFix' of https://github.com/alexander-mironov…
Browse files Browse the repository at this point in the history
…/ActionBarSherlock into alexander-mironov-textAllCapsFix
  • Loading branch information
JakeWharton committed Jul 3, 2013
2 parents f1ebba3 + 0f07d2d commit a0be5b4
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,30 @@ public class CapitalizingButton extends Button {
private static final boolean IS_GINGERBREAD = Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;

private static final int[] R_styleable_Button = new int[] {
android.R.attr.textAppearance
};
private static final int R_styleable_Button_textAppearance = 0;

private static final int[] R_styleable_TextAppearance = new int[] {
android.R.attr.textAllCaps
};
private static final int R_styleable_Button_textAllCaps = 0;
private static final int R_styleable_TextAppearance_textAllCaps = 0;

private boolean mAllCaps;

public CapitalizingButton(Context context, AttributeSet attrs) {
super(context, attrs);

TypedArray a = context.obtainStyledAttributes(attrs, R_styleable_Button);
mAllCaps = a.getBoolean(R_styleable_Button_textAllCaps, true);
int ap = a.getResourceId(R_styleable_Button_textAppearance, -1);
a.recycle();
if (ap != -1) {
TypedArray appearance = context.obtainStyledAttributes(ap, R_styleable_TextAppearance);
if (appearance != null) {
mAllCaps = appearance.getBoolean(R_styleable_TextAppearance_textAllCaps, true);
appearance.recycle();
}
}
}

public void setTextCompat(CharSequence text) {
Expand Down

0 comments on commit a0be5b4

Please sign in to comment.