am 9d40d872: Merge "Add support for shadows in TextAppearance styles"

# Via Adam Powell (1) and Android (Google) Code Review (1)
* commit '9d40d8720d422fc39068e7b0b0ae6f13621c3de1':
  Add support for shadows in TextAppearance styles
This commit is contained in:
Adam Powell
2013-02-14 19:58:59 -08:00
committed by Android Git Automerger
2 changed files with 43 additions and 6 deletions

View File

@ -607,6 +607,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
int typefaceIndex = -1;
int styleIndex = -1;
boolean allCaps = false;
int shadowcolor = 0;
float dx = 0, dy = 0, r = 0;
final Resources.Theme theme = context.getTheme();
@ -667,6 +669,22 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
case com.android.internal.R.styleable.TextAppearance_textAllCaps:
allCaps = appearance.getBoolean(attr, false);
break;
case com.android.internal.R.styleable.TextAppearance_shadowColor:
shadowcolor = a.getInt(attr, 0);
break;
case com.android.internal.R.styleable.TextAppearance_shadowDx:
dx = a.getFloat(attr, 0);
break;
case com.android.internal.R.styleable.TextAppearance_shadowDy:
dy = a.getFloat(attr, 0);
break;
case com.android.internal.R.styleable.TextAppearance_shadowRadius:
r = a.getFloat(attr, 0);
break;
}
}
@ -690,8 +708,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
int maxlength = -1;
CharSequence text = "";
CharSequence hint = null;
int shadowcolor = 0;
float dx = 0, dy = 0, r = 0;
boolean password = false;
int inputType = EditorInfo.TYPE_NULL;
@ -2331,6 +2347,19 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
setTypefaceFromAttrs(familyName, typefaceIndex, styleIndex);
final int shadowcolor = appearance.getInt(
com.android.internal.R.styleable.TextAppearance_shadowColor, 0);
if (shadowcolor != 0) {
final float dx = appearance.getFloat(
com.android.internal.R.styleable.TextAppearance_shadowDx, 0);
final float dy = appearance.getFloat(
com.android.internal.R.styleable.TextAppearance_shadowDy, 0);
final float r = appearance.getFloat(
com.android.internal.R.styleable.TextAppearance_shadowRadius, 0);
setShadowLayer(r, dx, dy, shadowcolor);
}
if (appearance.getBoolean(com.android.internal.R.styleable.TextAppearance_textAllCaps,
false)) {
setTransformationMethod(new AllCapsTransformationMethod(getContext()));

View File

@ -3061,6 +3061,14 @@
<attr name="textColorLink" />
<!-- Present the text in ALL CAPS. This may use a small-caps form when available. -->
<attr name="textAllCaps" format="boolean" />
<!-- Place a shadow of the specified color behind the text. -->
<attr name="shadowColor" format="color" />
<!-- Horizontal offset of the shadow. -->
<attr name="shadowDx" format="float" />
<!-- Vertical offset of the shadow. -->
<attr name="shadowDy" format="float" />
<!-- Radius of the shadow. -->
<attr name="shadowRadius" format="float" />
</declare-styleable>
<declare-styleable name="TextClock">
<!-- Specifies the formatting pattern used to show the time and/or date
@ -3195,13 +3203,13 @@
specified number. -->
<attr name="maxLength" format="integer" min="0" />
<!-- Place a shadow of the specified color behind the text. -->
<attr name="shadowColor" format="color" />
<attr name="shadowColor" />
<!-- Horizontal offset of the shadow. -->
<attr name="shadowDx" format="float" />
<attr name="shadowDx" />
<!-- Vertical offset of the shadow. -->
<attr name="shadowDy" format="float" />
<attr name="shadowDy" />
<!-- Radius of the shadow. -->
<attr name="shadowRadius" format="float" />
<attr name="shadowRadius" />
<attr name="autoLink" />
<!-- If set to false, keeps the movement method from being set
to the link movement method even if autoLink causes links