use of android.graphics.drawable.Drawable in project floatingsearchview by arimorty.
the class Util method setIconColor.
public static void setIconColor(ImageView iconHolder, int color) {
Drawable wrappedDrawable = DrawableCompat.wrap(iconHolder.getDrawable());
DrawableCompat.setTint(wrappedDrawable, color);
iconHolder.setImageDrawable(wrappedDrawable);
iconHolder.invalidate();
}
use of android.graphics.drawable.Drawable in project enroscar by stanfy.
the class ImagesManager method getLoadingDrawable.
/**
* @param holder image consumer
* @return drawable to display while image is being loaded
*/
protected Drawable getLoadingDrawable(final ImageConsumer holder) {
final Drawable d = holder.getLoadingImage();
final int color = 0xffeeeeee;
return d != null ? d : new ColorDrawable(color);
}
use of android.graphics.drawable.Drawable in project enroscar by stanfy.
the class LoadableCompoundButton method onDraw.
@Override
protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
final Drawable d = buttonDrawable;
if (d == null) {
return;
}
int l = getPaddingLeft(), t = getPaddingTop();
final int r = getPaddingRight(), b = getPaddingBottom();
final int w = d.getIntrinsicWidth(), h = d.getIntrinsicHeight(), ww = getWidth() - l - r, hh = getHeight() - t - b;
if (w > ww || h > hh) {
d.setBounds(l, t, l + ww, t + hh);
} else {
l += (ww - w) >> 1;
t += (hh - h) >> 1;
d.setBounds(l, t, l + w, t + h);
}
d.draw(canvas);
}
use of android.graphics.drawable.Drawable in project enroscar by stanfy.
the class LoadableTextView method init.
private void init(final Context context, final AttributeSet attrs, final int defStyle) {
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LoadableTextView, defStyle, 0);
setLoadableDrawableWidth(a.getDimensionPixelSize(R.styleable.LoadableTextView_loadableDrawableWidth, -1));
setLoadableDrawableHeight(a.getDimensionPixelSize(R.styleable.LoadableTextView_loadableDrawableHeight, -1));
final int pos = a.getInt(R.styleable.LoadableTextView_loadableDrawablePosition, 0);
a.recycle();
setLoadableDrawablePosition(LoadableImagePosition.values()[pos]);
if (loadableDrawablePosition != LoadableImagePosition.LEFT) {
// reset drawables
final Drawable[] drawables = getCompoundDrawables();
setCompoundDrawablesWithIntrinsicBounds(drawables[0], drawables[1], drawables[2], drawables[3]);
}
this.imagesManager = BeansManager.get(context).getContainer().getBean(ImagesManager.class);
}
use of android.graphics.drawable.Drawable in project platform_frameworks_base by android.
the class PhoneWindow method updateDrawable.
private void updateDrawable(int featureId, DrawableFeatureState st, boolean fromResume) {
// need to be forced when we eventually become active.
if (mContentParent == null) {
return;
}
final int featureMask = 1 << featureId;
if ((getFeatures() & featureMask) == 0 && !fromResume) {
return;
}
Drawable drawable = null;
if (st != null) {
drawable = st.child;
if (drawable == null)
drawable = st.local;
if (drawable == null)
drawable = st.def;
}
if ((getLocalFeatures() & featureMask) == 0) {
if (getContainer() != null) {
if (isActive() || fromResume) {
getContainer().setChildDrawable(featureId, drawable);
}
}
} else if (st != null && (st.cur != drawable || st.curAlpha != st.alpha)) {
// System.out.println("Drawable changed: old=" + st.cur
// + ", new=" + drawable);
st.cur = drawable;
st.curAlpha = st.alpha;
onDrawableChanged(featureId, drawable, st.alpha);
}
}
Aggregations