AmbientIndication: Move into container
This allows fixing the following bugs: - ambient indication should be hidden outside keyguard - ambient indication should animate with the unlock hint - ambient indication should fade out when unlocking Fixes: 38289189 Test: observe that the things above are working correctly Change-Id: I34aff69bb5621a3f12c25e87eac6a89c8c7e2165
This commit is contained in:
@@ -56,7 +56,8 @@
|
||||
android:layout_gravity="@integer/notification_panel_layout_gravity"
|
||||
android:layout_marginBottom="@dimen/close_handle_underlap" />
|
||||
|
||||
<include layout="@layout/ambient_indication" />
|
||||
<include layout="@layout/ambient_indication"
|
||||
android:id="@+id/ambient_indication_container" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/keyguard_user_switcher"
|
||||
|
||||
@@ -1672,6 +1672,10 @@ public class NotificationPanelView extends PanelView implements
|
||||
mKeyguardBottomArea.setImportantForAccessibility(alpha == 0f
|
||||
? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
|
||||
: IMPORTANT_FOR_ACCESSIBILITY_AUTO);
|
||||
View ambientIndicationContainer = mStatusBar.getAmbientIndicationContainer();
|
||||
if (ambientIndicationContainer != null) {
|
||||
ambientIndicationContainer.setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
private float getNotificationsTopY() {
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.InputDevice;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.animation.Interpolator;
|
||||
@@ -1071,21 +1072,25 @@ public abstract class PanelView extends FrameLayout {
|
||||
});
|
||||
animator.start();
|
||||
mHeightAnimator = animator;
|
||||
mKeyguardBottomArea.getIndicationArea().animate()
|
||||
.translationY(-mHintDistance)
|
||||
.setDuration(250)
|
||||
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
||||
.withEndAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mKeyguardBottomArea.getIndicationArea().animate()
|
||||
.translationY(0)
|
||||
.setDuration(450)
|
||||
.setInterpolator(mBounceInterpolator)
|
||||
.start();
|
||||
}
|
||||
})
|
||||
.start();
|
||||
|
||||
View[] viewsToAnimate = {
|
||||
mKeyguardBottomArea.getIndicationArea(),
|
||||
mStatusBar.getAmbientIndicationContainer()};
|
||||
for (View v : viewsToAnimate) {
|
||||
if (v == null) {
|
||||
continue;
|
||||
}
|
||||
v.animate()
|
||||
.translationY(-mHintDistance)
|
||||
.setDuration(250)
|
||||
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
||||
.withEndAction(() -> v.animate()
|
||||
.translationY(0)
|
||||
.setDuration(450)
|
||||
.setInterpolator(mBounceInterpolator)
|
||||
.start())
|
||||
.start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,7 @@ import android.R.style;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManager.StackId;
|
||||
import android.app.ActivityOptions;
|
||||
@@ -730,6 +731,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
private boolean mReinflateNotificationsOnUserSwitched;
|
||||
private HashMap<String, Entry> mPendingNotifications = new HashMap<>();
|
||||
private boolean mClearAllEnabled;
|
||||
@Nullable private View mAmbientIndicationContainer;
|
||||
|
||||
private void recycleAllVisibilityObjects(ArraySet<NotificationVisibility> array) {
|
||||
final int N = array.size();
|
||||
@@ -1081,6 +1083,9 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
mKeyguardBottomArea.getLockIcon());
|
||||
mKeyguardBottomArea.setKeyguardIndicationController(mKeyguardIndicationController);
|
||||
|
||||
mAmbientIndicationContainer = mStatusBarWindow.findViewById(
|
||||
R.id.ambient_indication_container);
|
||||
|
||||
// set the initial view visibility
|
||||
setAreThereNotifications();
|
||||
|
||||
@@ -2785,6 +2790,11 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
return mKeyguardIndicationController;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public View getAmbientIndicationContainer() {
|
||||
return mAmbientIndicationContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* All changes to the status bar and notifications funnel through here and are batched.
|
||||
*/
|
||||
@@ -4393,6 +4403,9 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
mKeyguardUserSwitcher.setKeyguard(true, fromShadeLocked);
|
||||
}
|
||||
mStatusBarView.removePendingHideExpandedRunnables();
|
||||
if (mAmbientIndicationContainer != null) {
|
||||
mAmbientIndicationContainer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
mKeyguardIndicationController.setVisible(false);
|
||||
if (mKeyguardUserSwitcher != null) {
|
||||
@@ -4401,6 +4414,9 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
mState == StatusBarState.SHADE_LOCKED ||
|
||||
fromShadeLocked);
|
||||
}
|
||||
if (mAmbientIndicationContainer != null) {
|
||||
mAmbientIndicationContainer.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
|
||||
mScrimController.setKeyguardShowing(true);
|
||||
|
||||
Reference in New Issue
Block a user