Removing layout handling in DeviceProfile and moving it to
individual views
Bug: 71709920
Change-Id: I8300fa7a84b31898bdb135d774cca576d2928525
diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java
index a814323..1a1bec6 100644
--- a/src/com/android/launcher3/LauncherRootView.java
+++ b/src/com/android/launcher3/LauncherRootView.java
@@ -16,6 +16,8 @@
public class LauncherRootView extends InsettableFrameLayout {
+ private final Launcher mLauncher;
+
private final Paint mOpaquePaint;
@ViewDebug.ExportedProperty(category = "launcher")
private boolean mDrawSideInsetBar;
@@ -32,6 +34,8 @@
mOpaquePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mOpaquePaint.setColor(Color.BLACK);
mOpaquePaint.setStyle(Paint.Style.FILL);
+
+ mLauncher = Launcher.getLauncher(context);
}
@Override
@@ -57,10 +61,11 @@
} else {
mLeftInsetBarWidth = mRightInsetBarWidth = 0;
}
- Launcher.getLauncher(getContext()).getSystemUiController().updateUiState(
+ mLauncher.getSystemUiController().updateUiState(
UI_STATE_ROOT_VIEW, mDrawSideInsetBar ? FLAG_DARK_NAV : 0);
- boolean rawInsetsChanged = !mInsets.equals(insets);
+ // Update device profile before notifying th children.
+ mLauncher.getDeviceProfile().updateInsets(insets);
setInsets(insets);
if (mAlignedView != null) {
@@ -73,15 +78,13 @@
}
}
- if (rawInsetsChanged) {
- // Update the grid again
- Launcher launcher = Launcher.getLauncher(getContext());
- launcher.onInsetsChanged(insets);
- }
-
return true; // I'll take it from here
}
+ public void dispatchInsets() {
+ fitSystemWindows(mInsets);
+ }
+
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);