「Update」
1、修复 未兼容控件导致的崩溃异常
This commit is contained in:
@@ -58,4 +58,4 @@ MOGO_TELEMATIC_VERSION=1.4.7.42
|
||||
# v2x
|
||||
MOGO_V2X_VERSION=1.4.7.42
|
||||
# SKIN
|
||||
MOGO_SKIN_VERSION=1.4.7.44
|
||||
MOGO_SKIN_VERSION=1.4.7.45
|
||||
|
||||
@@ -132,63 +132,69 @@ public class SkinAttribute {
|
||||
public void applySkin(Typeface typeface) {
|
||||
applySkinTypeface(typeface);
|
||||
applySkinViewSupport();
|
||||
for (SkinPair skinPair : skinPairs) {
|
||||
Drawable left = null, top = null, right = null, bottom = null;
|
||||
String textStr;
|
||||
switch (skinPair.attributeName) {
|
||||
case "background":
|
||||
Object background = SkinResources.getInstance().getBackground(skinPair.resId);
|
||||
//Color
|
||||
if (background instanceof Integer) {
|
||||
view.setBackgroundColor((Integer) background);
|
||||
} else {
|
||||
ViewCompat.setBackground(view, (Drawable) background);
|
||||
}
|
||||
break;
|
||||
case "src":
|
||||
background = SkinResources.getInstance().getBackground(skinPair.resId);
|
||||
if (background instanceof Integer) {
|
||||
((ImageView) view).setImageDrawable(new ColorDrawable((Integer) background));
|
||||
} else {
|
||||
((ImageView) view).setImageDrawable((Drawable) background);
|
||||
}
|
||||
break;
|
||||
case "textColor":
|
||||
((TextView) view).setTextColor(SkinResources.getInstance().getColorStateList(skinPair.resId));
|
||||
break;
|
||||
case "textColorHint":
|
||||
((EditText) view).setHintTextColor(SkinResources.getInstance().getColorStateList(skinPair.resId));
|
||||
break;
|
||||
case "drawableLeft":
|
||||
left = SkinResources.getInstance().getDrawable(skinPair.resId);
|
||||
break;
|
||||
case "drawableTop":
|
||||
top = SkinResources.getInstance().getDrawable(skinPair.resId);
|
||||
break;
|
||||
case "drawableRight":
|
||||
right = SkinResources.getInstance().getDrawable(skinPair.resId);
|
||||
break;
|
||||
case "drawableBottom":
|
||||
bottom = SkinResources.getInstance().getDrawable(skinPair.resId);
|
||||
break;
|
||||
case "skinTypeface":
|
||||
Typeface typeface1 = SkinResources.getInstance().getTypeface(skinPair.resId);
|
||||
applySkinTypeface(typeface1);
|
||||
break;
|
||||
case "text":
|
||||
textStr = SkinResources.getInstance().getString(skinPair.resId);
|
||||
applyText(textStr);
|
||||
break;
|
||||
case "hint":
|
||||
textStr = SkinResources.getInstance().getString(skinPair.resId);
|
||||
applyHintText(textStr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (null != left || null != right || null != top || null != bottom) {
|
||||
((TextView) view).setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom);
|
||||
try {
|
||||
for (SkinPair skinPair : skinPairs) {
|
||||
Drawable left = null, top = null, right = null, bottom = null;
|
||||
String textStr;
|
||||
switch (skinPair.attributeName) {
|
||||
case "background":
|
||||
Object background = SkinResources.getInstance().getBackground(skinPair.resId);
|
||||
//Color
|
||||
if (background instanceof Integer) {
|
||||
view.setBackgroundColor((Integer) background);
|
||||
} else {
|
||||
ViewCompat.setBackground(view, (Drawable) background);
|
||||
}
|
||||
break;
|
||||
case "src":
|
||||
if (view instanceof ImageView){
|
||||
background = SkinResources.getInstance().getBackground(skinPair.resId);
|
||||
if (background instanceof Integer) {
|
||||
((ImageView) view).setImageDrawable(new ColorDrawable((Integer) background));
|
||||
} else {
|
||||
((ImageView) view).setImageDrawable((Drawable) background);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "textColor":
|
||||
((TextView) view).setTextColor(SkinResources.getInstance().getColorStateList(skinPair.resId));
|
||||
break;
|
||||
case "textColorHint":
|
||||
((EditText) view).setHintTextColor(SkinResources.getInstance().getColorStateList(skinPair.resId));
|
||||
break;
|
||||
case "drawableLeft":
|
||||
left = SkinResources.getInstance().getDrawable(skinPair.resId);
|
||||
break;
|
||||
case "drawableTop":
|
||||
top = SkinResources.getInstance().getDrawable(skinPair.resId);
|
||||
break;
|
||||
case "drawableRight":
|
||||
right = SkinResources.getInstance().getDrawable(skinPair.resId);
|
||||
break;
|
||||
case "drawableBottom":
|
||||
bottom = SkinResources.getInstance().getDrawable(skinPair.resId);
|
||||
break;
|
||||
case "skinTypeface":
|
||||
Typeface typeface1 = SkinResources.getInstance().getTypeface(skinPair.resId);
|
||||
applySkinTypeface(typeface1);
|
||||
break;
|
||||
case "text":
|
||||
textStr = SkinResources.getInstance().getString(skinPair.resId);
|
||||
applyText(textStr);
|
||||
break;
|
||||
case "hint":
|
||||
textStr = SkinResources.getInstance().getString(skinPair.resId);
|
||||
applyHintText(textStr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (null != left || null != right || null != top || null != bottom) {
|
||||
((TextView) view).setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user