Search in sources :

Example 86 with Drawable

use of android.graphics.drawable.Drawable in project platform_frameworks_base by android.

the class NotificationCustomViewWrapper method notifyContentUpdated.

@Override
public void notifyContentUpdated(StatusBarNotification notification) {
    super.notifyContentUpdated(notification);
    Drawable background = mView.getBackground();
    mBackgroundColor = 0;
    if (background instanceof ColorDrawable) {
        mBackgroundColor = ((ColorDrawable) background).getColor();
        mView.setBackground(null);
        mView.setTag(CUSTOM_BACKGROUND_TAG, mBackgroundColor);
    } else if (mView.getTag(CUSTOM_BACKGROUND_TAG) != null) {
        mBackgroundColor = (int) mView.getTag(CUSTOM_BACKGROUND_TAG);
    }
    mShouldInvertDark = mBackgroundColor == 0 || isColorLight(mBackgroundColor);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable)

Example 87 with Drawable

use of android.graphics.drawable.Drawable in project platform_frameworks_base by android.

the class NotificationHeaderViewWrapper method updateIconColorFilter.

private void updateIconColorFilter(ImageView target, float intensity) {
    int color = interpolateColor(mColor, mIconDarkColor, intensity);
    mIconColorFilter.setColor(color);
    Drawable iconDrawable = target.getDrawable();
    // might be null here.
    if (iconDrawable != null) {
        Drawable d = iconDrawable.mutate();
        // DrawableContainer ignores the color filter if it's already set, so clear it first to
        // get it set and invalidated properly.
        d.setColorFilter(null);
        d.setColorFilter(mIconColorFilter);
    }
}
Also used : Drawable(android.graphics.drawable.Drawable)

Example 88 with Drawable

use of android.graphics.drawable.Drawable in project platform_frameworks_base by android.

the class StatusBarIconView method getIcon.

/**
     * Returns the right icon to use for this item
     *
     * @param context Context to use to get resources
     * @return Drawable for this item, or null if the package or item could not
     *         be found
     */
public static Drawable getIcon(Context context, StatusBarIcon statusBarIcon) {
    int userId = statusBarIcon.user.getIdentifier();
    if (userId == UserHandle.USER_ALL) {
        userId = UserHandle.USER_SYSTEM;
    }
    Drawable icon = statusBarIcon.icon.loadDrawableAsUser(context, userId);
    TypedValue typedValue = new TypedValue();
    context.getResources().getValue(R.dimen.status_bar_icon_scale_factor, typedValue, true);
    float scaleFactor = typedValue.getFloat();
    // No need to scale the icon, so return it as is.
    if (scaleFactor == 1.f) {
        return icon;
    }
    return new ScalingDrawableWrapper(icon, scaleFactor);
}
Also used : Drawable(android.graphics.drawable.Drawable) Paint(android.graphics.Paint) TypedValue(android.util.TypedValue)

Example 89 with Drawable

use of android.graphics.drawable.Drawable in project platform_frameworks_base by android.

the class StatusBarIconView method updateDrawable.

private boolean updateDrawable(boolean withClear) {
    if (mIcon == null) {
        return false;
    }
    Drawable drawable = getIcon(mIcon);
    if (drawable == null) {
        Log.w(TAG, "No icon for slot " + mSlot);
        return false;
    }
    if (withClear) {
        setImageDrawable(null);
    }
    setImageDrawable(drawable);
    return true;
}
Also used : Drawable(android.graphics.drawable.Drawable)

Example 90 with Drawable

use of android.graphics.drawable.Drawable in project platform_frameworks_base by android.

the class ConfirmDialog method getDrawable.

@Override
public Drawable getDrawable(String source) {
    // Should only reach this when fetching the VPN icon for the warning string.
    Drawable icon = getDrawable(R.drawable.ic_vpn_dialog);
    icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
    return icon;
}
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