diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-09-09 13:19:43 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-09-09 13:19:43 +0200 |
commit | aae87b894f72a719a850ec32ad6944bd5c743331 (patch) | |
tree | b5a221fcb529c07b309f5bde0563155df28a472c /libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingButton.java | |
parent | 5b6880d2e34f4c8a4bfba87b5ce53d3c6727b744 (diff) | |
download | open-keychain-aae87b894f72a719a850ec32ad6944bd5c743331.tar.gz open-keychain-aae87b894f72a719a850ec32ad6944bd5c743331.tar.bz2 open-keychain-aae87b894f72a719a850ec32ad6944bd5c743331.zip |
Update actionbarsherlock from 4.2 to 4.4
Diffstat (limited to 'libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingButton.java')
-rw-r--r-- | libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingButton.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingButton.java b/libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingButton.java index fa3698f3b..9c658d561 100644 --- a/libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingButton.java +++ b/libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/CapitalizingButton.java @@ -12,9 +12,14 @@ 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; @@ -22,14 +27,26 @@ public class CapitalizingButton extends Button { 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) { if (SANS_ICE_CREAM && mAllCaps && text != null) { if (IS_GINGERBREAD) { - setText(text.toString().toUpperCase(Locale.ROOT)); + try { + setText(text.toString().toUpperCase(Locale.ROOT)); + } catch (NoSuchFieldError e) { + //Some manufacturer broke Locale.ROOT. See #572. + setText(text.toString().toUpperCase()); + } } else { setText(text.toString().toUpperCase()); } |