Merge "[Motion] Split-shade transition on LS: cross-fade status bars" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6e322a23e9
@@ -494,6 +494,9 @@ class LockscreenShadeTransitionController @Inject constructor(
|
|||||||
}
|
}
|
||||||
notificationPanelController
|
notificationPanelController
|
||||||
.setKeyguardTransitionProgress(keyguardAlpha, keyguardTranslationY)
|
.setKeyguardTransitionProgress(keyguardAlpha, keyguardTranslationY)
|
||||||
|
|
||||||
|
val statusBarAlpha = if (useSplitShade) keyguardAlpha else -1f
|
||||||
|
notificationPanelController.setKeyguardStatusBarAlpha(statusBarAlpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setDragDownAmountAnimated(
|
private fun setDragDownAmountAnimated(
|
||||||
|
|||||||
@@ -229,6 +229,11 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
|
|||||||
private boolean mShowingKeyguardHeadsUp;
|
private boolean mShowingKeyguardHeadsUp;
|
||||||
private StatusBarSystemEventAnimator mSystemEventAnimator;
|
private StatusBarSystemEventAnimator mSystemEventAnimator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The alpha value to be set on the View. If -1, this value is to be ignored.
|
||||||
|
*/
|
||||||
|
private float mExplicitAlpha = -1f;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public KeyguardStatusBarViewController(
|
public KeyguardStatusBarViewController(
|
||||||
KeyguardStatusBarView view,
|
KeyguardStatusBarView view,
|
||||||
@@ -425,9 +430,15 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
|
|||||||
|
|
||||||
float alphaQsExpansion = 1 - Math.min(
|
float alphaQsExpansion = 1 - Math.min(
|
||||||
1, mNotificationPanelViewStateProvider.getLockscreenShadeDragProgress() * 2);
|
1, mNotificationPanelViewStateProvider.getLockscreenShadeDragProgress() * 2);
|
||||||
float newAlpha = Math.min(getKeyguardContentsAlpha(), alphaQsExpansion)
|
|
||||||
|
float newAlpha;
|
||||||
|
if (mExplicitAlpha != -1) {
|
||||||
|
newAlpha = mExplicitAlpha;
|
||||||
|
} else {
|
||||||
|
newAlpha = Math.min(getKeyguardContentsAlpha(), alphaQsExpansion)
|
||||||
* mKeyguardStatusBarAnimateAlpha
|
* mKeyguardStatusBarAnimateAlpha
|
||||||
* (1.0f - mKeyguardHeadsUpShowingAmount);
|
* (1.0f - mKeyguardHeadsUpShowingAmount);
|
||||||
|
}
|
||||||
|
|
||||||
boolean hideForBypass =
|
boolean hideForBypass =
|
||||||
mFirstBypassAttempt && mKeyguardUpdateMonitor.shouldListenForFace()
|
mFirstBypassAttempt && mKeyguardUpdateMonitor.shouldListenForFace()
|
||||||
@@ -510,7 +521,17 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
|
|||||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
pw.println("KeyguardStatusBarView:");
|
pw.println("KeyguardStatusBarView:");
|
||||||
pw.println(" mBatteryListening: " + mBatteryListening);
|
pw.println(" mBatteryListening: " + mBatteryListening);
|
||||||
|
pw.println(" mExplicitAlpha: " + mExplicitAlpha);
|
||||||
mView.dump(fd, pw, args);
|
mView.dump(fd, pw, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the alpha to be set on the view.
|
||||||
|
*
|
||||||
|
* @param alpha a value between 0 and 1. -1 if the value is to be reset/ignored.
|
||||||
|
*/
|
||||||
|
public void setAlpha(float alpha) {
|
||||||
|
mExplicitAlpha = alpha;
|
||||||
|
updateViewState();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2682,6 +2682,15 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
updateClock();
|
updateClock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the alpha value to be set on the keyguard status bar.
|
||||||
|
*
|
||||||
|
* @param alpha value between 0 and 1. -1 if the value is to be reset.
|
||||||
|
*/
|
||||||
|
public void setKeyguardStatusBarAlpha(float alpha) {
|
||||||
|
mKeyguardStatusBarViewController.setAlpha(alpha);
|
||||||
|
}
|
||||||
|
|
||||||
private void trackMovement(MotionEvent event) {
|
private void trackMovement(MotionEvent event) {
|
||||||
if (mQsVelocityTracker != null) mQsVelocityTracker.addMovement(event);
|
if (mQsVelocityTracker != null) mQsVelocityTracker.addMovement(event);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -424,6 +424,28 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() {
|
|||||||
verifyZeroInteractions(singleShadeOverScroller)
|
verifyZeroInteractions(singleShadeOverScroller)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun setDragDownAmount_inSplitShade_setsKeyguardStatusBarAlphaBasedOnDistance() {
|
||||||
|
val alphaDistance = context.resources.getDimensionPixelSize(
|
||||||
|
R.dimen.lockscreen_shade_npvc_keyguard_content_alpha_transition_distance)
|
||||||
|
val dragDownAmount = 10f
|
||||||
|
enableSplitShade()
|
||||||
|
|
||||||
|
transitionController.dragDownAmount = dragDownAmount
|
||||||
|
|
||||||
|
val expectedAlpha = 1 - dragDownAmount / alphaDistance
|
||||||
|
verify(notificationPanelController).setKeyguardStatusBarAlpha(expectedAlpha)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun setDragDownAmount_notInSplitShade_setsKeyguardStatusBarAlphaToMinusOne() {
|
||||||
|
disableSplitShade()
|
||||||
|
|
||||||
|
transitionController.dragDownAmount = 10f
|
||||||
|
|
||||||
|
verify(notificationPanelController).setKeyguardStatusBarAlpha(-1f)
|
||||||
|
}
|
||||||
|
|
||||||
private fun enableSplitShade() {
|
private fun enableSplitShade() {
|
||||||
setSplitShadeEnabled(true)
|
setSplitShadeEnabled(true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -343,6 +343,28 @@ public class KeyguardStatusBarViewControllerTest extends SysuiTestCase {
|
|||||||
assertThat(mKeyguardStatusBarView.getVisibility()).isEqualTo(View.INVISIBLE);
|
assertThat(mKeyguardStatusBarView.getVisibility()).isEqualTo(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setAlpha_explicitAlpha_setsExplicitAlpha() {
|
||||||
|
mController.onViewAttached();
|
||||||
|
updateStateToKeyguard();
|
||||||
|
|
||||||
|
mController.setAlpha(0.5f);
|
||||||
|
|
||||||
|
assertThat(mKeyguardStatusBarView.getAlpha()).isEqualTo(0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setAlpha_explicitAlpha_thenMinusOneAlpha_setsAlphaBasedOnDefaultCriteria() {
|
||||||
|
mController.onViewAttached();
|
||||||
|
updateStateToKeyguard();
|
||||||
|
|
||||||
|
mController.setAlpha(0.5f);
|
||||||
|
mController.setAlpha(-1f);
|
||||||
|
|
||||||
|
assertThat(mKeyguardStatusBarView.getAlpha()).isGreaterThan(0);
|
||||||
|
assertThat(mKeyguardStatusBarView.getAlpha()).isNotEqualTo(0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(b/195442899): Add more tests for #updateViewState once CLs are finalized.
|
// TODO(b/195442899): Add more tests for #updateViewState once CLs are finalized.
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -938,6 +938,15 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
|||||||
verify(mScrimController).setExpansionAffectsAlpha(true);
|
verify(mScrimController).setExpansionAffectsAlpha(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setKeyguardStatusBarAlpha_setsAlphaOnKeyguardStatusBarController() {
|
||||||
|
float statusBarAlpha = 0.5f;
|
||||||
|
|
||||||
|
mNotificationPanelViewController.setKeyguardStatusBarAlpha(statusBarAlpha);
|
||||||
|
|
||||||
|
verify(mKeyguardStatusBarViewController).setAlpha(statusBarAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
private void triggerPositionClockAndNotifications() {
|
private void triggerPositionClockAndNotifications() {
|
||||||
mNotificationPanelViewController.closeQs();
|
mNotificationPanelViewController.closeQs();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user