Search in sources :

Example 66 with Drawable

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();
}
Also used : Drawable(android.graphics.drawable.Drawable)

Example 67 with Drawable

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);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) NinePatchDrawable(android.graphics.drawable.NinePatchDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable)

Example 68 with Drawable

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);
}
Also used : Drawable(android.graphics.drawable.Drawable)

Example 69 with Drawable

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);
}
Also used : TypedArray(android.content.res.TypedArray) Drawable(android.graphics.drawable.Drawable) ImagesManager(com.stanfy.enroscar.images.ImagesManager)

Example 70 with Drawable

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);
    }
}
Also used : Drawable(android.graphics.drawable.Drawable)

Aggregations

Drawable (android.graphics.drawable.Drawable)2742 BitmapDrawable (android.graphics.drawable.BitmapDrawable)527 View (android.view.View)316 ColorDrawable (android.graphics.drawable.ColorDrawable)283 Bitmap (android.graphics.Bitmap)244 ImageView (android.widget.ImageView)232 TextView (android.widget.TextView)220 Paint (android.graphics.Paint)213 LayerDrawable (android.graphics.drawable.LayerDrawable)212 Rect (android.graphics.Rect)204 StateListDrawable (android.graphics.drawable.StateListDrawable)152 Resources (android.content.res.Resources)143 AnimationDrawable (android.graphics.drawable.AnimationDrawable)137 PackageManager (android.content.pm.PackageManager)127 Context (android.content.Context)126 TypedArray (android.content.res.TypedArray)115 ClipDrawable (android.graphics.drawable.ClipDrawable)108 ViewGroup (android.view.ViewGroup)100 Test (org.junit.Test)100 ShapeDrawable (android.graphics.drawable.ShapeDrawable)94