Merge changes Ic76d996f,Ib9eefacb,If1b63340,I399c66af into oc-dev
* changes: Changed the documentation of the colorization Fixed the appearance of colorized fullscreenintent notifications Adapted the interpolator when using fingerprint The row is now labeling the expand button
This commit is contained in:
@@ -3251,7 +3251,6 @@ public class Notification implements Parcelable
|
||||
* However, for {@link MediaStyle} and {@link DecoratedMediaCustomViewStyle} notifications
|
||||
* that have a media session attached there is no such requirement.
|
||||
*
|
||||
* @see Builder#setOngoing(boolean)
|
||||
* @see Builder#setColor(int)
|
||||
* @see MediaStyle#setMediaSession(MediaSession.Token)
|
||||
*/
|
||||
@@ -3742,6 +3741,11 @@ public class Notification implements Parcelable
|
||||
return mActionBarColor;
|
||||
}
|
||||
|
||||
private int getActionBarColorDeEmphasized() {
|
||||
int backgroundColor = getBackgroundColor();
|
||||
return NotificationColorUtil.getShiftedColor(backgroundColor, 12);
|
||||
}
|
||||
|
||||
private void setTextViewColorSecondary(RemoteViews contentView, int id) {
|
||||
ensureColors();
|
||||
contentView.setTextColor(id, mSecondaryTextColor);
|
||||
@@ -4316,8 +4320,13 @@ public class Notification implements Parcelable
|
||||
// TODO: handle emphasized mode / actions right
|
||||
if (emphazisedMode) {
|
||||
// change the background bgColor
|
||||
int bgColor = mContext.getColor(oddAction ? R.color.notification_action_list
|
||||
: R.color.notification_action_list_dark);
|
||||
int bgColor;
|
||||
if (isColorized()) {
|
||||
bgColor = oddAction ? getActionBarColor() : getActionBarColorDeEmphasized();
|
||||
} else {
|
||||
bgColor = mContext.getColor(oddAction ? R.color.notification_action_list
|
||||
: R.color.notification_action_list_dark);
|
||||
}
|
||||
button.setDrawableParameters(R.id.button_holder, true, -1, bgColor,
|
||||
PorterDuff.Mode.SRC_ATOP, -1);
|
||||
CharSequence title = action.title;
|
||||
|
||||
@@ -460,13 +460,25 @@ public class NotificationColorUtil {
|
||||
if (backgroundColor == Notification.COLOR_DEFAULT) {
|
||||
return context.getColor(com.android.internal.R.color.notification_action_list);
|
||||
}
|
||||
boolean useDark = shouldUseDark(backgroundColor);
|
||||
return getShiftedColor(backgroundColor, 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a color that stays in the same tint, but darkens or lightens it by a certain
|
||||
* amount.
|
||||
* This also looks at the lightness of the provided color and shifts it appropriately.
|
||||
*
|
||||
* @param color the base color to use
|
||||
* @param amount the amount from 1 to 100 how much to modify the color
|
||||
* @return the now color that was modified
|
||||
*/
|
||||
public static int getShiftedColor(int color, int amount) {
|
||||
final double[] result = ColorUtilsFromCompat.getTempDouble3Array();
|
||||
ColorUtilsFromCompat.colorToLAB(backgroundColor, result);
|
||||
if (useDark && result[0] < 97 || !useDark && result[0] < 4) {
|
||||
result[0] = Math.min(100, result[0] + 7);
|
||||
ColorUtilsFromCompat.colorToLAB(color, result);
|
||||
if (result[0] >= 4) {
|
||||
result[0] = Math.max(0, result[0] - amount);
|
||||
} else {
|
||||
result[0] = Math.max(0, result[0] - 7);
|
||||
result[0] = Math.min(100, result[0] + amount);
|
||||
}
|
||||
return ColorUtilsFromCompat.LABToColor(result[0], result[1], result[2]);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
@@ -30,6 +31,8 @@ import android.widget.RemoteViews;
|
||||
*/
|
||||
@RemoteViews.RemoteView
|
||||
public class NotificationExpandButton extends ImageView {
|
||||
private View mLabeledBy;
|
||||
|
||||
public NotificationExpandButton(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@@ -66,5 +69,12 @@ public class NotificationExpandButton extends ImageView {
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
||||
super.onInitializeAccessibilityNodeInfo(info);
|
||||
info.setClassName(Button.class.getName());
|
||||
if (mLabeledBy != null) {
|
||||
info.setLabeledBy(mLabeledBy);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabeledBy(View labeledBy) {
|
||||
mLabeledBy = labeledBy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ public class Interpolators {
|
||||
public static final Interpolator CUSTOM_40_40 = new PathInterpolator(0.4f, 0f, 0.6f, 1f);
|
||||
public static final Interpolator HEADS_UP_APPEAR = new HeadsUpAppearInterpolator();
|
||||
public static final Interpolator ICON_OVERSHOT = new PathInterpolator(0.4f, 0f, 0.2f, 1.4f);
|
||||
public static final Interpolator PANEL_CLOSE_ACCELERATED
|
||||
= new PathInterpolator(0.3f, 0, 0.5f, 1);
|
||||
|
||||
/**
|
||||
* Interpolator to be used when animating a move based on a click. Pair with enough duration.
|
||||
|
||||
@@ -29,6 +29,7 @@ import android.view.animation.PathInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.widget.NotificationExpandButton;
|
||||
import com.android.systemui.Interpolators;
|
||||
import com.android.systemui.ViewInvertHelper;
|
||||
import com.android.systemui.statusbar.ExpandableNotificationRow;
|
||||
@@ -54,7 +55,7 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
|
||||
protected int mColor;
|
||||
private ImageView mIcon;
|
||||
|
||||
private ImageView mExpandButton;
|
||||
private NotificationExpandButton mExpandButton;
|
||||
private NotificationHeaderView mNotificationHeader;
|
||||
private TextView mHeaderText;
|
||||
private ImageView mWorkProfileImage;
|
||||
@@ -106,13 +107,13 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
|
||||
}
|
||||
|
||||
protected void resolveHeaderViews() {
|
||||
mIcon = (ImageView) mView.findViewById(com.android.internal.R.id.icon);
|
||||
mHeaderText = (TextView) mView.findViewById(com.android.internal.R.id.header_text);
|
||||
mExpandButton = (ImageView) mView.findViewById(com.android.internal.R.id.expand_button);
|
||||
mWorkProfileImage = (ImageView) mView.findViewById(com.android.internal.R.id.profile_badge);
|
||||
mIcon = mView.findViewById(com.android.internal.R.id.icon);
|
||||
mHeaderText = mView.findViewById(com.android.internal.R.id.header_text);
|
||||
mExpandButton = mView.findViewById(com.android.internal.R.id.expand_button);
|
||||
mExpandButton.setLabeledBy(mRow);
|
||||
mWorkProfileImage = mView.findViewById(com.android.internal.R.id.profile_badge);
|
||||
mColor = resolveColor(mExpandButton);
|
||||
mNotificationHeader = (NotificationHeaderView) mView.findViewById(
|
||||
com.android.internal.R.id.notification_header);
|
||||
mNotificationHeader = mView.findViewById(com.android.internal.R.id.notification_header);
|
||||
getDozer().setColor(mColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
|
||||
/**
|
||||
* How much faster we collapse the lockscreen when authenticating with fingerprint.
|
||||
*/
|
||||
private static final float FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR = 1.3f;
|
||||
private static final float FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR = 1.1f;
|
||||
|
||||
private PowerManager mPowerManager;
|
||||
private Handler mHandler = new Handler();
|
||||
|
||||
@@ -2022,7 +2022,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
@Override
|
||||
protected boolean shouldUseDismissingAnimation() {
|
||||
return mStatusBarState != StatusBarState.SHADE
|
||||
&& !mStatusBar.isKeyguardCurrentlySecure();
|
||||
&& (!mStatusBar.isKeyguardCurrentlySecure() || !isTracking());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -725,8 +725,14 @@ public abstract class PanelView extends FrameLayout {
|
||||
}
|
||||
} else {
|
||||
if (shouldUseDismissingAnimation()) {
|
||||
mFlingAnimationUtilsDismissing.apply(animator, mExpandedHeight, target, vel,
|
||||
getHeight());
|
||||
if (vel == 0) {
|
||||
animator.setInterpolator(Interpolators.PANEL_CLOSE_ACCELERATED);
|
||||
long duration = (long) (200 + mExpandedHeight / getHeight() * 100);
|
||||
animator.setDuration(duration);
|
||||
} else {
|
||||
mFlingAnimationUtilsDismissing.apply(animator, mExpandedHeight, target, vel,
|
||||
getHeight());
|
||||
}
|
||||
} else {
|
||||
mFlingAnimationUtilsClosing
|
||||
.apply(animator, mExpandedHeight, target, vel, getHeight());
|
||||
|
||||
Reference in New Issue
Block a user