Merge "Fade notifications with background scrim for shade expansion" into sc-dev
This commit is contained in:
@@ -70,4 +70,17 @@ public class Interpolators {
|
||||
*/
|
||||
public static final Interpolator TOUCH_RESPONSE_REVERSE =
|
||||
new PathInterpolator(0.9f, 0f, 0.7f, 1f);
|
||||
|
||||
/**
|
||||
* Interpolate alpha for notifications background scrim during shade expansion.
|
||||
* @param fraction Shade expansion fraction
|
||||
*/
|
||||
public static float getNotificationScrimAlpha(float fraction) {
|
||||
fraction = fraction * 1.2f - 0.2f;
|
||||
if (fraction <= 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return (float) (1f - 0.5f * (1f - Math.cos(3.14159f * Math.pow(1f - fraction, 2f))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.view.WindowInsets;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.systemui.animation.Interpolators;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
|
||||
import com.android.systemui.statusbar.notification.NotificationUtils;
|
||||
@@ -176,7 +177,13 @@ public class NotificationShelf extends ActivatableNotificationView implements
|
||||
viewState.height = getIntrinsicHeight();
|
||||
viewState.zTranslation = ambientState.getBaseZHeight();
|
||||
viewState.clipTopAmount = 0;
|
||||
viewState.alpha = 1f - ambientState.getHideAmount();
|
||||
|
||||
if (ambientState.isExpansionChanging() && !ambientState.isOnKeyguard()) {
|
||||
viewState.alpha = Interpolators.getNotificationScrimAlpha(
|
||||
ambientState.getExpansionFraction());
|
||||
} else {
|
||||
viewState.alpha = 1f - ambientState.getHideAmount();
|
||||
}
|
||||
viewState.belowSpeedBump = mHostLayoutController.getSpeedBumpIndex() == 0;
|
||||
viewState.hideSensitive = false;
|
||||
viewState.xTranslation = getTranslationX();
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.util.MathUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.android.systemui.animation.Interpolators;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.statusbar.NotificationShelf;
|
||||
import com.android.systemui.statusbar.notification.dagger.SilentHeader;
|
||||
@@ -374,7 +375,13 @@ public class StackScrollAlgorithm {
|
||||
ExpandableView view = algorithmState.visibleChildren.get(i);
|
||||
ExpandableViewState viewState = view.getViewState();
|
||||
viewState.location = ExpandableViewState.LOCATION_UNKNOWN;
|
||||
viewState.alpha = 1f - ambientState.getHideAmount();
|
||||
|
||||
if (ambientState.isExpansionChanging() && !ambientState.isOnKeyguard()) {
|
||||
viewState.alpha = Interpolators.getNotificationScrimAlpha(
|
||||
ambientState.getExpansionFraction());
|
||||
} else {
|
||||
viewState.alpha = 1f - ambientState.getHideAmount();
|
||||
}
|
||||
|
||||
if (view.mustStayOnScreen() && viewState.yTranslation >= 0) {
|
||||
// Even if we're not scrolled away we're in view and we're also not in the
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.android.internal.util.function.TriConsumer;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.keyguard.KeyguardUpdateMonitorCallback;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.animation.Interpolators;
|
||||
import com.android.systemui.DejankUtils;
|
||||
import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.R;
|
||||
@@ -810,15 +811,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
||||
}
|
||||
|
||||
private float getInterpolatedFraction() {
|
||||
float frac = mPanelExpansion;
|
||||
// let's start this 20% of the way down the screen
|
||||
frac = frac * 1.2f - 0.2f;
|
||||
if (frac <= 0) {
|
||||
return 0;
|
||||
} else {
|
||||
// woo, special effects
|
||||
return (float) (1f - 0.5f * (1f - Math.cos(3.14159f * Math.pow(1f - frac, 2f))));
|
||||
}
|
||||
return Interpolators.getNotificationScrimAlpha(mPanelExpansion);
|
||||
}
|
||||
|
||||
private void setScrimAlpha(ScrimView scrim, float alpha) {
|
||||
|
||||
Reference in New Issue
Block a user