import android.view.View;
import android.view.ViewGroup;
+import com.android.internal.widget.CachingIconView;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.ViewInvertHelper;
super.setDark(dark, fade, delay);
if (mDark == dark) return;
mDark = dark;
- mShelfIcons.setDark(dark, fade, delay);
+ if (fade) {
+ mViewInvertHelper.fade(dark, delay);
+ } else {
+ mViewInvertHelper.update(dark);
+ }
+ mShelfIcons.setAmbient(dark);
}
@Override
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
-import com.android.systemui.statusbar.notification.NotificationIconDozeHelper;
import com.android.systemui.statusbar.notification.NotificationUtils;
import java.text.NumberFormat;
private int mDensity;
private float mIconScale = 1.0f;
private final Paint mDotPaint = new Paint();
+ private boolean mDotVisible;
private float mDotRadius;
private int mStaticDotRadius;
private int mVisibleState = STATE_ICON;
private OnVisibilityChangedListener mOnVisibilityChangedListener;
private int mDrawableColor;
private int mIconColor;
- private int mDecorColor;
- private float mDarkAmount;
private ValueAnimator mColorAnimator;
private int mCurrentSetColor = NO_COLOR;
private int mAnimationStartColor = NO_COLOR;
animation.getAnimatedFraction());
setColorInternal(newColor);
};
- private final NotificationIconDozeHelper mDozer;
public StatusBarIconView(Context context, String slot, Notification notification) {
this(context, slot, notification, false);
public StatusBarIconView(Context context, String slot, Notification notification,
boolean blocked) {
super(context);
- mDozer = new NotificationIconDozeHelper(context);
mBlocked = blocked;
mSlot = slot;
mNumberPain = new Paint();
public StatusBarIconView(Context context, AttributeSet attrs) {
super(context, attrs);
- mDozer = new NotificationIconDozeHelper(context);
mBlocked = false;
mAlwaysScaleIcon = true;
updateIconScale();
* to the drawable.
*/
public void setDecorColor(int iconTint) {
- mDecorColor = iconTint;
- updateDecorColor();
- }
-
- private void updateDecorColor() {
- int color = NotificationUtils.interpolateColors(mDecorColor, Color.WHITE, mDarkAmount);
- if (mDotPaint.getColor() != color) {
- mDotPaint.setColor(color);
-
- if (mDotAppearAmount != 0) {
- invalidate();
- }
- }
+ mDotPaint.setColor(iconTint);
}
/**
mDrawableColor = color;
setColorInternal(color);
mIconColor = color;
- mDozer.setColor(color);
}
private void setColorInternal(int color) {
mOnVisibilityChangedListener = listener;
}
- public void setDark(boolean dark, boolean fade, long delay) {
- mDozer.setImageDark(this, dark, fade, delay, mIconColor != NO_COLOR);
- mDozer.setIntensityDark(f -> {
- mDarkAmount = f;
- updateDecorColor();
- }, dark, fade, delay);
- }
-
public interface OnVisibilityChangedListener {
void onVisibilityChanged(int newVisibility);
}
import com.android.systemui.Interpolators;
import com.android.systemui.statusbar.phone.NotificationPanelView;
-import java.util.function.Consumer;
-
public class NotificationDozeHelper {
private final ColorMatrix mGrayscaleColorMatrix = new ColorMatrix();
animator.start();
}
- public void setIntensityDark(Consumer<Float> listener, boolean dark,
- boolean animate, long delay) {
- if (animate) {
- startIntensityAnimation(a -> listener.accept((Float) a.getAnimatedValue()), dark, delay,
- null /* listener */);
- } else {
- listener.accept(dark ? 1f : 0f);
- }
- }
-
public void updateGrayscaleMatrix(float intensity) {
mGrayscaleColorMatrix.setSaturation(1 - intensity);
}
private int mActualLayoutWidth = NO_VALUE;
private float mActualPaddingEnd = NO_VALUE;
private float mActualPaddingStart = NO_VALUE;
- private boolean mDark;
+ private boolean mCentered;
private boolean mChangingViewPositions;
private int mAddAnimationStartIndex = -1;
private int mCannedAnimationStartIndex = -1;
mAddAnimationStartIndex = Math.min(mAddAnimationStartIndex, childIndex);
}
}
- if (mDark && child instanceof StatusBarIconView) {
- ((StatusBarIconView) child).setDark(mDark, false, 0);
- }
}
@Override
numDots++;
}
}
- boolean center = mDark;
- if (center && translationX < getLayoutEnd()) {
+ if (mCentered && translationX < getLayoutEnd()) {
float delta = (getLayoutEnd() - translationX) / 2;
for (int i = 0; i < childCount; i++) {
View view = getChildAt(i);
mChangingViewPositions = changingViewPositions;
}
- public void setDark(boolean dark, boolean fade, long delay) {
- mDark = dark;
+ public void setAmbient(boolean ambient) {
+ mCentered = ambient;
mDisallowNextAnimation = true;
- for (int i = 0; i < getChildCount(); i++) {
- View view = getChildAt(i);
- if (view instanceof StatusBarIconView) {
- ((StatusBarIconView) view).setDark(dark, fade, delay);
- }
- }
}
public IconState getIconState(StatusBarIconView icon) {