Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Fix duplicate attributes defined in Spinner and TextAppearance attrs.xml #474

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles_dark.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
<item name="spn_arrowAnimDuration">@android:integer/config_shortAnimTime</item>
<item name="spn_arrowInterpolator">@android:anim/decelerate_interpolator</item>
<item name="spn_arrowColor">@color/colorAccent</item>
<item name="android:popupBackground">@drawable/popup_background_dark</item>
<item name="spn_popupBackground">@drawable/popup_background_dark</item>
</style>

<style name="DarkSpinnerNoArrow" parent="DarkSpinner">
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles_light.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
<item name="spn_arrowAnimDuration">@android:integer/config_shortAnimTime</item>
<item name="spn_arrowInterpolator">@android:anim/decelerate_interpolator</item>
<item name="spn_arrowColor">@color/colorControlNormal</item>
<item name="android:popupBackground">@drawable/abc_popup_background_mtrl_mult</item>
<item name="spn_popupBackground">@drawable/abc_popup_background_mtrl_mult</item>
</style>

<style name="LightSpinnerNoArrow" parent="LightSpinner">
Expand Down
44 changes: 22 additions & 22 deletions material/src/main/java/com/rey/material/util/ViewUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,44 +358,44 @@ public static void applyTextAppearance(TextView v, int resId){
if (attr == R.styleable.TextAppearance_android_textColorHighlight) {
v.setHighlightColor(appearance.getColor(attr, 0));

} else if (attr == R.styleable.TextAppearance_android_textColor) {
} else if (attr == R.styleable.TextAppearance_ta_textColor) {
v.setTextColor(appearance.getColorStateList(attr));

} else if (attr == R.styleable.TextAppearance_android_textColorHint) {
} else if (attr == R.styleable.TextAppearance_ta_textColorHint) {
v.setHintTextColor(appearance.getColorStateList(attr));

} else if (attr == R.styleable.TextAppearance_android_textColorLink) {
} else if (attr == R.styleable.TextAppearance_ta_textColorLink) {
v.setLinkTextColor(appearance.getColorStateList(attr));

} else if (attr == R.styleable.TextAppearance_android_textSize) {
} else if (attr == R.styleable.TextAppearance_ta_textSize) {
v.setTextSize(TypedValue.COMPLEX_UNIT_PX, appearance.getDimensionPixelSize(attr, 0));

} else if (attr == R.styleable.TextAppearance_android_typeface) {
} else if (attr == R.styleable.TextAppearance_ta_typeface) {
typefaceIndex = appearance.getInt(attr, -1);

} else if (attr == R.styleable.TextAppearance_android_fontFamily) {
} else if (attr == R.styleable.TextAppearance_ta_fontFamily) {
fontFamily = appearance.getString(attr);

} else if (attr == R.styleable.TextAppearance_tv_fontFamily) {
fontFamily = appearance.getString(attr);

} else if (attr == R.styleable.TextAppearance_android_textStyle) {
} else if (attr == R.styleable.TextAppearance_ta_textStyle) {
styleIndex = appearance.getInt(attr, -1);

} else if (attr == R.styleable.TextAppearance_android_textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
v.setAllCaps(appearance.getBoolean(attr, false));

} else if (attr == R.styleable.TextAppearance_android_shadowColor) {
} else if (attr == R.styleable.TextAppearance_ta_shadowColor) {
shadowColor = appearance.getInt(attr, 0);

} else if (attr == R.styleable.TextAppearance_android_shadowDx) {
} else if (attr == R.styleable.TextAppearance_ta_shadowDx) {
dx = appearance.getFloat(attr, 0);

} else if (attr == R.styleable.TextAppearance_android_shadowDy) {
} else if (attr == R.styleable.TextAppearance_ta_shadowDy) {
dy = appearance.getFloat(attr, 0);

} else if (attr == R.styleable.TextAppearance_android_shadowRadius) {
} else if (attr == R.styleable.TextAppearance_ta_shadowRadius) {
r = appearance.getFloat(attr, 0);

} else if (attr == R.styleable.TextAppearance_android_elegantTextHeight) {
Expand Down Expand Up @@ -482,44 +482,44 @@ private static void applyStyle(TextView v, AttributeSet attrs, int defStyleAttr,
if (attr == R.styleable.TextAppearance_android_textColorHighlight) {
v.setHighlightColor(appearance.getColor(attr, 0));

} else if (attr == R.styleable.TextAppearance_android_textColor) {
} else if (attr == R.styleable.TextAppearance_ta_textColor) {
v.setTextColor(appearance.getColorStateList(attr));

} else if (attr == R.styleable.TextAppearance_android_textColorHint) {
} else if (attr == R.styleable.TextAppearance_ta_textColorHint) {
v.setHintTextColor(appearance.getColorStateList(attr));

} else if (attr == R.styleable.TextAppearance_android_textColorLink) {
} else if (attr == R.styleable.TextAppearance_ta_textColorLink) {
v.setLinkTextColor(appearance.getColorStateList(attr));

} else if (attr == R.styleable.TextAppearance_android_textSize) {
} else if (attr == R.styleable.TextAppearance_ta_textSize) {
v.setTextSize(TypedValue.COMPLEX_UNIT_PX, appearance.getDimensionPixelSize(attr, 0));

} else if (attr == R.styleable.TextAppearance_android_typeface) {
} else if (attr == R.styleable.TextAppearance_ta_typeface) {
typefaceIndex = appearance.getInt(attr, -1);

} else if (attr == R.styleable.TextAppearance_android_fontFamily) {
} else if (attr == R.styleable.TextAppearance_ta_fontFamily) {
fontFamily = appearance.getString(attr);

} else if (attr == R.styleable.TextAppearance_tv_fontFamily) {
fontFamily = appearance.getString(attr);

} else if (attr == R.styleable.TextAppearance_android_textStyle) {
} else if (attr == R.styleable.TextAppearance_ta_textStyle) {
styleIndex = appearance.getInt(attr, -1);

} else if (attr == R.styleable.TextAppearance_android_textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
v.setAllCaps(appearance.getBoolean(attr, false));

} else if (attr == R.styleable.TextAppearance_android_shadowColor) {
} else if (attr == R.styleable.TextAppearance_ta_shadowColor) {
shadowColor = appearance.getInt(attr, 0);

} else if (attr == R.styleable.TextAppearance_android_shadowDx) {
} else if (attr == R.styleable.TextAppearance_ta_shadowDx) {
dx = appearance.getFloat(attr, 0);

} else if (attr == R.styleable.TextAppearance_android_shadowDy) {
} else if (attr == R.styleable.TextAppearance_ta_shadowDy) {
dy = appearance.getFloat(attr, 0);

} else if (attr == R.styleable.TextAppearance_android_shadowRadius) {
} else if (attr == R.styleable.TextAppearance_ta_shadowRadius) {
r = appearance.getFloat(attr, 0);

} else if (attr == R.styleable.TextAppearance_android_elegantTextHeight) {
Expand Down
16 changes: 8 additions & 8 deletions material/src/main/java/com/rey/material/widget/Spinner.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ else if(attr == R.styleable.Spinner_android_minWidth)
setMinimumWidth(a.getDimensionPixelOffset(attr, 0));
else if(attr == R.styleable.Spinner_android_minHeight)
setMinimumHeight(a.getDimensionPixelOffset(attr, 0));
else if(attr == R.styleable.Spinner_android_dropDownWidth)
else if(attr == R.styleable.Spinner_spn_dropDownWidth)
mDropDownWidth = a.getLayoutDimension(attr, LayoutParams.WRAP_CONTENT);
else if(attr == R.styleable.Spinner_android_popupBackground)
else if(attr == R.styleable.Spinner_spn_popupBackground)
mPopup.setBackgroundDrawable(a.getDrawable(attr));
else if(attr == R.styleable.Spinner_android_prompt)
else if(attr == R.styleable.Spinner_spn_prompt)
mPopup.setPromptText(a.getString(attr));
else if(attr == R.styleable.Spinner_spn_popupItemAnimation)
mPopup.setItemAnimation(a.getResourceId(attr, 0));
Expand Down Expand Up @@ -434,7 +434,7 @@ public void setAdapter(SpinnerAdapter adapter) {
*
* @param background Background drawable
*
* @attr ref android.R.styleable#Spinner_popupBackground
* @attr ref android.R.styleable#Spinner_spn_popupBackground
*/
public void setPopupBackgroundDrawable(Drawable background) {
mPopup.setBackgroundDrawable(background);
Expand All @@ -445,7 +445,7 @@ public void setPopupBackgroundDrawable(Drawable background) {
*
* @param resId Resource ID of a background drawable
*
* @attr ref android.R.styleable#Spinner_popupBackground
* @attr ref android.R.styleable#Spinner_spn_popupBackground
*/
public void setPopupBackgroundResource(int resId) {
setPopupBackgroundDrawable(getContext().getDrawable(resId));
Expand All @@ -456,7 +456,7 @@ public void setPopupBackgroundResource(int resId) {
*
* @return background Background drawable
*
* @attr ref android.R.styleable#Spinner_popupBackground
* @attr ref android.R.styleable#Spinner_spn_popupBackground
*/
public Drawable getPopupBackground() {
return mPopup.getBackground();
Expand Down Expand Up @@ -515,7 +515,7 @@ public int getDropDownHorizontalOffset() {
*
* @param pixels Width in pixels, WRAP_CONTENT, or MATCH_PARENT
*
* @attr ref android.R.styleable#Spinner_dropDownWidth
* @attr ref android.R.styleable#Spinner_spn_dropDownWidth
*/
public void setDropDownWidth(int pixels) {
mDropDownWidth = pixels;
Expand All @@ -530,7 +530,7 @@ public void setDropDownWidth(int pixels) {
*
* @return Width in pixels, WRAP_CONTENT, or MATCH_PARENT
*
* @attr ref android.R.styleable#Spinner_dropDownWidth
* @attr ref android.R.styleable#Spinner_spn_dropDownWidth
*/
public int getDropDownWidth() {
return mDropDownWidth;
Expand Down
33 changes: 19 additions & 14 deletions material/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,24 @@

<declare-styleable name="TextAppearance">
<attr name="android:textColorHighlight" />
<attr name="android:textColor" />
<attr name="android:textColorHint" />
<attr name="android:textColorLink" />
<attr name="android:textSize" />
<attr name="android:textStyle" />
<attr name="android:typeface" />
<attr name="android:fontFamily" />
<attr name="ta_textColor" format="reference|color" />
<attr name="ta_textColorHint" format="string|reference" />
<attr name="ta_textColorLink" format="string|reference" />
<attr name="ta_textSize" format="reference|dimension"/>
<attr name="ta_textStyle" format="integer">
<enum name="normal" value="0" />
<enum name="bold" value="1" />
<enum name="italic" value="2" />
<enum name="bold_italic" value="3" />
</attr>
<attr name="ta_typeface" format="string|reference" />
<attr name="ta_fontFamily" format="string|reference" />
<attr name="tv_fontFamily" />
<attr name="android:textAllCaps" />
<attr name="android:shadowColor" />
<attr name="android:shadowDx" />
<attr name="android:shadowDy" />
<attr name="android:shadowRadius" />
<attr name="ta_shadowColor" format="reference|color"/>
<attr name="ta_shadowDx" format="reference|integer"/>
<attr name="ta_shadowDy" format="reference|integer"/>
<attr name="ta_shadowRadius" format="reference|integer"/>
<attr name="android:elegantTextHeight" />
<attr name="android:fontFeatureSettings" />
<attr name="android:letterSpacing" />
Expand Down Expand Up @@ -462,9 +467,9 @@

<declare-styleable name="Spinner">
<attr name="android:gravity" />
<attr name="android:prompt" />
<attr name="android:dropDownWidth" />
<attr name="android:popupBackground" />
<attr name="spn_prompt" format="string|reference"/>
<attr name="spn_dropDownWidth" format="reference|dimension"/>
<attr name="spn_popupBackground" format="reference"/>
<attr name="android:minWidth"/>
<attr name="android:minHeight"/>
<attr name="spn_disableChildrenWhenDisabled" format="boolean"/>
Expand Down