Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java +10 −5 Original line number Original line Diff line number Diff line Loading @@ -162,12 +162,17 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL mDockWindowTouchSlopExceeded = false; mDockWindowTouchSlopExceeded = false; mTouchDownX = (int) event.getX(); mTouchDownX = (int) event.getX(); mTouchDownY = (int) event.getY(); mTouchDownY = (int) event.getY(); if (mNavigationBarView != null) { View recentsButton = mNavigationBarView.getRecentsButton(); View recentsButton = mNavigationBarView.getRecentsButton(); if (recentsButton != null) { mDownOnRecents = mTouchDownX >= recentsButton.getLeft() mDownOnRecents = mTouchDownX >= recentsButton.getLeft() && mTouchDownX <= recentsButton.getRight() && mTouchDownX <= recentsButton.getRight() && mTouchDownY >= recentsButton.getTop() && mTouchDownY >= recentsButton.getTop() && mTouchDownY <= recentsButton.getBottom(); && mTouchDownY <= recentsButton.getBottom(); } } } } private boolean handleDragActionMoveEvent(MotionEvent event) { private boolean handleDragActionMoveEvent(MotionEvent event) { mVelocityTracker.addMovement(event); mVelocityTracker.addMovement(event); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +69 −21 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.animation.LayoutTransition.TransitionListener; import android.animation.ObjectAnimator; import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.animation.ValueAnimator; import android.annotation.Nullable; import android.app.ActivityManagerNative; import android.app.ActivityManagerNative; import android.app.StatusBarManager; import android.app.StatusBarManager; import android.content.Context; import android.content.Context; Loading Loading @@ -131,12 +132,15 @@ public class NavigationBarView extends LinearLayout { } } public void onBackAltCleared() { public void onBackAltCleared() { View backButton = getBackButton(); View homeButton = getHomeButton(); // When dismissing ime during unlock, force the back button to run the same appearance // When dismissing ime during unlock, force the back button to run the same appearance // animation as home (if we catch this condition early enough). // animation as home (if we catch this condition early enough). if (!mBackTransitioning && getBackButton().getVisibility() == VISIBLE if (backButton != null && !mBackTransitioning && backButton.getVisibility() == VISIBLE && mHomeAppearing && getHomeButton().getAlpha() == 0) { && mHomeAppearing && homeButton != null && getHomeButton().getAlpha() == 0) { getBackButton().setAlpha(0); getBackButton().setAlpha(0); ValueAnimator a = ObjectAnimator.ofFloat(getBackButton(), "alpha", 0, 1); ValueAnimator a = ObjectAnimator.ofFloat(backButton, "alpha", 0, 1); a.setStartDelay(mStartDelay); a.setStartDelay(mStartDelay); a.setDuration(mDuration); a.setDuration(mDuration); a.setInterpolator(mInterpolator); a.setInterpolator(mInterpolator); Loading Loading @@ -222,8 +226,11 @@ public class NavigationBarView extends LinearLayout { } } public void abortCurrentGesture() { public void abortCurrentGesture() { View homeButton = getHomeButton(); if (homeButton != null) { getHomeButton().abortCurrentGesture(); getHomeButton().abortCurrentGesture(); } } } private H mHandler = new H(); private H mHandler = new H(); Loading @@ -235,26 +242,34 @@ public class NavigationBarView extends LinearLayout { return mRotatedViews; return mRotatedViews; } } // The following Buttons can possibly return null if NavigationBarView is extended to provide // a different layout and the buttons do not exist in that new layout. @Nullable public KeyButtonView getRecentsButton() { public KeyButtonView getRecentsButton() { return (KeyButtonView) getCurrentView().findViewById(R.id.recent_apps); return (KeyButtonView) getCurrentView().findViewById(R.id.recent_apps); } } @Nullable public View getMenuButton() { public View getMenuButton() { return getCurrentView().findViewById(R.id.menu); return getCurrentView().findViewById(R.id.menu); } } @Nullable public View getBackButton() { public View getBackButton() { return getCurrentView().findViewById(R.id.back); return getCurrentView().findViewById(R.id.back); } } @Nullable public KeyButtonView getHomeButton() { public KeyButtonView getHomeButton() { return (KeyButtonView) getCurrentView().findViewById(R.id.home); return (KeyButtonView) getCurrentView().findViewById(R.id.home); } } @Nullable public View getImeSwitchButton() { public View getImeSwitchButton() { return getCurrentView().findViewById(R.id.ime_switcher); return getCurrentView().findViewById(R.id.ime_switcher); } } @Nullable public View getAppShelf() { public View getAppShelf() { return getCurrentView().findViewById(R.id.app_shelf); return getCurrentView().findViewById(R.id.app_shelf); } } Loading Loading @@ -329,19 +344,27 @@ public class NavigationBarView extends LinearLayout { ? getBackIconWithAlt(mCarMode, mVertical) ? getBackIconWithAlt(mCarMode, mVertical) : getBackIcon(mCarMode, mVertical); : getBackIcon(mCarMode, mVertical); ((ImageView) getBackButton()).setImageDrawable(backIcon); View backButton = getBackButton(); if (backButton != null && backButton instanceof ImageView) { ((ImageView) backButton).setImageDrawable(backIcon); } ((ImageView) getRecentsButton()).setImageDrawable( ImageView recentsButton = getRecentsButton(); mVertical ? mRecentLandIcon : mRecentIcon); if (recentsButton != null) { recentsButton.setImageDrawable(mVertical ? mRecentLandIcon : mRecentIcon); } if (mCarMode) { ImageView homeButton = getHomeButton(); ((ImageView) getHomeButton()).setImageDrawable(mHomeCarModeIcon); if (homeButton != null) { } else { homeButton.setImageDrawable(mCarMode ? mHomeCarModeIcon : mHomeDefaultIcon); ((ImageView) getHomeButton()).setImageDrawable(mHomeDefaultIcon); } } final boolean showImeButton = ((hints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0); final boolean showImeButton = ((hints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0); getImeSwitchButton().setVisibility(showImeButton ? View.VISIBLE : View.INVISIBLE); View imeSwitchButton = getImeSwitchButton(); if (imeSwitchButton != null) { imeSwitchButton.setVisibility(showImeButton ? View.VISIBLE : View.INVISIBLE); } // Update menu button in case the IME state has changed. // Update menu button in case the IME state has changed. setMenuVisibility(mShowMenu, true); setMenuVisibility(mShowMenu, true); Loading Loading @@ -382,9 +405,20 @@ public class NavigationBarView extends LinearLayout { disableRecent = false; disableRecent = false; } } getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE); View backButton = getBackButton(); getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE); if (backButton != null) { getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE); backButton.setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE); } View homeButton = getHomeButton(); if (homeButton != null) { homeButton.setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE); } View recentsButton = getRecentsButton(); if (recentsButton != null) { recentsButton.setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE); } // The app shelf, if it exists, follows the visibility of the home button. // The app shelf, if it exists, follows the visibility of the home button. View appShelf = getAppShelf(); View appShelf = getAppShelf(); Loading Loading @@ -475,7 +509,11 @@ public class NavigationBarView extends LinearLayout { // Only show Menu if IME switcher not shown. // Only show Menu if IME switcher not shown. final boolean shouldShow = mShowMenu && final boolean shouldShow = mShowMenu && ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) == 0); ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) == 0); getMenuButton().setVisibility(shouldShow ? View.VISIBLE : View.INVISIBLE); View menuButton = getMenuButton(); if (menuButton != null) { menuButton.setVisibility(shouldShow ? View.VISIBLE : View.INVISIBLE); } } } @Override @Override Loading @@ -489,7 +527,10 @@ public class NavigationBarView extends LinearLayout { mCurrentView = mRotatedViews[Surface.ROTATION_0]; mCurrentView = mRotatedViews[Surface.ROTATION_0]; getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); View imeSwitchButton = getImeSwitchButton(); if (imeSwitchButton != null) { imeSwitchButton.setOnClickListener(mImeSwitcherClickListener); } updateRTLOrder(); updateRTLOrder(); Loading @@ -515,10 +556,14 @@ public class NavigationBarView extends LinearLayout { } } private void updateRecentsIcon(boolean dockedStackExists) { private void updateRecentsIcon(boolean dockedStackExists) { getRecentsButton().setImageResource(dockedStackExists ImageView recentsButton = getRecentsButton(); if (recentsButton != null) { recentsButton.setImageResource(dockedStackExists ? R.drawable.ic_sysbar_docked ? R.drawable.ic_sysbar_docked : R.drawable.ic_sysbar_recent); : R.drawable.ic_sysbar_recent); } } } public boolean isVertical() { public boolean isVertical() { return mVertical; return mVertical; Loading @@ -533,7 +578,10 @@ public class NavigationBarView extends LinearLayout { mCurrentView.setVisibility(View.VISIBLE); mCurrentView.setVisibility(View.VISIBLE); updateLayoutTransitionsEnabled(); updateLayoutTransitionsEnabled(); getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); View imeSwitchButton = getImeSwitchButton(); if (imeSwitchButton != null) { imeSwitchButton.setOnClickListener(mImeSwitcherClickListener); } mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone); mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +20 −8 Original line number Original line Diff line number Diff line Loading @@ -1184,14 +1184,26 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, private void prepareNavigationBarView() { private void prepareNavigationBarView() { mNavigationBarView.reorient(); mNavigationBarView.reorient(); mNavigationBarView.getRecentsButton().setOnClickListener(mRecentsClickListener); View recentsButton = mNavigationBarView.getRecentsButton(); mNavigationBarView.getRecentsButton().setOnTouchListener(mRecentsPreloadOnTouchListener); if (recentsButton != null) { mNavigationBarView.getRecentsButton().setLongClickable(true); recentsButton.setOnClickListener(mRecentsClickListener); mNavigationBarView.getRecentsButton().setOnLongClickListener(mRecentsLongClickListener); recentsButton.setOnTouchListener(mRecentsPreloadOnTouchListener); mNavigationBarView.getBackButton().setLongClickable(true); recentsButton.setLongClickable(true); mNavigationBarView.getBackButton().setOnLongClickListener(mLongPressBackListener); recentsButton.setOnLongClickListener(mRecentsLongClickListener); mNavigationBarView.getHomeButton().setOnTouchListener(mHomeActionListener); } mNavigationBarView.getHomeButton().setOnLongClickListener(mLongPressHomeListener); View backButton = mNavigationBarView.getBackButton(); if (backButton != null) { backButton.setLongClickable(true); backButton.setOnLongClickListener(mLongPressBackListener); } View homeButton = mNavigationBarView.getHomeButton(); if (homeButton != null) { homeButton.setOnTouchListener(mHomeActionListener); homeButton.setOnLongClickListener(mLongPressHomeListener); } mAssistManager.onConfigurationChanged(); mAssistManager.onConfigurationChanged(); } } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java +10 −5 Original line number Original line Diff line number Diff line Loading @@ -162,12 +162,17 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL mDockWindowTouchSlopExceeded = false; mDockWindowTouchSlopExceeded = false; mTouchDownX = (int) event.getX(); mTouchDownX = (int) event.getX(); mTouchDownY = (int) event.getY(); mTouchDownY = (int) event.getY(); if (mNavigationBarView != null) { View recentsButton = mNavigationBarView.getRecentsButton(); View recentsButton = mNavigationBarView.getRecentsButton(); if (recentsButton != null) { mDownOnRecents = mTouchDownX >= recentsButton.getLeft() mDownOnRecents = mTouchDownX >= recentsButton.getLeft() && mTouchDownX <= recentsButton.getRight() && mTouchDownX <= recentsButton.getRight() && mTouchDownY >= recentsButton.getTop() && mTouchDownY >= recentsButton.getTop() && mTouchDownY <= recentsButton.getBottom(); && mTouchDownY <= recentsButton.getBottom(); } } } } private boolean handleDragActionMoveEvent(MotionEvent event) { private boolean handleDragActionMoveEvent(MotionEvent event) { mVelocityTracker.addMovement(event); mVelocityTracker.addMovement(event); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +69 −21 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.animation.LayoutTransition.TransitionListener; import android.animation.ObjectAnimator; import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.animation.ValueAnimator; import android.annotation.Nullable; import android.app.ActivityManagerNative; import android.app.ActivityManagerNative; import android.app.StatusBarManager; import android.app.StatusBarManager; import android.content.Context; import android.content.Context; Loading Loading @@ -131,12 +132,15 @@ public class NavigationBarView extends LinearLayout { } } public void onBackAltCleared() { public void onBackAltCleared() { View backButton = getBackButton(); View homeButton = getHomeButton(); // When dismissing ime during unlock, force the back button to run the same appearance // When dismissing ime during unlock, force the back button to run the same appearance // animation as home (if we catch this condition early enough). // animation as home (if we catch this condition early enough). if (!mBackTransitioning && getBackButton().getVisibility() == VISIBLE if (backButton != null && !mBackTransitioning && backButton.getVisibility() == VISIBLE && mHomeAppearing && getHomeButton().getAlpha() == 0) { && mHomeAppearing && homeButton != null && getHomeButton().getAlpha() == 0) { getBackButton().setAlpha(0); getBackButton().setAlpha(0); ValueAnimator a = ObjectAnimator.ofFloat(getBackButton(), "alpha", 0, 1); ValueAnimator a = ObjectAnimator.ofFloat(backButton, "alpha", 0, 1); a.setStartDelay(mStartDelay); a.setStartDelay(mStartDelay); a.setDuration(mDuration); a.setDuration(mDuration); a.setInterpolator(mInterpolator); a.setInterpolator(mInterpolator); Loading Loading @@ -222,8 +226,11 @@ public class NavigationBarView extends LinearLayout { } } public void abortCurrentGesture() { public void abortCurrentGesture() { View homeButton = getHomeButton(); if (homeButton != null) { getHomeButton().abortCurrentGesture(); getHomeButton().abortCurrentGesture(); } } } private H mHandler = new H(); private H mHandler = new H(); Loading @@ -235,26 +242,34 @@ public class NavigationBarView extends LinearLayout { return mRotatedViews; return mRotatedViews; } } // The following Buttons can possibly return null if NavigationBarView is extended to provide // a different layout and the buttons do not exist in that new layout. @Nullable public KeyButtonView getRecentsButton() { public KeyButtonView getRecentsButton() { return (KeyButtonView) getCurrentView().findViewById(R.id.recent_apps); return (KeyButtonView) getCurrentView().findViewById(R.id.recent_apps); } } @Nullable public View getMenuButton() { public View getMenuButton() { return getCurrentView().findViewById(R.id.menu); return getCurrentView().findViewById(R.id.menu); } } @Nullable public View getBackButton() { public View getBackButton() { return getCurrentView().findViewById(R.id.back); return getCurrentView().findViewById(R.id.back); } } @Nullable public KeyButtonView getHomeButton() { public KeyButtonView getHomeButton() { return (KeyButtonView) getCurrentView().findViewById(R.id.home); return (KeyButtonView) getCurrentView().findViewById(R.id.home); } } @Nullable public View getImeSwitchButton() { public View getImeSwitchButton() { return getCurrentView().findViewById(R.id.ime_switcher); return getCurrentView().findViewById(R.id.ime_switcher); } } @Nullable public View getAppShelf() { public View getAppShelf() { return getCurrentView().findViewById(R.id.app_shelf); return getCurrentView().findViewById(R.id.app_shelf); } } Loading Loading @@ -329,19 +344,27 @@ public class NavigationBarView extends LinearLayout { ? getBackIconWithAlt(mCarMode, mVertical) ? getBackIconWithAlt(mCarMode, mVertical) : getBackIcon(mCarMode, mVertical); : getBackIcon(mCarMode, mVertical); ((ImageView) getBackButton()).setImageDrawable(backIcon); View backButton = getBackButton(); if (backButton != null && backButton instanceof ImageView) { ((ImageView) backButton).setImageDrawable(backIcon); } ((ImageView) getRecentsButton()).setImageDrawable( ImageView recentsButton = getRecentsButton(); mVertical ? mRecentLandIcon : mRecentIcon); if (recentsButton != null) { recentsButton.setImageDrawable(mVertical ? mRecentLandIcon : mRecentIcon); } if (mCarMode) { ImageView homeButton = getHomeButton(); ((ImageView) getHomeButton()).setImageDrawable(mHomeCarModeIcon); if (homeButton != null) { } else { homeButton.setImageDrawable(mCarMode ? mHomeCarModeIcon : mHomeDefaultIcon); ((ImageView) getHomeButton()).setImageDrawable(mHomeDefaultIcon); } } final boolean showImeButton = ((hints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0); final boolean showImeButton = ((hints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0); getImeSwitchButton().setVisibility(showImeButton ? View.VISIBLE : View.INVISIBLE); View imeSwitchButton = getImeSwitchButton(); if (imeSwitchButton != null) { imeSwitchButton.setVisibility(showImeButton ? View.VISIBLE : View.INVISIBLE); } // Update menu button in case the IME state has changed. // Update menu button in case the IME state has changed. setMenuVisibility(mShowMenu, true); setMenuVisibility(mShowMenu, true); Loading Loading @@ -382,9 +405,20 @@ public class NavigationBarView extends LinearLayout { disableRecent = false; disableRecent = false; } } getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE); View backButton = getBackButton(); getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE); if (backButton != null) { getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE); backButton.setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE); } View homeButton = getHomeButton(); if (homeButton != null) { homeButton.setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE); } View recentsButton = getRecentsButton(); if (recentsButton != null) { recentsButton.setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE); } // The app shelf, if it exists, follows the visibility of the home button. // The app shelf, if it exists, follows the visibility of the home button. View appShelf = getAppShelf(); View appShelf = getAppShelf(); Loading Loading @@ -475,7 +509,11 @@ public class NavigationBarView extends LinearLayout { // Only show Menu if IME switcher not shown. // Only show Menu if IME switcher not shown. final boolean shouldShow = mShowMenu && final boolean shouldShow = mShowMenu && ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) == 0); ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) == 0); getMenuButton().setVisibility(shouldShow ? View.VISIBLE : View.INVISIBLE); View menuButton = getMenuButton(); if (menuButton != null) { menuButton.setVisibility(shouldShow ? View.VISIBLE : View.INVISIBLE); } } } @Override @Override Loading @@ -489,7 +527,10 @@ public class NavigationBarView extends LinearLayout { mCurrentView = mRotatedViews[Surface.ROTATION_0]; mCurrentView = mRotatedViews[Surface.ROTATION_0]; getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); View imeSwitchButton = getImeSwitchButton(); if (imeSwitchButton != null) { imeSwitchButton.setOnClickListener(mImeSwitcherClickListener); } updateRTLOrder(); updateRTLOrder(); Loading @@ -515,10 +556,14 @@ public class NavigationBarView extends LinearLayout { } } private void updateRecentsIcon(boolean dockedStackExists) { private void updateRecentsIcon(boolean dockedStackExists) { getRecentsButton().setImageResource(dockedStackExists ImageView recentsButton = getRecentsButton(); if (recentsButton != null) { recentsButton.setImageResource(dockedStackExists ? R.drawable.ic_sysbar_docked ? R.drawable.ic_sysbar_docked : R.drawable.ic_sysbar_recent); : R.drawable.ic_sysbar_recent); } } } public boolean isVertical() { public boolean isVertical() { return mVertical; return mVertical; Loading @@ -533,7 +578,10 @@ public class NavigationBarView extends LinearLayout { mCurrentView.setVisibility(View.VISIBLE); mCurrentView.setVisibility(View.VISIBLE); updateLayoutTransitionsEnabled(); updateLayoutTransitionsEnabled(); getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); View imeSwitchButton = getImeSwitchButton(); if (imeSwitchButton != null) { imeSwitchButton.setOnClickListener(mImeSwitcherClickListener); } mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone); mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +20 −8 Original line number Original line Diff line number Diff line Loading @@ -1184,14 +1184,26 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, private void prepareNavigationBarView() { private void prepareNavigationBarView() { mNavigationBarView.reorient(); mNavigationBarView.reorient(); mNavigationBarView.getRecentsButton().setOnClickListener(mRecentsClickListener); View recentsButton = mNavigationBarView.getRecentsButton(); mNavigationBarView.getRecentsButton().setOnTouchListener(mRecentsPreloadOnTouchListener); if (recentsButton != null) { mNavigationBarView.getRecentsButton().setLongClickable(true); recentsButton.setOnClickListener(mRecentsClickListener); mNavigationBarView.getRecentsButton().setOnLongClickListener(mRecentsLongClickListener); recentsButton.setOnTouchListener(mRecentsPreloadOnTouchListener); mNavigationBarView.getBackButton().setLongClickable(true); recentsButton.setLongClickable(true); mNavigationBarView.getBackButton().setOnLongClickListener(mLongPressBackListener); recentsButton.setOnLongClickListener(mRecentsLongClickListener); mNavigationBarView.getHomeButton().setOnTouchListener(mHomeActionListener); } mNavigationBarView.getHomeButton().setOnLongClickListener(mLongPressHomeListener); View backButton = mNavigationBarView.getBackButton(); if (backButton != null) { backButton.setLongClickable(true); backButton.setOnLongClickListener(mLongPressBackListener); } View homeButton = mNavigationBarView.getHomeButton(); if (homeButton != null) { homeButton.setOnTouchListener(mHomeActionListener); homeButton.setOnLongClickListener(mLongPressHomeListener); } mAssistManager.onConfigurationChanged(); mAssistManager.onConfigurationChanged(); } } Loading