Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00511d3d authored by Selim Cinek's avatar Selim Cinek Committed by android-build-merger
Browse files

Merge changes Ic76d996f,Ib9eefacb,If1b63340,I399c66af into oc-dev am: 947be6be

am: c40344bf

Change-Id: I849b78ceb45e22ab1b63bf4fbb88aac40625fd22
parents 9ab0f438 c40344bf
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -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
                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;
+17 −5
Original line number Diff line number Diff line
@@ -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]);
    }
+10 −0
Original line number Diff line number Diff line
@@ -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;
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -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.
+8 −7
Original line number Diff line number Diff line
@@ -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);
    }

Loading