optimize memory and image size. remove unnecessary language file

This commit is contained in:
hyb1996
2017-05-10 15:42:58 +08:00
parent e5ade55519
commit 1222e00adc
77 changed files with 590 additions and 436 deletions

View File

@@ -0,0 +1,57 @@
package com.stardust.theme.widget;
import android.content.Context;
import android.graphics.PorterDuff;
import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet;
import com.stardust.theme.ThemeColor;
import com.stardust.theme.ThemeColorManager;
import com.stardust.theme.ThemeColorMutable;
/**
* Created by Stardust on 2017/5/10.
*/
public class ThemeColorImageViewCompat extends AppCompatImageView implements ThemeColorMutable {
private int mColor;
public ThemeColorImageViewCompat(Context context) {
super(context);
this.init();
}
public ThemeColorImageViewCompat(Context context, AttributeSet attrs) {
super(context, attrs);
this.init();
}
public ThemeColorImageViewCompat(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.init();
}
private void init() {
ThemeColorManager.add(this);
}
public void setThemeColor(ThemeColor color) {
if (this.mColor != color.colorPrimary) {
this.mColor = color.colorPrimary;
this.setColor(color.colorPrimary);
}
}
public void setImageResource(int resId) {
super.setImageResource(resId);
if (this.mColor != 0) {
this.setColor(this.mColor);
}
}
private void setColor(int color) {
getDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
}