summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2013-10-28 18:40:56 -0400
committerJohn Spurlock <jspurlock@google.com>2013-11-01 11:33:48 -0400
commit56d007b99841f7f603e5d5bc5c23b94c010f1945 (patch)
treef9b18f6e733f35d112130289d29d659c5d98c68b /packages
parente6411e681018289c58ae6f622c11db7c800de962 (diff)
downloadframeworks_base-56d007b99841f7f603e5d5bc5c23b94c010f1945.zip
frameworks_base-56d007b99841f7f603e5d5bc5c23b94c010f1945.tar.gz
frameworks_base-56d007b99841f7f603e5d5bc5c23b94c010f1945.tar.bz2
Manage keyguard nav elements using transitions.
Move the logic for managing dimming the navigation bar elements on the lockscreen into BarTransitions. Replace search light + camera assets with new versions at full brightness, and apply 50% dimming at runtime, including the IME dismiss button. Remove unused StatusBarManager _NOP hints. Improve choreography between camera button + password security (w/ IME). Fix a few found bugs in PagedView. Improve password security unlock transition, manually fade in back along with the rest of the icons. Bug:11221659 Change-Id: Ifd1f8c9f400d90542f0ca858b9a4deacabbd518a
Diffstat (limited to 'packages')
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardViewStateManager.java23
-rw-r--r--packages/Keyguard/src/com/android/keyguard/PagedView.java32
-rw-r--r--packages/SystemUI/res/drawable-hdpi/ic_sysbar_camera.pngbin1507 -> 1517 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/search_light.pngbin953 -> 685 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_camera.pngbin1066 -> 1060 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/search_light.pngbin701 -> 537 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/ic_sysbar_camera.pngbin1979 -> 1998 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/search_light.pngbin1343 -> 939 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_camera.pngbin4806 -> 4172 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/search_light.pngbin4248 -> 3651 bytes
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java50
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java165
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java30
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java4
17 files changed, 232 insertions, 106 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewStateManager.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewStateManager.java
index 8e39628..c648177 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewStateManager.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardViewStateManager.java
@@ -15,6 +15,9 @@
*/
package com.android.keyguard;
+import android.animation.Animator;
+import android.animation.Animator.AnimatorListener;
+import android.animation.AnimatorListenerAdapter;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
@@ -46,6 +49,20 @@ public class KeyguardViewStateManager implements
int mChallengeTop = 0;
+ private final AnimatorListener mPauseListener = new AnimatorListenerAdapter() {
+ public void onAnimationEnd(Animator animation) {
+ mKeyguardSecurityContainer.onPause();
+ }
+ };
+
+ private final AnimatorListener mResumeListener = new AnimatorListenerAdapter() {
+ public void onAnimationEnd(Animator animation) {
+ if (((View)mKeyguardSecurityContainer).isShown()) {
+ mKeyguardSecurityContainer.onResume(0);
+ }
+ }
+ };
+
public KeyguardViewStateManager(KeyguardHostView hostView) {
mKeyguardHostView = hostView;
}
@@ -102,11 +119,13 @@ public class KeyguardViewStateManager implements
}
public void fadeOutSecurity(int duration) {
- ((View) mKeyguardSecurityContainer).animate().alpha(0f).setDuration(duration).start();
+ ((View) mKeyguardSecurityContainer).animate().alpha(0f).setDuration(duration)
+ .setListener(mPauseListener).start();
}
public void fadeInSecurity(int duration) {
- ((View) mKeyguardSecurityContainer).animate().alpha(1f).setDuration(duration).start();
+ ((View) mKeyguardSecurityContainer).animate().alpha(1f).setDuration(duration)
+ .setListener(mResumeListener).start();
}
public void onPageBeginMoving() {
diff --git a/packages/Keyguard/src/com/android/keyguard/PagedView.java b/packages/Keyguard/src/com/android/keyguard/PagedView.java
index 9d237dc..1262e07 100644
--- a/packages/Keyguard/src/com/android/keyguard/PagedView.java
+++ b/packages/Keyguard/src/com/android/keyguard/PagedView.java
@@ -267,6 +267,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
private boolean mIsCameraEvent;
private float mWarpPeekAmount;
+ private boolean mOnPageEndWarpCalled;
+ private boolean mOnPageBeginWarpCalled;
public interface PageSwitchListener {
void onPageSwitching(View newPage, int newPageIndex);
@@ -491,7 +493,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
if (!mIsPageMoving) {
mIsPageMoving = true;
if (isWarping()) {
- onPageBeginWarp();
+ dispatchOnPageBeginWarp();
if (mPageSwapIndex != -1) {
swapPages(mPageSwapIndex, mPageWarpIndex);
}
@@ -500,6 +502,22 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
}
+ private void dispatchOnPageBeginWarp() {
+ if (!mOnPageBeginWarpCalled) {
+ onPageBeginWarp();
+ mOnPageBeginWarpCalled = true;
+ }
+ mOnPageEndWarpCalled = false;
+ }
+
+ private void dispatchOnPageEndWarp() {
+ if (!mOnPageEndWarpCalled) {
+ onPageEndWarp();
+ mOnPageEndWarpCalled = true;
+ }
+ mOnPageBeginWarpCalled = false;
+ }
+
protected void pageEndMoving() {
if (DEBUG_WARP) Log.v(TAG, "pageEndMoving(" + mIsPageMoving + ")");
if (mIsPageMoving) {
@@ -508,7 +526,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
if (mPageSwapIndex != -1) {
swapPages(mPageSwapIndex, mPageWarpIndex);
}
- onPageEndWarp();
+ dispatchOnPageEndWarp();
resetPageWarp();
}
onPageEndMoving();
@@ -1919,7 +1937,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
if (isWarping()) {
- onPageEndWarp();
+ dispatchOnPageEndWarp();
resetPageWarp();
}
@@ -2702,7 +2720,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
@Override
public void onAnimationEnd(Animator animation) {
mWarpAnimation = null;
- mWarpPageExposed = true;
+ mWarpPageExposed = false;
}
};
@@ -2727,9 +2745,9 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
private void animateWarpPageOnScreen(String reason) {
if (DEBUG_WARP) Log.v(TAG, "animateWarpPageOnScreen(" + reason + ")");
- if (isWarping()) {
+ if (isWarping() && !mWarpPageExposed) {
mWarpPageExposed = true;
- onPageBeginWarp();
+ dispatchOnPageBeginWarp();
KeyguardWidgetFrame v = (KeyguardWidgetFrame) getPageAt(mPageWarpIndex);
if (DEBUG_WARP) Log.v(TAG, "moving page on screen: Tx=" + v.getTranslationX());
DecelerateInterpolator interp = new DecelerateInterpolator(1.5f);
@@ -2744,7 +2762,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
private void animateWarpPageOffScreen(String reason, boolean animate) {
if (DEBUG_WARP) Log.v(TAG, "animateWarpPageOffScreen(" + reason + " anim:" + animate + ")");
if (isWarping()) {
- onPageEndWarp();
+ dispatchOnPageEndWarp();
KeyguardWidgetFrame v = (KeyguardWidgetFrame) getPageAt(mPageWarpIndex);
if (DEBUG_WARP) Log.v(TAG, "moving page off screen: Tx=" + v.getTranslationX());
AccelerateInterpolator interp = new AccelerateInterpolator(1.5f);
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_camera.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_camera.png
index 8f4cb64..c6f03c4 100644
--- a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_camera.png
+++ b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_camera.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/search_light.png b/packages/SystemUI/res/drawable-hdpi/search_light.png
index 116b1f0..3c0dc4e 100644
--- a/packages/SystemUI/res/drawable-hdpi/search_light.png
+++ b/packages/SystemUI/res/drawable-hdpi/search_light.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_camera.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_camera.png
index 2142147..1c2d7aa 100644
--- a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_camera.png
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_camera.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/search_light.png b/packages/SystemUI/res/drawable-mdpi/search_light.png
index 7a70984..8010ce7 100644
--- a/packages/SystemUI/res/drawable-mdpi/search_light.png
+++ b/packages/SystemUI/res/drawable-mdpi/search_light.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_camera.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_camera.png
index b0ea8e0..fbd4d6b 100644
--- a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_camera.png
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_camera.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/search_light.png b/packages/SystemUI/res/drawable-xhdpi/search_light.png
index e2aed09..6d46fdd 100644
--- a/packages/SystemUI/res/drawable-xhdpi/search_light.png
+++ b/packages/SystemUI/res/drawable-xhdpi/search_light.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_camera.png b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_camera.png
index aac3428..86df881 100644
--- a/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_camera.png
+++ b/packages/SystemUI/res/drawable-xxhdpi/ic_sysbar_camera.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/search_light.png b/packages/SystemUI/res/drawable-xxhdpi/search_light.png
index e5ef85d..7742207 100644
--- a/packages/SystemUI/res/drawable-xxhdpi/search_light.png
+++ b/packages/SystemUI/res/drawable-xxhdpi/search_light.png
Binary files differ
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index e8173b7..39333d7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -55,8 +55,7 @@ public class CommandQueue extends IStatusBar.Stub {
private static final int MSG_TOGGLE_RECENT_APPS = 13 << MSG_SHIFT;
private static final int MSG_PRELOAD_RECENT_APPS = 14 << MSG_SHIFT;
private static final int MSG_CANCEL_PRELOAD_RECENT_APPS = 15 << MSG_SHIFT;
- private static final int MSG_SET_NAVIGATION_ICON_HINTS = 16 << MSG_SHIFT;
- private static final int MSG_SET_WINDOW_STATE = 17 << MSG_SHIFT;
+ private static final int MSG_SET_WINDOW_STATE = 16 << MSG_SHIFT;
public static final int FLAG_EXCLUDE_NONE = 0;
public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
@@ -98,7 +97,6 @@ public class CommandQueue extends IStatusBar.Stub {
public void showSearchPanel();
public void hideSearchPanel();
public void cancelPreloadRecentApps();
- public void setNavigationIconHints(int hints);
public void setWindowState(int window, int state);
}
@@ -227,13 +225,6 @@ public class CommandQueue extends IStatusBar.Stub {
}
}
- public void setNavigationIconHints(int hints) {
- synchronized (mList) {
- mHandler.removeMessages(MSG_SET_NAVIGATION_ICON_HINTS);
- mHandler.obtainMessage(MSG_SET_NAVIGATION_ICON_HINTS, hints, 0, null).sendToTarget();
- }
- }
-
public void setWindowState(int window, int state) {
synchronized (mList) {
// don't coalesce these
@@ -318,9 +309,6 @@ public class CommandQueue extends IStatusBar.Stub {
case MSG_CANCEL_PRELOAD_RECENT_APPS:
mCallbacks.cancelPreloadRecentApps();
break;
- case MSG_SET_NAVIGATION_ICON_HINTS:
- mCallbacks.setNavigationIconHints(msg.arg1);
- break;
case MSG_SET_WINDOW_STATE:
mCallbacks.setWindowState(msg.arg1, msg.arg2);
break;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
index 8ad538b..cb17ac6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java
@@ -99,6 +99,10 @@ public class BarTransitions {
mBarBackground.finishAnimation();
}
+ public void setContentVisible(boolean visible) {
+ // for subclasses
+ }
+
private static class BarBackgroundDrawable extends Drawable {
private final int mOpaque;
private final int mSemiTransparent;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
index 5d4b995..a74230b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
@@ -30,6 +30,9 @@ import com.android.systemui.statusbar.policy.KeyButtonView;
public final class NavigationBarTransitions extends BarTransitions {
+ private static final float KEYGUARD_QUIESCENT_ALPHA = 0.5f;
+ private static final int CONTENT_FADE_DURATION = 200;
+
private final NavigationBarView mView;
private final IStatusBarService mBarService;
@@ -73,18 +76,57 @@ public final class NavigationBarTransitions extends BarTransitions {
private void applyMode(int mode, boolean animate, boolean force) {
// apply to key buttons
- final boolean isOpaque = mode == MODE_OPAQUE || mode == MODE_LIGHTS_OUT;
- final float alpha = isOpaque ? KeyButtonView.DEFAULT_QUIESCENT_ALPHA : 1f;
- setKeyButtonViewQuiescentAlpha(mView.getBackButton(), alpha, animate);
+ final float alpha = alphaForMode(mode);
setKeyButtonViewQuiescentAlpha(mView.getHomeButton(), alpha, animate);
setKeyButtonViewQuiescentAlpha(mView.getRecentsButton(), alpha, animate);
setKeyButtonViewQuiescentAlpha(mView.getMenuButton(), alpha, animate);
- setKeyButtonViewQuiescentAlpha(mView.getCameraButton(), alpha, animate);
+
+ setKeyButtonViewQuiescentAlpha(mView.getSearchLight(), KEYGUARD_QUIESCENT_ALPHA, animate);
+ setKeyButtonViewQuiescentAlpha(mView.getCameraButton(), KEYGUARD_QUIESCENT_ALPHA, animate);
+
+ applyBackButtonQuiescentAlpha(mode, animate);
// apply to lights out
applyLightsOut(mode == MODE_LIGHTS_OUT, animate, force);
}
+ private float alphaForMode(int mode) {
+ final boolean isOpaque = mode == MODE_OPAQUE || mode == MODE_LIGHTS_OUT;
+ return isOpaque ? KeyButtonView.DEFAULT_QUIESCENT_ALPHA : 1f;
+ }
+
+ public void applyBackButtonQuiescentAlpha(int mode, boolean animate) {
+ float backAlpha = 0;
+ backAlpha = maxVisibleQuiescentAlpha(backAlpha, mView.getSearchLight());
+ backAlpha = maxVisibleQuiescentAlpha(backAlpha, mView.getCameraButton());
+ backAlpha = maxVisibleQuiescentAlpha(backAlpha, mView.getHomeButton());
+ backAlpha = maxVisibleQuiescentAlpha(backAlpha, mView.getRecentsButton());
+ backAlpha = maxVisibleQuiescentAlpha(backAlpha, mView.getMenuButton());
+ if (backAlpha > 0) {
+ setKeyButtonViewQuiescentAlpha(mView.getBackButton(), backAlpha, animate);
+ }
+ }
+
+ private static float maxVisibleQuiescentAlpha(float max, View v) {
+ if ((v instanceof KeyButtonView) && v.isShown()) {
+ return Math.max(max, ((KeyButtonView)v).getQuiescentAlpha());
+ }
+ return max;
+ }
+
+ @Override
+ public void setContentVisible(boolean visible) {
+ final float alpha = visible ? 1 : 0;
+ fadeContent(mView.getCameraButton(), alpha);
+ fadeContent(mView.getSearchLight(), alpha);
+ }
+
+ private void fadeContent(View v, float alpha) {
+ if (v != null) {
+ v.animate().alpha(alpha).setDuration(CONTENT_FADE_DURATION);
+ }
+ }
+
private void setKeyButtonViewQuiescentAlpha(View button, float alpha, boolean animate) {
if (button instanceof KeyButtonView) {
((KeyButtonView) button).setQuiescentAlpha(alpha, animate);
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 d1c4109..839016d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -17,6 +17,10 @@
package com.android.systemui.statusbar.phone;
import android.animation.LayoutTransition;
+import android.animation.LayoutTransition.TransitionListener;
+import android.animation.ObjectAnimator;
+import android.animation.TimeInterpolator;
+import android.animation.ValueAnimator;
import android.app.ActivityManagerNative;
import android.app.StatusBarManager;
import android.app.admin.DevicePolicyManager;
@@ -48,12 +52,12 @@ import com.android.systemui.R;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.DelegateViewHelper;
import com.android.systemui.statusbar.policy.DeadZone;
+import com.android.systemui.statusbar.policy.KeyButtonView;
import java.io.FileDescriptor;
import java.io.PrintWriter;
public class NavigationBarView extends LinearLayout {
- private static final int CAMERA_BUTTON_FADE_DURATION = 200;
final static boolean DEBUG = false;
final static String TAG = "PhoneStatusBar/NavigationBarView";
@@ -89,6 +93,54 @@ public class NavigationBarView extends LinearLayout {
// used to disable the camera icon in navbar when disabled by DPM
private boolean mCameraDisabledByDpm;
+ // performs manual animation in sync with layout transitions
+ private final NavTransitionListener mTransitionListener = new NavTransitionListener();
+
+ private class NavTransitionListener implements TransitionListener {
+ private boolean mBackTransitioning;
+ private boolean mHomeAppearing;
+ private long mStartDelay;
+ private long mDuration;
+ private TimeInterpolator mInterpolator;
+
+ @Override
+ public void startTransition(LayoutTransition transition, ViewGroup container,
+ View view, int transitionType) {
+ if (view.getId() == R.id.back) {
+ mBackTransitioning = true;
+ } else if (view.getId() == R.id.home && transitionType == LayoutTransition.APPEARING) {
+ mHomeAppearing = true;
+ mStartDelay = transition.getStartDelay(transitionType);
+ mDuration = transition.getDuration(transitionType);
+ mInterpolator = transition.getInterpolator(transitionType);
+ }
+ }
+
+ @Override
+ public void endTransition(LayoutTransition transition, ViewGroup container,
+ View view, int transitionType) {
+ if (view.getId() == R.id.back) {
+ mBackTransitioning = false;
+ } else if (view.getId() == R.id.home && transitionType == LayoutTransition.APPEARING) {
+ mHomeAppearing = false;
+ }
+ }
+
+ public void onBackAltCleared() {
+ // When dismissing ime during unlock, force the back button to run the same appearance
+ // animation as home (if we catch this condition early enough).
+ if (!mBackTransitioning && getBackButton().getVisibility() == VISIBLE
+ && mHomeAppearing && getHomeButton().getAlpha() == 0) {
+ getBackButton().setAlpha(0);
+ ValueAnimator a = ObjectAnimator.ofFloat(getBackButton(), "alpha", 0, 1);
+ a.setStartDelay(mStartDelay);
+ a.setDuration(mDuration);
+ a.setInterpolator(mInterpolator);
+ a.start();
+ }
+ }
+ }
+
// simplified click handler to be used when device is in accessibility mode
private final OnClickListener mAccessibilityClickListener = new OnClickListener() {
@Override
@@ -108,12 +160,12 @@ public class NavigationBarView extends LinearLayout {
case MotionEvent.ACTION_DOWN:
// disable search gesture while interacting with camera
mDelegateHelper.setDisabled(true);
- transitionCameraAndSearchButtonAlpha(0.0f);
+ mBarTransitions.setContentVisible(false);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
mDelegateHelper.setDisabled(false);
- transitionCameraAndSearchButtonAlpha(1.0f);
+ mBarTransitions.setContentVisible(true);
break;
}
return KeyguardTouchDelegate.getInstance(getContext()).dispatch(event);
@@ -163,17 +215,6 @@ public class NavigationBarView extends LinearLayout {
watchForDevicePolicyChanges();
}
- protected void transitionCameraAndSearchButtonAlpha(float alpha) {
- View cameraButtonView = getCameraButton();
- if (cameraButtonView != null) {
- cameraButtonView.animate().alpha(alpha).setDuration(CAMERA_BUTTON_FADE_DURATION);
- }
- View searchLight = getSearchLight();
- if (searchLight != null) {
- searchLight.animate().alpha(alpha).setDuration(CAMERA_BUTTON_FADE_DURATION);
- }
- }
-
private void watchForDevicePolicyChanges() {
final IntentFilter filter = new IntentFilter();
filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
@@ -277,7 +318,10 @@ public class NavigationBarView extends LinearLayout {
public void setNavigationIconHints(int hints, boolean force) {
if (!force && hints == mNavigationIconHints) return;
-
+ final boolean backAlt = (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0;
+ if ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0 && !backAlt) {
+ mTransitionListener.onBackAltCleared();
+ }
if (DEBUG) {
android.widget.Toast.makeText(mContext,
"Navigation icon hints = " + hints,
@@ -286,15 +330,7 @@ public class NavigationBarView extends LinearLayout {
mNavigationIconHints = hints;
- getBackButton().setAlpha(
- (0 != (hints & StatusBarManager.NAVIGATION_HINT_BACK_NOP)) ? 0.5f : 1.0f);
- getHomeButton().setAlpha(
- (0 != (hints & StatusBarManager.NAVIGATION_HINT_HOME_NOP)) ? 0.5f : 1.0f);
- getRecentsButton().setAlpha(
- (0 != (hints & StatusBarManager.NAVIGATION_HINT_RECENT_NOP)) ? 0.5f : 1.0f);
-
- ((ImageView)getBackButton()).setImageDrawable(
- (0 != (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT))
+ ((ImageView)getBackButton()).setImageDrawable(backAlt
? (mVertical ? mBackAltLandIcon : mBackAltIcon)
: (mVertical ? mBackLandIcon : mBackIcon));
@@ -322,13 +358,20 @@ public class NavigationBarView extends LinearLayout {
setSlippery(disableHome && disableRecent && disableBack && disableSearch);
}
- if (!mScreenOn && mCurrentView != null) {
- ViewGroup navButtons = (ViewGroup) mCurrentView.findViewById(R.id.nav_buttons);
- LayoutTransition lt = navButtons == null ? null : navButtons.getLayoutTransition();
+ ViewGroup navButtons = (ViewGroup) mCurrentView.findViewById(R.id.nav_buttons);
+ if (navButtons != null) {
+ LayoutTransition lt = navButtons.getLayoutTransition();
if (lt != null) {
- lt.disableTransitionType(
- LayoutTransition.CHANGE_APPEARING | LayoutTransition.CHANGE_DISAPPEARING |
- LayoutTransition.APPEARING | LayoutTransition.DISAPPEARING);
+ if (!lt.getTransitionListeners().contains(mTransitionListener)) {
+ lt.addTransitionListener(mTransitionListener);
+ }
+ if (!mScreenOn && mCurrentView != null) {
+ lt.disableTransitionType(
+ LayoutTransition.CHANGE_APPEARING |
+ LayoutTransition.CHANGE_DISAPPEARING |
+ LayoutTransition.APPEARING |
+ LayoutTransition.DISAPPEARING);
+ }
}
}
@@ -336,12 +379,17 @@ public class NavigationBarView extends LinearLayout {
getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
- final boolean shouldShowSearch = disableHome && !disableSearch;
- getSearchLight().setVisibility(shouldShowSearch ? View.VISIBLE : View.GONE);
- final View cameraButton = getCameraButton();
- if (cameraButton != null) {
- cameraButton.setVisibility(
- shouldShowSearch && !mCameraDisabledByDpm ? View.VISIBLE : View.GONE);
+ final boolean showSearch = disableHome && !disableSearch;
+ final boolean showCamera = showSearch && !mCameraDisabledByDpm;
+ setVisibleOrGone(getSearchLight(), showSearch);
+ setVisibleOrGone(getCameraButton(), showCamera);
+
+ mBarTransitions.applyBackButtonQuiescentAlpha(mBarTransitions.getMode(), true /*animate*/);
+ }
+
+ private void setVisibleOrGone(View view, boolean visible) {
+ if (view != null) {
+ view.setVisibility(visible ? VISIBLE : GONE);
}
}
@@ -574,28 +622,31 @@ public class NavigationBarView extends LinearLayout {
mVertical ? "true" : "false",
mShowMenu ? "true" : "false"));
- final View back = getBackButton();
- final View home = getHomeButton();
- final View recent = getRecentsButton();
- final View menu = getMenuButton();
-
- pw.println(" back: "
- + PhoneStatusBar.viewInfo(back)
- + " " + visibilityToString(back.getVisibility())
- );
- pw.println(" home: "
- + PhoneStatusBar.viewInfo(home)
- + " " + visibilityToString(home.getVisibility())
- );
- pw.println(" rcnt: "
- + PhoneStatusBar.viewInfo(recent)
- + " " + visibilityToString(recent.getVisibility())
- );
- pw.println(" menu: "
- + PhoneStatusBar.viewInfo(menu)
- + " " + visibilityToString(menu.getVisibility())
- );
+ dumpButton(pw, "back", getBackButton());
+ dumpButton(pw, "home", getHomeButton());
+ dumpButton(pw, "rcnt", getRecentsButton());
+ dumpButton(pw, "menu", getMenuButton());
+ dumpButton(pw, "srch", getSearchLight());
+ dumpButton(pw, "cmra", getCameraButton());
+
pw.println(" }");
}
+ private static void dumpButton(PrintWriter pw, String caption, View button) {
+ pw.print(" " + caption + ": ");
+ if (button == null) {
+ pw.print("null");
+ } else {
+ pw.print(PhoneStatusBar.viewInfo(button)
+ + " " + visibilityToString(button.getVisibility())
+ + " alpha=" + button.getAlpha()
+ );
+ if (button instanceof KeyButtonView) {
+ pw.print(" drawingAlpha=" + ((KeyButtonView)button).getDrawingAlpha());
+ pw.print(" quiescentAlpha=" + ((KeyButtonView)button).getQuiescentAlpha());
+ }
+ }
+ pw.println();
+ }
+
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 39a9ba7..607ce41 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -53,6 +53,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
+import android.os.PowerManager;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.UserHandle;
@@ -632,6 +633,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
}
+ PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
+ mBroadcastReceiver.onReceive(mContext,
+ new Intent(pm.isScreenOn() ? Intent.ACTION_SCREEN_ON : Intent.ACTION_SCREEN_OFF));
+
// receive broadcasts
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
@@ -649,14 +654,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
@Override
protected void onShowSearchPanel() {
if (mNavigationBarView != null) {
- mNavigationBarView.transitionCameraAndSearchButtonAlpha(0.0f);
+ mNavigationBarView.getBarTransitions().setContentVisible(false);
}
}
@Override
protected void onHideSearchPanel() {
if (mNavigationBarView != null) {
- mNavigationBarView.transitionCameraAndSearchButtonAlpha(1.0f);
+ mNavigationBarView.getBarTransitions().setContentVisible(true);
}
}
@@ -802,7 +807,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
private void repositionNavigationBar() {
- if (mNavigationBarView == null) return;
+ if (mNavigationBarView == null || !mNavigationBarView.isAttachedToWindow()) return;
prepareNavigationBarView();
@@ -1807,8 +1812,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
return mGestureRec;
}
- @Override // CommandQueue
- public void setNavigationIconHints(int hints) {
+ private void setNavigationIconHints(int hints) {
if (hints == mNavigationIconHints) return;
mNavigationIconHints = hints;
@@ -2045,7 +2049,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
boolean altBack = (backDisposition == InputMethodService.BACK_DISPOSITION_WILL_DISMISS)
|| ((vis & InputMethodService.IME_VISIBLE) != 0);
- mCommandQueue.setNavigationIconHints(
+ setNavigationIconHints(
altBack ? (mNavigationIconHints | NAVIGATION_HINT_BACK_ALT)
: (mNavigationIconHints & ~NAVIGATION_HINT_BACK_ALT));
if (mQS != null) mQS.setImeWindowStatus(vis > 0);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index 55fb95d..718acc3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -36,6 +36,7 @@ import android.view.MotionEvent;
import android.view.SoundEffectConstants;
import android.view.View;
import android.view.ViewConfiguration;
+import android.view.ViewDebug;
import android.view.accessibility.AccessibilityEvent;
import android.widget.ImageView;
@@ -53,10 +54,13 @@ public class KeyButtonView extends ImageView {
int mTouchSlop;
Drawable mGlowBG;
int mGlowWidth, mGlowHeight;
- float mGlowAlpha = 0f, mGlowScale = 1f, mDrawingAlpha = 1f;
+ float mGlowAlpha = 0f, mGlowScale = 1f;
+ @ViewDebug.ExportedProperty(category = "drawing")
+ float mDrawingAlpha = 1f;
+ @ViewDebug.ExportedProperty(category = "drawing")
float mQuiescentAlpha = DEFAULT_QUIESCENT_ALPHA;
boolean mSupportsLongpress = true;
- RectF mRect = new RectF(0f,0f,0f,0f);
+ RectF mRect = new RectF();
AnimatorSet mPressedAnim;
Animator mAnimateToQuiescent = new ObjectAnimator();
@@ -90,8 +94,8 @@ public class KeyButtonView extends ImageView {
mSupportsLongpress = a.getBoolean(R.styleable.KeyButtonView_keyRepeat, true);
mGlowBG = a.getDrawable(R.styleable.KeyButtonView_glowBackground);
+ setDrawingAlpha(mQuiescentAlpha);
if (mGlowBG != null) {
- setDrawingAlpha(mQuiescentAlpha);
mGlowWidth = mGlowBG.getIntrinsicWidth();
mGlowHeight = mGlowBG.getIntrinsicHeight();
}
@@ -126,16 +130,14 @@ public class KeyButtonView extends ImageView {
public void setQuiescentAlpha(float alpha, boolean animate) {
mAnimateToQuiescent.cancel();
alpha = Math.min(Math.max(alpha, 0), 1);
- if (alpha == mQuiescentAlpha) return;
+ if (alpha == mQuiescentAlpha && alpha == mDrawingAlpha) return;
mQuiescentAlpha = alpha;
if (DEBUG) Log.d(TAG, "New quiescent alpha = " + mQuiescentAlpha);
- if (mGlowBG != null) {
- if (animate) {
- mAnimateToQuiescent = animateToQuiescent();
- mAnimateToQuiescent.start();
- } else {
- setDrawingAlpha(mQuiescentAlpha);
- }
+ if (mGlowBG != null && animate) {
+ mAnimateToQuiescent = animateToQuiescent();
+ mAnimateToQuiescent.start();
+ } else {
+ setDrawingAlpha(mQuiescentAlpha);
}
}
@@ -143,13 +145,15 @@ public class KeyButtonView extends ImageView {
return ObjectAnimator.ofFloat(this, "drawingAlpha", mQuiescentAlpha);
}
+ public float getQuiescentAlpha() {
+ return mQuiescentAlpha;
+ }
+
public float getDrawingAlpha() {
- if (mGlowBG == null) return 0;
return mDrawingAlpha;
}
public void setDrawingAlpha(float x) {
- if (mGlowBG == null) return;
// Calling setAlpha(int), which is an ImageView-specific
// method that's different from setAlpha(float). This sets
// the alpha on this ImageView's drawable directly
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
index a53b25a..dd13e31 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -89,10 +89,6 @@ public class TvStatusBar extends BaseStatusBar {
}
@Override // CommandQueue
- public void setNavigationIconHints(int hints) {
- }
-
- @Override // CommandQueue
public void setWindowState(int window, int state) {
}