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);
}
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);
}
}
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);
}
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;
}
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;
}
Aggregations