use of android.content.res.ColorStateList in project android_frameworks_base by ResurrectionRemix.
the class NotificationColorUtil method processTextAppearanceSpan.
private TextAppearanceSpan processTextAppearanceSpan(TextAppearanceSpan span) {
ColorStateList colorStateList = span.getTextColor();
if (colorStateList != null) {
int[] colors = colorStateList.getColors();
boolean changed = false;
for (int i = 0; i < colors.length; i++) {
if (ImageUtils.isGrayscale(colors[i])) {
// list.
if (!changed) {
colors = Arrays.copyOf(colors, colors.length);
}
colors[i] = processColor(colors[i]);
changed = true;
}
}
if (changed) {
return new TextAppearanceSpan(span.getFamily(), span.getTextStyle(), span.getTextSize(), new ColorStateList(colorStateList.getStates(), colors), span.getLinkTextColor());
}
}
return span;
}
use of android.content.res.ColorStateList in project android_frameworks_base by ResurrectionRemix.
the class GradientDrawable method updateStateFromTypedArray.
/**
* Updates the constant state from the values in the typed array.
*/
private void updateStateFromTypedArray(TypedArray a) {
final GradientState state = mGradientState;
// Account for any configuration changes.
state.mChangingConfigurations |= a.getChangingConfigurations();
// Extract the theme attributes, if any.
state.mThemeAttrs = a.extractThemeAttrs();
state.mShape = a.getInt(R.styleable.GradientDrawable_shape, state.mShape);
state.mDither = a.getBoolean(R.styleable.GradientDrawable_dither, state.mDither);
if (state.mShape == RING) {
state.mInnerRadius = a.getDimensionPixelSize(R.styleable.GradientDrawable_innerRadius, state.mInnerRadius);
if (state.mInnerRadius == -1) {
state.mInnerRadiusRatio = a.getFloat(R.styleable.GradientDrawable_innerRadiusRatio, state.mInnerRadiusRatio);
}
state.mThickness = a.getDimensionPixelSize(R.styleable.GradientDrawable_thickness, state.mThickness);
if (state.mThickness == -1) {
state.mThicknessRatio = a.getFloat(R.styleable.GradientDrawable_thicknessRatio, state.mThicknessRatio);
}
state.mUseLevelForShape = a.getBoolean(R.styleable.GradientDrawable_useLevel, state.mUseLevelForShape);
}
final int tintMode = a.getInt(R.styleable.GradientDrawable_tintMode, -1);
if (tintMode != -1) {
state.mTintMode = Drawable.parseTintMode(tintMode, PorterDuff.Mode.SRC_IN);
}
final ColorStateList tint = a.getColorStateList(R.styleable.GradientDrawable_tint);
if (tint != null) {
state.mTint = tint;
}
final int insetLeft = a.getDimensionPixelSize(R.styleable.GradientDrawable_opticalInsetLeft, state.mOpticalInsets.left);
final int insetTop = a.getDimensionPixelSize(R.styleable.GradientDrawable_opticalInsetTop, state.mOpticalInsets.top);
final int insetRight = a.getDimensionPixelSize(R.styleable.GradientDrawable_opticalInsetRight, state.mOpticalInsets.right);
final int insetBottom = a.getDimensionPixelSize(R.styleable.GradientDrawable_opticalInsetBottom, state.mOpticalInsets.bottom);
state.mOpticalInsets = Insets.of(insetLeft, insetTop, insetRight, insetBottom);
}
use of android.content.res.ColorStateList in project android_frameworks_base by ResurrectionRemix.
the class Ticker method addEntry.
public void addEntry(StatusBarNotification n, boolean isMusic, MediaMetadata mediaMetaData) {
int initialCount = mSegments.size();
ContentResolver resolver = mContext.getContentResolver();
if (isMusic) {
CharSequence artist = mediaMetaData.getText(MediaMetadata.METADATA_KEY_ARTIST);
CharSequence album = mediaMetaData.getText(MediaMetadata.METADATA_KEY_ALBUM);
CharSequence title = mediaMetaData.getText(MediaMetadata.METADATA_KEY_TITLE);
if (artist != null && album != null && title != null) {
n.getNotification().tickerText = artist.toString() + " - " + album.toString() + " - " + title.toString();
} else {
return;
}
}
// a notification storm).
if (initialCount > 0) {
final Segment seg = mSegments.get(0);
if (n.getPackageName().equals(seg.notification.getPackageName()) && n.getNotification().icon == seg.notification.getNotification().icon && n.getNotification().iconLevel == seg.notification.getNotification().iconLevel && charSequencesEqual(seg.notification.getNotification().tickerText, n.getNotification().tickerText)) {
return;
}
}
final Drawable icon = StatusBarIconView.getIcon(mContext, new StatusBarIcon(n.getPackageName(), n.getUser(), n.getNotification().icon, n.getNotification().iconLevel, 0, n.getNotification().tickerText));
final CharSequence text = n.getNotification().tickerText;
final Segment newSegment = new Segment(n, icon, text);
final ColorStateList tickerIconColor = TickerColorHelper.getTickerIconColorList(mContext, mDefaultColor);
// If there's already a notification schedule for this package and id, remove it.
for (int i = 0; i < mSegments.size(); i++) {
Segment seg = mSegments.get(i);
if (n.getId() == seg.notification.getId() && n.getPackageName().equals(seg.notification.getPackageName())) {
// just update that one to use this new data instead
// restart iteration here
mSegments.remove(i--);
}
}
mSegments.add(newSegment);
if (initialCount == 0 && mSegments.size() > 0) {
Segment seg = mSegments.get(0);
seg.first = false;
mIconSwitcher.setAnimateFirstView(false);
mIconSwitcher.reset();
mIconSwitcher.setColoredImageDrawable(seg.icon, tickerIconColor);
mTextSwitcher.setAnimateFirstView(false);
mTextSwitcher.reset();
mTextSwitcher.setText(seg.getText());
updateTickerSize();
updateTextColor();
updateTickerFontStyle();
setTextSwitcherColor();
mTextSwitcher.setTextSize(mTickerFontSize);
mTextSwitcher.setTypeface(mFontStyle);
tickerStarting();
scheduleAdvance();
}
}
use of android.content.res.ColorStateList in project android_frameworks_base by ResurrectionRemix.
the class VolumeDialog method updateVolumeRowSliderTintH.
private void updateVolumeRowSliderTintH(VolumeRow row, boolean isActive) {
if (isActive && mExpanded) {
row.slider.requestFocus();
}
final ColorStateList tint = isActive && row.slider.isEnabled() ? mActiveSliderTint : mInactiveSliderTint;
if (tint == row.cachedSliderTint)
return;
row.cachedSliderTint = tint;
row.slider.setProgressTintList(tint);
row.slider.setThumbTintList(tint);
}
use of android.content.res.ColorStateList in project android_frameworks_base by ResurrectionRemix.
the class SimpleMonthView method setDayTextAppearance.
public void setDayTextAppearance(int resId) {
final ColorStateList textColor = applyTextAppearance(mDayPaint, resId);
if (textColor != null) {
mDayTextColor = textColor;
}
invalidate();
}
Aggregations