Simplifying mVerticalTranslationListener
Changing mVerticalTranslationListener to single object instead of a list. Test: atest SystemUITests Bug: 171917882 Change-Id: I3206745db47c5e1b90748b5418046f070d9648a6
This commit is contained in:
@@ -134,7 +134,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
||||
mStackScrollerController = stackScrollerController;
|
||||
mNotificationPanelViewController = notificationPanelViewController;
|
||||
notificationPanelViewController.addTrackingHeadsUpListener(mSetTrackingHeadsUp);
|
||||
notificationPanelViewController.addVerticalTranslationListener(mUpdatePanelTranslation);
|
||||
notificationPanelViewController.setVerticalTranslationListener(mUpdatePanelTranslation);
|
||||
notificationPanelViewController.setHeadsUpAppearanceController(this);
|
||||
mStackScrollerController.addOnExpandedHeightChangedListener(mSetExpandedHeight);
|
||||
mStackScrollerController.addOnLayoutChangeListener(mStackScrollLayoutChangeListener);
|
||||
@@ -171,7 +171,7 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
|
||||
mHeadsUpStatusBarView.setOnDrawingRectChangedListener(null);
|
||||
mWakeUpCoordinator.removeListener(this);
|
||||
mNotificationPanelViewController.removeTrackingHeadsUpListener(mSetTrackingHeadsUp);
|
||||
mNotificationPanelViewController.removeVerticalTranslationListener(mUpdatePanelTranslation);
|
||||
mNotificationPanelViewController.setVerticalTranslationListener(null);
|
||||
mNotificationPanelViewController.setHeadsUpAppearanceController(null);
|
||||
mStackScrollerController.removeOnExpandedHeightChangedListener(mSetExpandedHeight);
|
||||
mStackScrollerController.removeOnLayoutChangeListener(mStackScrollLayoutChangeListener);
|
||||
|
||||
@@ -459,7 +459,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
private ArrayList<Consumer<ExpandableNotificationRow>>
|
||||
mTrackingHeadsUpListeners =
|
||||
new ArrayList<>();
|
||||
private ArrayList<Runnable> mVerticalTranslationListener = new ArrayList<>();
|
||||
private Runnable mVerticalTranslationListener;
|
||||
private HeadsUpAppearanceController mHeadsUpAppearanceController;
|
||||
|
||||
private int mPanelAlpha;
|
||||
@@ -2848,9 +2848,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
protected void setHorizontalPanelTranslation(float translation) {
|
||||
mNotificationStackScrollLayoutController.setTranslationX(translation);
|
||||
mQsFrame.setTranslationX(translation);
|
||||
int size = mVerticalTranslationListener.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
mVerticalTranslationListener.get(i).run();
|
||||
if (mVerticalTranslationListener != null) {
|
||||
mVerticalTranslationListener.run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3143,12 +3142,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
mTrackingHeadsUpListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void addVerticalTranslationListener(Runnable verticalTranslationListener) {
|
||||
mVerticalTranslationListener.add(verticalTranslationListener);
|
||||
}
|
||||
|
||||
public void removeVerticalTranslationListener(Runnable verticalTranslationListener) {
|
||||
mVerticalTranslationListener.remove(verticalTranslationListener);
|
||||
public void setVerticalTranslationListener(Runnable verticalTranslationListener) {
|
||||
mVerticalTranslationListener = verticalTranslationListener;
|
||||
}
|
||||
|
||||
public void setHeadsUpAppearanceController(
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.systemui.statusbar.phone;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -197,9 +198,9 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase {
|
||||
mHeadsUpAppearanceController.destroy();
|
||||
verify(mHeadsUpManager).removeListener(any());
|
||||
verify(mDarkIconDispatcher).removeDarkReceiver((DarkIconDispatcher.DarkReceiver) any());
|
||||
verify(mPanelView).removeVerticalTranslationListener(any());
|
||||
verify(mPanelView).setVerticalTranslationListener(isNull());
|
||||
verify(mPanelView).removeTrackingHeadsUpListener(any());
|
||||
verify(mPanelView).setHeadsUpAppearanceController(any());
|
||||
verify(mPanelView).setHeadsUpAppearanceController(isNull());
|
||||
verify(mStackScrollerController).removeOnExpandedHeightChangedListener(any());
|
||||
verify(mStackScrollerController).removeOnLayoutChangeListener(any());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user