Move navigation bar logic to its own class
Start hacking away at PhoneStatusBar by trying to pull out
as much NavigationBar logic as possible.
Test: runtest systemui
Change-Id: I23b904428be31b91f0747fd60c9f6e0dd323eb44
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java
index b5358a1..6dddf18 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java
@@ -34,8 +34,8 @@
private final StatusBarIconController mStatusBarIconController;
private final BatteryController mBatteryController;
private FingerprintUnlockController mFingerprintUnlockController;
- private final NavigationBarView mNavigationBarView;
+ private LightBarTransitionsController mNavigationBarController;
private int mSystemUiVisibility;
private int mFullscreenStackVisibility;
private int mDockedStackVisibility;
@@ -50,22 +50,24 @@
private final Rect mLastDockedBounds = new Rect();
public LightBarController(StatusBarIconController statusBarIconController,
- NavigationBarView navigationBarView,
BatteryController batteryController) {
mStatusBarIconController = statusBarIconController;
- mNavigationBarView = navigationBarView;
mBatteryController = batteryController;
batteryController.addCallback(this);
}
+ public void setNavigationBar(LightBarTransitionsController navigationBar) {
+ mNavigationBarController = navigationBar;
+ }
+
public void setFingerprintUnlockController(
FingerprintUnlockController fingerprintUnlockController) {
mFingerprintUnlockController = fingerprintUnlockController;
}
- public void onSystemUiVisibilityChanged(int vis, int fullscreenStackVis, int dockedStackVis,
+ public void onSystemUiVisibilityChanged(int fullscreenStackVis, int dockedStackVis,
int mask, Rect fullscreenStackBounds, Rect dockedStackBounds, boolean sbModeChanged,
- int statusBarMode, boolean nbModeChanged, int navigationBarMode) {
+ int statusBarMode) {
int oldFullscreen = mFullscreenStackVisibility;
int newFullscreen = (oldFullscreen & ~mask) | (fullscreenStackVis & mask);
int diffFullscreen = newFullscreen ^ oldFullscreen;
@@ -84,6 +86,15 @@
updateStatus(fullscreenStackBounds, dockedStackBounds);
}
+ mFullscreenStackVisibility = newFullscreen;
+ mDockedStackVisibility = newDocked;
+ mLastStatusBarMode = statusBarMode;
+ mLastFullscreenBounds.set(fullscreenStackBounds);
+ mLastDockedBounds.set(dockedStackBounds);
+ }
+
+ public void onNavigationVisibilityChanged(int vis, int mask, boolean nbModeChanged,
+ int navigationBarMode) {
int oldVis = mSystemUiVisibility;
int newVis = (oldVis & ~mask) | (vis & mask);
int diffVis = newVis ^ oldVis;
@@ -95,19 +106,15 @@
updateNavigation();
}
}
- mFullscreenStackVisibility = newFullscreen;
- mDockedStackVisibility = newDocked;
mSystemUiVisibility = newVis;
- mLastStatusBarMode = statusBarMode;
mLastNavigationBarMode = navigationBarMode;
- mLastFullscreenBounds.set(fullscreenStackBounds);
- mLastDockedBounds.set(dockedStackBounds);
}
private void reevaluate() {
- onSystemUiVisibilityChanged(mSystemUiVisibility, mFullscreenStackVisibility,
+ onSystemUiVisibilityChanged(mFullscreenStackVisibility,
mDockedStackVisibility, 0 /* mask */, mLastFullscreenBounds, mLastDockedBounds,
- true /* sbModeChange*/, mLastStatusBarMode, true /* nbModeChange*/,
+ true /* sbModeChange*/, mLastStatusBarMode);
+ onNavigationVisibilityChanged(mSystemUiVisibility, 0 /* mask */, true /* nbModeChanged */,
mLastNavigationBarMode);
}
@@ -169,8 +176,8 @@
}
private void updateNavigation() {
- if (mNavigationBarView != null) {
- mNavigationBarView.getLightTransitionsController().setIconsDark(
+ if (mNavigationBarController != null) {
+ mNavigationBarController.setIconsDark(
mNavigationLight, animateChange());
}
}