Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java +6 −0 Original line number Diff line number Diff line Loading @@ -288,4 +288,10 @@ public class ButtonDispatcher { } } } /** * Executes when button is detached from window. */ protected void onDestroy() { } } packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButton.java +51 −0 Original line number Diff line number Diff line Loading @@ -18,8 +18,10 @@ package com.android.systemui.statusbar.phone; import android.annotation.DrawableRes; import android.annotation.IdRes; import android.annotation.NonNull; import android.content.Context; import android.view.View; import com.android.systemui.statusbar.policy.KeyButtonDrawable; import com.android.systemui.statusbar.policy.KeyButtonView; Loading @@ -29,6 +31,9 @@ import com.android.systemui.statusbar.policy.KeyButtonView; */ public class ContextualButton extends ButtonDispatcher { private ContextButtonListener mListener; private ContextualButtonGroup mGroup; protected final @DrawableRes int mIconResId; /** Loading Loading @@ -64,6 +69,48 @@ public class ContextualButton extends ButtonDispatcher { currentDrawable.clearAnimationCallbacks(); currentDrawable.resetAnimation(); } if (mListener != null) { mListener.onVisibilityChanged(this, visibility == View.VISIBLE); } } public void setListener(ContextButtonListener listener) { mListener = listener; } /** * Show this button based on its priority compared to other buttons in the group. If not * attached to a group it will set its own visibility to be visible. * @return if visible */ public boolean show() { if (mGroup == null) { setVisibility(View.VISIBLE); return true; } return mGroup.setButtonVisiblity(getId(), true /* visible */) == View.VISIBLE; } /** * Hide this button. * @return if visible */ public boolean hide() { if (mGroup == null) { setVisibility(View.INVISIBLE); return false; } return mGroup.setButtonVisiblity(getId(), false /* visible */) != View.VISIBLE; } /** * Called when this button was added to the group. Keep a reference to the group to show based * on priority compared to other buttons. * @param group the holder of all the buttons */ void attachToGroup(@NonNull ContextualButtonGroup group) { mGroup = group; } protected KeyButtonDrawable getNewDrawable() { Loading @@ -79,4 +126,8 @@ public class ContextualButton extends ButtonDispatcher { protected Context getContext() { return getCurrentView().getContext(); } public interface ContextButtonListener { void onVisibilityChanged(ContextualButton button, boolean visible); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButtonGroup.java +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ public class ContextualButtonGroup extends ButtonDispatcher { * @param button the button added to the group */ public void addButton(@NonNull ContextualButton button) { button.attachToGroup(this); mButtonData.add(new ButtonData(button)); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +44 −388 File changed.Preview size limit exceeded, changes collapsed. Show changes packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +7 −19 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.animation.PropertyValuesHolder; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.annotation.DrawableRes; import android.annotation.StyleRes; import android.app.StatusBarManager; import android.content.Context; import android.content.res.Configuration; Loading Loading @@ -271,7 +270,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav final ContextualButton imeSwitcherButton = new ContextualButton(R.id.ime_switcher, R.drawable.ic_ime_switcher_default); final RotationContextButton rotateSuggestionButton = new RotationContextButton( R.id.rotate_suggestion, R.drawable.ic_sysbar_rotate_button, R.id.rotate_suggestion, R.drawable.ic_sysbar_rotate_button, getContext(), R.style.RotateButtonCCWStart90); final ContextualButton accessibilityButton = new ContextualButton(R.id.accessibility_button, Loading Loading @@ -418,8 +417,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav return mButtonDispatchers.get(R.id.accessibility_button); } public ButtonDispatcher getRotateSuggestionButton() { return mButtonDispatchers.get(R.id.rotate_suggestion); public RotationContextButton getRotateSuggestionButton() { return (RotationContextButton) mContextualButtonGroup .getContextButton(R.id.rotate_suggestion); } public SparseArray<ButtonDispatcher> getButtonDispatchers() { Loading Loading @@ -746,27 +746,12 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav mContextualButtonGroup.setButtonVisiblity(R.id.menu, show); } public void updateRotateSuggestionButtonStyle(@StyleRes int style) { RotationContextButton button = (RotationContextButton) mContextualButtonGroup .getContextButton(R.id.rotate_suggestion); button.setStyle(style); button.updateIcon(); } public void setAccessibilityButtonState(final boolean visible, final boolean longClickable) { mLongClickableAccessibilityButton = longClickable; getAccessibilityButton().setLongClickable(longClickable); mContextualButtonGroup.setButtonVisiblity(R.id.accessibility_button, visible); } public int setRotateButtonVisibility(boolean visible) { return mContextualButtonGroup.setButtonVisiblity(R.id.rotate_suggestion, visible); } public boolean isRotateButtonVisible() { return getRotateSuggestionButton().isVisible(); } void hideRecentsOnboarding() { mRecentsOnboarding.hide(true); } Loading Loading @@ -1058,6 +1043,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav mGestureHelper.destroy(); } setUpSwipeUpOnboarding(false); for (int i = 0; i < mButtonDispatchers.size(); ++i) { mButtonDispatchers.valueAt(i).onDestroy(); } } private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java +6 −0 Original line number Diff line number Diff line Loading @@ -288,4 +288,10 @@ public class ButtonDispatcher { } } } /** * Executes when button is detached from window. */ protected void onDestroy() { } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButton.java +51 −0 Original line number Diff line number Diff line Loading @@ -18,8 +18,10 @@ package com.android.systemui.statusbar.phone; import android.annotation.DrawableRes; import android.annotation.IdRes; import android.annotation.NonNull; import android.content.Context; import android.view.View; import com.android.systemui.statusbar.policy.KeyButtonDrawable; import com.android.systemui.statusbar.policy.KeyButtonView; Loading @@ -29,6 +31,9 @@ import com.android.systemui.statusbar.policy.KeyButtonView; */ public class ContextualButton extends ButtonDispatcher { private ContextButtonListener mListener; private ContextualButtonGroup mGroup; protected final @DrawableRes int mIconResId; /** Loading Loading @@ -64,6 +69,48 @@ public class ContextualButton extends ButtonDispatcher { currentDrawable.clearAnimationCallbacks(); currentDrawable.resetAnimation(); } if (mListener != null) { mListener.onVisibilityChanged(this, visibility == View.VISIBLE); } } public void setListener(ContextButtonListener listener) { mListener = listener; } /** * Show this button based on its priority compared to other buttons in the group. If not * attached to a group it will set its own visibility to be visible. * @return if visible */ public boolean show() { if (mGroup == null) { setVisibility(View.VISIBLE); return true; } return mGroup.setButtonVisiblity(getId(), true /* visible */) == View.VISIBLE; } /** * Hide this button. * @return if visible */ public boolean hide() { if (mGroup == null) { setVisibility(View.INVISIBLE); return false; } return mGroup.setButtonVisiblity(getId(), false /* visible */) != View.VISIBLE; } /** * Called when this button was added to the group. Keep a reference to the group to show based * on priority compared to other buttons. * @param group the holder of all the buttons */ void attachToGroup(@NonNull ContextualButtonGroup group) { mGroup = group; } protected KeyButtonDrawable getNewDrawable() { Loading @@ -79,4 +126,8 @@ public class ContextualButton extends ButtonDispatcher { protected Context getContext() { return getCurrentView().getContext(); } public interface ContextButtonListener { void onVisibilityChanged(ContextualButton button, boolean visible); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/ContextualButtonGroup.java +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ public class ContextualButtonGroup extends ButtonDispatcher { * @param button the button added to the group */ public void addButton(@NonNull ContextualButton button) { button.attachToGroup(this); mButtonData.add(new ButtonData(button)); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +44 −388 File changed.Preview size limit exceeded, changes collapsed. Show changes
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +7 −19 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.animation.PropertyValuesHolder; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.annotation.DrawableRes; import android.annotation.StyleRes; import android.app.StatusBarManager; import android.content.Context; import android.content.res.Configuration; Loading Loading @@ -271,7 +270,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav final ContextualButton imeSwitcherButton = new ContextualButton(R.id.ime_switcher, R.drawable.ic_ime_switcher_default); final RotationContextButton rotateSuggestionButton = new RotationContextButton( R.id.rotate_suggestion, R.drawable.ic_sysbar_rotate_button, R.id.rotate_suggestion, R.drawable.ic_sysbar_rotate_button, getContext(), R.style.RotateButtonCCWStart90); final ContextualButton accessibilityButton = new ContextualButton(R.id.accessibility_button, Loading Loading @@ -418,8 +417,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav return mButtonDispatchers.get(R.id.accessibility_button); } public ButtonDispatcher getRotateSuggestionButton() { return mButtonDispatchers.get(R.id.rotate_suggestion); public RotationContextButton getRotateSuggestionButton() { return (RotationContextButton) mContextualButtonGroup .getContextButton(R.id.rotate_suggestion); } public SparseArray<ButtonDispatcher> getButtonDispatchers() { Loading Loading @@ -746,27 +746,12 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav mContextualButtonGroup.setButtonVisiblity(R.id.menu, show); } public void updateRotateSuggestionButtonStyle(@StyleRes int style) { RotationContextButton button = (RotationContextButton) mContextualButtonGroup .getContextButton(R.id.rotate_suggestion); button.setStyle(style); button.updateIcon(); } public void setAccessibilityButtonState(final boolean visible, final boolean longClickable) { mLongClickableAccessibilityButton = longClickable; getAccessibilityButton().setLongClickable(longClickable); mContextualButtonGroup.setButtonVisiblity(R.id.accessibility_button, visible); } public int setRotateButtonVisibility(boolean visible) { return mContextualButtonGroup.setButtonVisiblity(R.id.rotate_suggestion, visible); } public boolean isRotateButtonVisible() { return getRotateSuggestionButton().isVisible(); } void hideRecentsOnboarding() { mRecentsOnboarding.hide(true); } Loading Loading @@ -1058,6 +1043,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav mGestureHelper.destroy(); } setUpSwipeUpOnboarding(false); for (int i = 0; i < mButtonDispatchers.size(); ++i) { mButtonDispatchers.valueAt(i).onDestroy(); } } private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) { Loading