|
|
|
|
@@ -39,6 +39,7 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackScroll
|
|
|
|
|
import com.android.systemui.statusbar.phone.fragment.dagger.StatusBarFragmentScope;
|
|
|
|
|
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
|
|
|
|
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
|
|
|
|
|
import com.android.systemui.util.ViewController;
|
|
|
|
|
|
|
|
|
|
import java.util.function.BiConsumer;
|
|
|
|
|
import java.util.function.Consumer;
|
|
|
|
|
@@ -49,14 +50,15 @@ import javax.inject.Inject;
|
|
|
|
|
* Controls the appearance of heads up notifications in the icon area and the header itself.
|
|
|
|
|
*/
|
|
|
|
|
@StatusBarFragmentScope
|
|
|
|
|
public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|
|
|
|
DarkIconDispatcher.DarkReceiver, NotificationWakeUpCoordinator.WakeUpListener {
|
|
|
|
|
public class HeadsUpAppearanceController extends ViewController<HeadsUpStatusBarView>
|
|
|
|
|
implements OnHeadsUpChangedListener,
|
|
|
|
|
DarkIconDispatcher.DarkReceiver,
|
|
|
|
|
NotificationWakeUpCoordinator.WakeUpListener {
|
|
|
|
|
public static final int CONTENT_FADE_DURATION = 110;
|
|
|
|
|
public static final int CONTENT_FADE_DELAY = 100;
|
|
|
|
|
private final NotificationIconAreaController mNotificationIconAreaController;
|
|
|
|
|
private final HeadsUpManagerPhone mHeadsUpManager;
|
|
|
|
|
private final NotificationStackScrollLayoutController mStackScrollerController;
|
|
|
|
|
private final HeadsUpStatusBarView mHeadsUpStatusBarView;
|
|
|
|
|
private final View mCenteredIconView;
|
|
|
|
|
private final View mClockView;
|
|
|
|
|
private final View mOperatorNameView;
|
|
|
|
|
@@ -125,13 +127,10 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|
|
|
|
View clockView,
|
|
|
|
|
View operatorNameView,
|
|
|
|
|
View centeredIconView) {
|
|
|
|
|
super(headsUpStatusBarView);
|
|
|
|
|
mNotificationIconAreaController = notificationIconAreaController;
|
|
|
|
|
mHeadsUpManager = headsUpManager;
|
|
|
|
|
mHeadsUpManager.addListener(this);
|
|
|
|
|
mHeadsUpStatusBarView = headsUpStatusBarView;
|
|
|
|
|
mCenteredIconView = centeredIconView;
|
|
|
|
|
headsUpStatusBarView.setOnDrawingRectChangedListener(
|
|
|
|
|
() -> updateIsolatedIconLocation(true /* requireUpdate */));
|
|
|
|
|
|
|
|
|
|
// We may be mid-HUN-expansion when this controller is re-created (for example, if the user
|
|
|
|
|
// has started pulling down the notification shade from the HUN and then the font size
|
|
|
|
|
@@ -143,16 +142,12 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|
|
|
|
|
|
|
|
|
mStackScrollerController = stackScrollerController;
|
|
|
|
|
mNotificationPanelViewController = notificationPanelViewController;
|
|
|
|
|
notificationPanelViewController.addTrackingHeadsUpListener(mSetTrackingHeadsUp);
|
|
|
|
|
notificationPanelViewController.setHeadsUpAppearanceController(this);
|
|
|
|
|
mStackScrollerController.addOnExpandedHeightChangedListener(mSetExpandedHeight);
|
|
|
|
|
mStackScrollerController.setHeadsUpAppearanceController(this);
|
|
|
|
|
mClockView = clockView;
|
|
|
|
|
mOperatorNameView = operatorNameView;
|
|
|
|
|
mDarkIconDispatcher = Dependency.get(DarkIconDispatcher.class);
|
|
|
|
|
mDarkIconDispatcher.addDarkReceiver(this);
|
|
|
|
|
|
|
|
|
|
mHeadsUpStatusBarView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
|
|
|
|
mView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onLayoutChange(View v, int left, int top, int right, int bottom,
|
|
|
|
|
int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
|
|
|
|
@@ -162,21 +157,32 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|
|
|
|
// trigger scroller to notify the latest panel translation
|
|
|
|
|
mStackScrollerController.requestLayout();
|
|
|
|
|
}
|
|
|
|
|
mHeadsUpStatusBarView.removeOnLayoutChangeListener(this);
|
|
|
|
|
mView.removeOnLayoutChangeListener(this);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
mBypassController = bypassController;
|
|
|
|
|
mStatusBarStateController = stateController;
|
|
|
|
|
mWakeUpCoordinator = wakeUpCoordinator;
|
|
|
|
|
wakeUpCoordinator.addListener(this);
|
|
|
|
|
mCommandQueue = commandQueue;
|
|
|
|
|
mKeyguardStateController = keyguardStateController;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onViewAttached() {
|
|
|
|
|
mHeadsUpManager.addListener(this);
|
|
|
|
|
mView.setOnDrawingRectChangedListener(
|
|
|
|
|
() -> updateIsolatedIconLocation(true /* requireUpdate */));
|
|
|
|
|
mWakeUpCoordinator.addListener(this);
|
|
|
|
|
mNotificationPanelViewController.addTrackingHeadsUpListener(mSetTrackingHeadsUp);
|
|
|
|
|
mNotificationPanelViewController.setHeadsUpAppearanceController(this);
|
|
|
|
|
mStackScrollerController.addOnExpandedHeightChangedListener(mSetExpandedHeight);
|
|
|
|
|
mDarkIconDispatcher.addDarkReceiver(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void destroy() {
|
|
|
|
|
@Override
|
|
|
|
|
protected void onViewDetached() {
|
|
|
|
|
mHeadsUpManager.removeListener(this);
|
|
|
|
|
mHeadsUpStatusBarView.setOnDrawingRectChangedListener(null);
|
|
|
|
|
mView.setOnDrawingRectChangedListener(null);
|
|
|
|
|
mWakeUpCoordinator.removeListener(this);
|
|
|
|
|
mNotificationPanelViewController.removeTrackingHeadsUpListener(mSetTrackingHeadsUp);
|
|
|
|
|
mNotificationPanelViewController.setHeadsUpAppearanceController(null);
|
|
|
|
|
@@ -186,7 +192,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|
|
|
|
|
|
|
|
|
private void updateIsolatedIconLocation(boolean requireStateUpdate) {
|
|
|
|
|
mNotificationIconAreaController.setIsolatedIconLocation(
|
|
|
|
|
mHeadsUpStatusBarView.getIconDrawingRect(), requireStateUpdate);
|
|
|
|
|
mView.getIconDrawingRect(), requireStateUpdate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -200,8 +206,8 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|
|
|
|
if (shouldBeVisible()) {
|
|
|
|
|
newEntry = mHeadsUpManager.getTopEntry();
|
|
|
|
|
}
|
|
|
|
|
NotificationEntry previousEntry = mHeadsUpStatusBarView.getShowingEntry();
|
|
|
|
|
mHeadsUpStatusBarView.setEntry(newEntry);
|
|
|
|
|
NotificationEntry previousEntry = mView.getShowingEntry();
|
|
|
|
|
mView.setEntry(newEntry);
|
|
|
|
|
if (newEntry != previousEntry) {
|
|
|
|
|
boolean animateIsolation = false;
|
|
|
|
|
if (newEntry == null) {
|
|
|
|
|
@@ -226,8 +232,8 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|
|
|
|
mShown = isShown;
|
|
|
|
|
if (isShown) {
|
|
|
|
|
updateParentClipping(false /* shouldClip */);
|
|
|
|
|
mHeadsUpStatusBarView.setVisibility(View.VISIBLE);
|
|
|
|
|
show(mHeadsUpStatusBarView);
|
|
|
|
|
mView.setVisibility(View.VISIBLE);
|
|
|
|
|
show(mView);
|
|
|
|
|
hide(mClockView, View.INVISIBLE);
|
|
|
|
|
if (mCenteredIconView.getVisibility() != View.GONE) {
|
|
|
|
|
hide(mCenteredIconView, View.INVISIBLE);
|
|
|
|
|
@@ -243,21 +249,21 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|
|
|
|
if (mOperatorNameView != null) {
|
|
|
|
|
show(mOperatorNameView);
|
|
|
|
|
}
|
|
|
|
|
hide(mHeadsUpStatusBarView, View.GONE, () -> {
|
|
|
|
|
hide(mView, View.GONE, () -> {
|
|
|
|
|
updateParentClipping(true /* shouldClip */);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// Show the status bar icons when the view gets shown / hidden
|
|
|
|
|
if (mStatusBarStateController.getState() != StatusBarState.SHADE) {
|
|
|
|
|
mCommandQueue.recomputeDisableFlags(
|
|
|
|
|
mHeadsUpStatusBarView.getContext().getDisplayId(), false);
|
|
|
|
|
mView.getContext().getDisplayId(), false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateParentClipping(boolean shouldClip) {
|
|
|
|
|
ViewClippingUtil.setClippingDeactivated(
|
|
|
|
|
mHeadsUpStatusBarView, !shouldClip, mParentClippingParams);
|
|
|
|
|
mView, !shouldClip, mParentClippingParams);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -396,7 +402,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onDarkChanged(Rect area, float darkIntensity, int tint) {
|
|
|
|
|
mHeadsUpStatusBarView.onDarkChanged(area, darkIntensity, tint);
|
|
|
|
|
mView.onDarkChanged(area, darkIntensity, tint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onStateChanged() {
|
|
|
|
|
|