diff --git a/packages/SystemUI/res/layout/contextual.xml b/packages/SystemUI/res/layout/contextual.xml index 9b6ccaeef1e4f..90a7768846992 100644 --- a/packages/SystemUI/res/layout/contextual.xml +++ b/packages/SystemUI/res/layout/contextual.xml @@ -42,16 +42,10 @@ android:layout_height="match_parent" android:visibility="invisible" /> - + + + \ No newline at end of file diff --git a/packages/SystemUI/res/layout/start_contextual.xml b/packages/SystemUI/res/layout/start_contextual.xml new file mode 100644 index 0000000000000..e022c7301e3b6 --- /dev/null +++ b/packages/SystemUI/res/layout/start_contextual.xml @@ -0,0 +1,36 @@ + + + + + + \ No newline at end of file diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 73386879a20d7..4abe9f0bfb5cd 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -331,7 +331,7 @@ left[.5W],back[1WC];home;recent[1WC],right[.5W] back[1.7WC];home;contextual[1.7WC] - back[1.7WC];home_handle;ime_switcher[1.7WC] + start_contextual[.1WC];home_handle;ime_switcher[.1WC] false diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java index 5f5fad33fbfe1..6a93c7c9e5c42 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java @@ -47,7 +47,7 @@ public class ButtonDispatcher { private Boolean mLongClickable; private Float mAlpha; private Float mDarkIntensity; - private Integer mVisibility = -1; + private Integer mVisibility = View.VISIBLE; private Boolean mDelayTouchFeedback; private KeyButtonDrawable mImageDrawable; private View mCurrentView; @@ -86,7 +86,7 @@ public class ButtonDispatcher { if (mAlpha != null) { view.setAlpha(mAlpha); } - if (mVisibility != null && mVisibility != -1) { + if (mVisibility != null) { view.setVisibility(mVisibility); } if (mAccessibilityDelegate != null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButton.java index 541c142c422a5..5bc17f5bc2c61 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButton.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButton.java @@ -51,7 +51,7 @@ public class ContextualButton extends ButtonDispatcher { * Reload the drawable from resource id, should reapply the previous dark intensity. */ public void updateIcon() { - if (getCurrentView() == null || !getCurrentView().isAttachedToWindow()) { + if (getCurrentView() == null || !getCurrentView().isAttachedToWindow() || mIconResId == 0) { return; } final KeyButtonDrawable currentDrawable = getImageDrawable(); @@ -92,7 +92,7 @@ public class ContextualButton extends ButtonDispatcher { setVisibility(View.VISIBLE); return true; } - return mGroup.setButtonVisiblity(getId(), true /* visible */) == View.VISIBLE; + return mGroup.setButtonVisibility(getId(), true /* visible */) == View.VISIBLE; } /** @@ -104,7 +104,7 @@ public class ContextualButton extends ButtonDispatcher { setVisibility(View.INVISIBLE); return false; } - return mGroup.setButtonVisiblity(getId(), false /* visible */) != View.VISIBLE; + return mGroup.setButtonVisibility(getId(), false /* visible */) != View.VISIBLE; } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButtonGroup.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButtonGroup.java index 02b660f4734d9..9e843f93d00e0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButtonGroup.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButtonGroup.java @@ -37,7 +37,7 @@ public class ContextualButtonGroup extends ButtonDispatcher { /** * Add a contextual button to the group. The order of adding increases in its priority. The * priority is used to determine which button should be visible when setting multiple button's - * visibility {@see setButtonVisiblity}. + * visibility {@see setButtonVisibility}. * @param button the button added to the group */ public void addButton(@NonNull ContextualButton button) { @@ -71,7 +71,7 @@ public class ContextualButtonGroup extends ButtonDispatcher { * @return if the button is visible after operation * @throws RuntimeException if the input id does not match any of the ids in the group */ - public int setButtonVisiblity(@IdRes int buttonResId, boolean visible) { + public int setButtonVisibility(@IdRes int buttonResId, boolean visible) { final int index = getContextButtonIndex(buttonResId); if (index == INVALID_INDEX) { throw new RuntimeException("Cannot find the button id of " + buttonResId diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java index 404c07b807e5b..963fc54ecd2d0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java @@ -71,6 +71,7 @@ public class NavigationBarInflaterView extends FrameLayout public static final String RIGHT = "right"; public static final String CONTEXTUAL = "contextual"; public static final String IME_SWITCHER = "ime_switcher"; + public static final String START_CONTEXTUAL = "start_contextual"; public static final String GRAVITY_SEPARATOR = ";"; public static final String BUTTON_SEPARATOR = ","; @@ -419,6 +420,8 @@ public class NavigationBarInflaterView extends FrameLayout v = inflater.inflate(R.layout.home_handle, parent, false); } else if (IME_SWITCHER.equals(button)) { v = inflater.inflate(R.layout.ime_switcher, parent, false); + } else if (START_CONTEXTUAL.equals(button)) { + v = inflater.inflate(R.layout.start_contextual, parent, false); } else if (button.startsWith(KEY)) { String uri = extractImage(button); int code = extractKeycode(button); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 6f1e161cf2373..4333200e702a7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -49,6 +49,8 @@ import android.view.MotionEvent; import android.view.Surface; import android.view.View; import android.view.ViewGroup; +import android.view.ViewTreeObserver.InternalInsetsInfo; +import android.view.ViewTreeObserver.OnComputeInternalInsetsListener; import android.view.WindowInsets; import android.view.WindowManager; import android.view.WindowManagerGlobal; @@ -135,6 +137,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener