Merge "Fixed the background for low-priority legacy notifications"
This commit is contained in:
@@ -38,7 +38,6 @@ import com.android.systemui.R;
|
||||
import com.android.systemui.classifier.FalsingManager;
|
||||
import com.android.systemui.statusbar.notification.FakeShadowView;
|
||||
import com.android.systemui.statusbar.notification.NotificationUtils;
|
||||
import com.android.systemui.statusbar.policy.AccessibilityController;
|
||||
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
|
||||
import com.android.systemui.statusbar.stack.StackStateAnimator;
|
||||
|
||||
@@ -140,8 +139,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
|
||||
private ValueAnimator mBackgroundColorAnimator;
|
||||
private float mAppearAnimationFraction = -1.0f;
|
||||
private float mAppearAnimationTranslation;
|
||||
private boolean mShowingLegacyBackground;
|
||||
private final int mLegacyColor;
|
||||
private final int mNormalColor;
|
||||
private final int mLowPriorityColor;
|
||||
private boolean mIsBelowSpeedBump;
|
||||
@@ -192,7 +189,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
|
||||
mSlowOutLinearInInterpolator = new PathInterpolator(0.8f, 0.0f, 1.0f, 1.0f);
|
||||
setClipChildren(false);
|
||||
setClipToPadding(false);
|
||||
mLegacyColor = context.getColor(R.color.notification_legacy_background_color);
|
||||
mNormalColor = context.getColor(R.color.notification_material_background_color);
|
||||
mLowPriorityColor = context.getColor(
|
||||
R.color.notification_material_background_low_priority_color);
|
||||
@@ -489,11 +485,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
|
||||
updateOutlineAlpha();
|
||||
}
|
||||
|
||||
public void setShowingLegacyBackground(boolean showing) {
|
||||
mShowingLegacyBackground = showing;
|
||||
updateBackgroundTint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBelowSpeedBump(boolean below) {
|
||||
super.setBelowSpeedBump(below);
|
||||
@@ -950,8 +941,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
|
||||
}
|
||||
if (withTint && mBgTint != NO_COLOR) {
|
||||
return mBgTint;
|
||||
} else if (mShowingLegacyBackground) {
|
||||
return mLegacyColor;
|
||||
} else if (mIsBelowSpeedBump) {
|
||||
return mLowPriorityColor;
|
||||
} else {
|
||||
@@ -962,8 +951,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
|
||||
protected int getRippleColor() {
|
||||
if (mBgTint != 0) {
|
||||
return mTintedRippleColor;
|
||||
} else if (mShowingLegacyBackground) {
|
||||
return mTintedRippleColor;
|
||||
} else if (mIsBelowSpeedBump) {
|
||||
return mLowPriorityRippleColor;
|
||||
} else {
|
||||
@@ -1009,7 +996,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
|
||||
public void reset() {
|
||||
setTintColor(0);
|
||||
resetBackgroundAlpha();
|
||||
setShowingLegacyBackground(false);
|
||||
setBelowSpeedBump(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1796,9 +1796,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
return mShowingPublic ? mPublicLayout : mPrivateLayout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShowingLegacyBackground(boolean showing) {
|
||||
super.setShowingLegacyBackground(showing);
|
||||
for (NotificationContentView l : mLayouts) {
|
||||
l.setShowingLegacyBackground(showing);
|
||||
}
|
||||
|
||||
@@ -41,10 +41,12 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper {
|
||||
private final ViewInvertHelper mInvertHelper;
|
||||
private final Paint mGreyPaint = new Paint();
|
||||
private boolean mShowingLegacyBackground;
|
||||
private int mLegacyColor;
|
||||
|
||||
protected NotificationCustomViewWrapper(View view, ExpandableNotificationRow row) {
|
||||
super(view, row);
|
||||
mInvertHelper = new ViewInvertHelper(view, NotificationPanelView.DOZE_ANIMATION_DURATION);
|
||||
mLegacyColor = row.getContext().getColor(R.color.notification_legacy_background_color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,6 +104,15 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper {
|
||||
mView.setAlpha(visible ? 1.0f : 0.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCustomBackgroundColor() {
|
||||
int customBackgroundColor = super.getCustomBackgroundColor();
|
||||
if (customBackgroundColor == 0 && mShowingLegacyBackground) {
|
||||
return mLegacyColor;
|
||||
}
|
||||
return customBackgroundColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShowingLegacyBackground(boolean showing) {
|
||||
super.setShowingLegacyBackground(showing);
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package com.android.systemui.statusbar;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.annotation.UiThreadTest;
|
||||
@@ -31,6 +28,11 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyFloat;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class NotificationContentViewTest {
|
||||
@@ -39,13 +41,16 @@ public class NotificationContentViewTest {
|
||||
Context mContext;
|
||||
|
||||
@Before
|
||||
@UiThreadTest
|
||||
public void setup() {
|
||||
ExpandableNotificationRow rowMock = mock(ExpandableNotificationRow.class);
|
||||
when(rowMock.getIntrinsicHeight()).thenReturn(10);
|
||||
|
||||
mContext = InstrumentationRegistry.getTargetContext();
|
||||
mView = new NotificationContentView(mContext, null);
|
||||
mView.setContainingNotification(rowMock);
|
||||
ExpandableNotificationRow row = new ExpandableNotificationRow(mContext, null);
|
||||
ExpandableNotificationRow mockRow = spy(row);
|
||||
doNothing().when(mockRow).updateBackgroundAlpha(anyFloat());
|
||||
doReturn(10).when(mockRow).getIntrinsicHeight();
|
||||
|
||||
mView.setContainingNotification(mockRow);
|
||||
mView.setHeights(10, 20, 30, 40);
|
||||
|
||||
mView.setContractedChild(createViewWithHeight(10));
|
||||
|
||||
Reference in New Issue
Block a user