Merge "Don't use flexible inset mapping yet" into rvc-dev
This commit is contained in:
@@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
package com.android.systemui.car.navigationbar;
|
package com.android.systemui.car.navigationbar;
|
||||||
|
|
||||||
import static android.view.InsetsState.ITYPE_BOTTOM_GESTURES;
|
import static android.view.InsetsState.ITYPE_CLIMATE_BAR;
|
||||||
|
import static android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR;
|
||||||
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
|
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
|
||||||
import static android.view.InsetsState.ITYPE_STATUS_BAR;
|
import static android.view.InsetsState.ITYPE_STATUS_BAR;
|
||||||
import static android.view.InsetsState.ITYPE_TOP_GESTURES;
|
|
||||||
import static android.view.InsetsState.containsType;
|
import static android.view.InsetsState.containsType;
|
||||||
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
|
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
|
||||||
|
|
||||||
@@ -368,15 +368,13 @@ public class CarNavigationBar extends SystemUI implements CommandQueue.Callbacks
|
|||||||
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
|
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
height,
|
height,
|
||||||
WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL,
|
WindowManager.LayoutParams.TYPE_STATUS_BAR,
|
||||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
||||||
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
||||||
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
|
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
|
||||||
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
|
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
|
||||||
PixelFormat.TRANSLUCENT);
|
PixelFormat.TRANSLUCENT);
|
||||||
lp.setTitle("TopCarNavigationBar");
|
lp.setTitle("TopCarNavigationBar");
|
||||||
lp.providesInsetsTypes = new int[]{ITYPE_STATUS_BAR, ITYPE_TOP_GESTURES};
|
|
||||||
lp.setFitInsetsTypes(0);
|
|
||||||
lp.windowAnimations = 0;
|
lp.windowAnimations = 0;
|
||||||
lp.gravity = Gravity.TOP;
|
lp.gravity = Gravity.TOP;
|
||||||
mWindowManager.addView(mTopNavigationBarWindow, lp);
|
mWindowManager.addView(mTopNavigationBarWindow, lp);
|
||||||
@@ -390,14 +388,13 @@ public class CarNavigationBar extends SystemUI implements CommandQueue.Callbacks
|
|||||||
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
|
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
height,
|
height,
|
||||||
WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
|
WindowManager.LayoutParams.TYPE_NAVIGATION_BAR,
|
||||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
||||||
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
||||||
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
|
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
|
||||||
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
|
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
|
||||||
PixelFormat.TRANSLUCENT);
|
PixelFormat.TRANSLUCENT);
|
||||||
lp.setTitle("BottomCarNavigationBar");
|
lp.setTitle("BottomCarNavigationBar");
|
||||||
lp.providesInsetsTypes = new int[]{ITYPE_NAVIGATION_BAR, ITYPE_BOTTOM_GESTURES};
|
|
||||||
lp.windowAnimations = 0;
|
lp.windowAnimations = 0;
|
||||||
lp.gravity = Gravity.BOTTOM;
|
lp.gravity = Gravity.BOTTOM;
|
||||||
mWindowManager.addView(mBottomNavigationBarWindow, lp);
|
mWindowManager.addView(mBottomNavigationBarWindow, lp);
|
||||||
@@ -415,6 +412,8 @@ public class CarNavigationBar extends SystemUI implements CommandQueue.Callbacks
|
|||||||
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
|
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
|
||||||
PixelFormat.TRANSLUCENT);
|
PixelFormat.TRANSLUCENT);
|
||||||
leftlp.setTitle("LeftCarNavigationBar");
|
leftlp.setTitle("LeftCarNavigationBar");
|
||||||
|
leftlp.providesInsetsTypes = new int[]{ITYPE_CLIMATE_BAR};
|
||||||
|
leftlp.setFitInsetsTypes(0);
|
||||||
leftlp.windowAnimations = 0;
|
leftlp.windowAnimations = 0;
|
||||||
leftlp.gravity = Gravity.LEFT;
|
leftlp.gravity = Gravity.LEFT;
|
||||||
mWindowManager.addView(mLeftNavigationBarWindow, leftlp);
|
mWindowManager.addView(mLeftNavigationBarWindow, leftlp);
|
||||||
@@ -432,6 +431,8 @@ public class CarNavigationBar extends SystemUI implements CommandQueue.Callbacks
|
|||||||
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
|
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
|
||||||
PixelFormat.TRANSLUCENT);
|
PixelFormat.TRANSLUCENT);
|
||||||
rightlp.setTitle("RightCarNavigationBar");
|
rightlp.setTitle("RightCarNavigationBar");
|
||||||
|
rightlp.providesInsetsTypes = new int[]{ITYPE_EXTRA_NAVIGATION_BAR};
|
||||||
|
rightlp.setFitInsetsTypes(0);
|
||||||
rightlp.windowAnimations = 0;
|
rightlp.windowAnimations = 0;
|
||||||
rightlp.gravity = Gravity.RIGHT;
|
rightlp.gravity = Gravity.RIGHT;
|
||||||
mWindowManager.addView(mRightNavigationBarWindow, rightlp);
|
mWindowManager.addView(mRightNavigationBarWindow, rightlp);
|
||||||
|
|||||||
@@ -16,10 +16,7 @@
|
|||||||
|
|
||||||
package com.android.systemui.car.navigationbar;
|
package com.android.systemui.car.navigationbar;
|
||||||
|
|
||||||
import static android.view.WindowInsets.Type.systemBars;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Insets;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -82,28 +79,9 @@ public class CarNavigationBarView extends LinearLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WindowInsets onApplyWindowInsets(WindowInsets windowInsets) {
|
public WindowInsets onApplyWindowInsets(WindowInsets windowInsets) {
|
||||||
applyMargins(windowInsets.getInsets(systemBars()));
|
|
||||||
return windowInsets;
|
return windowInsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyMargins(Insets insets) {
|
|
||||||
final int count = getChildCount();
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
View child = getChildAt(i);
|
|
||||||
if (child.getLayoutParams() instanceof LayoutParams) {
|
|
||||||
LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
|
||||||
if (lp.rightMargin != insets.right || lp.leftMargin != insets.left
|
|
||||||
|| lp.topMargin != insets.top || lp.bottomMargin != insets.bottom) {
|
|
||||||
lp.rightMargin = insets.right;
|
|
||||||
lp.leftMargin = insets.left;
|
|
||||||
lp.topMargin = insets.top;
|
|
||||||
lp.bottomMargin = insets.bottom;
|
|
||||||
child.requestLayout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Used to forward touch events even if the touch was initiated from a child component
|
// Used to forward touch events even if the touch was initiated from a child component
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||||
|
|||||||
Reference in New Issue
Block a user