summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2011-08-17 16:47:19 -0400
committerDaniel Sandler <dsandler@android.com>2011-08-19 11:46:11 -0400
commite137a1ea997036248c86e8fc0a94711020721f19 (patch)
tree2b541826dd2807ac6f999fe116bfbdfb51f68eb9 /packages
parente644b647837a2f2835c20423d0657cca19d3595a (diff)
downloadframeworks_base-e137a1ea997036248c86e8fc0a94711020721f19.zip
frameworks_base-e137a1ea997036248c86e8fc0a94711020721f19.tar.gz
frameworks_base-e137a1ea997036248c86e8fc0a94711020721f19.tar.bz2
Low profile mode ("lights out") for phone status bar.
Also changes NAVIGATION_HIDDEN to remove the hide animation, hopefully reducing the number of jarring transitions when apps want to enable super-ultra-full-screen mode. Bug: 5052456 Bug: 5146960 Change-Id: I5f5ebb23add81243dc8861b65d8f15ca4d9ce0d2
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/layout/navigation_bar.xml101
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java78
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java13
3 files changed, 179 insertions, 13 deletions
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index 6c4c9c1..fbca299 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -23,12 +23,12 @@
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
android:layout_height="match_parent"
android:layout_width="match_parent"
+ android:background="#FF000000"
>
<FrameLayout android:id="@+id/rot0"
android:layout_height="match_parent"
android:layout_width="match_parent"
- android:background="#FF000000"
>
<LinearLayout
@@ -98,6 +98,51 @@
/>
</LinearLayout>
+ <!-- lights out layout to match exactly -->
+ <LinearLayout
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:orientation="horizontal"
+ android:id="@+id/lights_out"
+ android:visibility="gone"
+ >
+ <ImageView
+ android:layout_width="80dp"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="40dp"
+ android:src="@drawable/ic_sysbar_lights_out_dot_small"
+ android:scaleType="center"
+ android:layout_weight="0"
+ />
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:visibility="invisible"
+ />
+ <ImageView
+ android:layout_width="80dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ android:layout_weight="0"
+ />
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:visibility="invisible"
+ />
+ <ImageView
+ android:layout_width="80dp"
+ android:layout_marginRight="40dp"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_small"
+ android:scaleType="center"
+ android:layout_weight="0"
+ />
+ </LinearLayout>
+
<View android:id="@+id/deadzone"
android:layout_height="@dimen/navigation_bar_deadzone_size"
android:layout_width="match_parent"
@@ -109,7 +154,6 @@
<FrameLayout android:id="@+id/rot90"
android:layout_height="match_parent"
android:layout_width="match_parent"
- android:background="#FF000000"
android:visibility="gone"
android:paddingTop="24dp"
>
@@ -131,6 +175,8 @@
systemui:keyCode="82"
android:layout_weight="0"
android:visibility="invisible"
+ android:contentDescription="@string/accessibility_menu"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
/>
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
android:layout_height="80dp"
@@ -171,15 +217,56 @@
android:contentDescription="@string/accessibility_back"
systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
/>
- <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
+ <View
android:layout_height="40dp"
android:layout_width="match_parent"
- android:src="@drawable/ic_sysbar_menu_land"
- systemui:keyCode="82"
android:layout_weight="0"
android:visibility="invisible"
- android:contentDescription="@string/accessibility_menu"
- systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
+ />
+ </LinearLayout>
+
+ <!-- lights out layout to match exactly -->
+ <LinearLayout
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:orientation="vertical"
+ android:id="@+id/lights_out"
+ android:visibility="gone"
+ >
+ <ImageView
+ android:layout_height="80dp"
+ android:layout_marginTop="40dp"
+ android:layout_width="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_small"
+ android:scaleType="center"
+ android:layout_weight="0"
+ />
+ <View
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:layout_weight="1"
+ android:visibility="invisible"
+ />
+ <ImageView
+ android:layout_height="80dp"
+ android:layout_width="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_large"
+ android:scaleType="center"
+ android:layout_weight="0"
+ />
+ <View
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:layout_weight="1"
+ android:visibility="invisible"
+ />
+ <ImageView
+ android:layout_height="80dp"
+ android:layout_marginBottom="40dp"
+ android:layout_width="match_parent"
+ android:src="@drawable/ic_sysbar_lights_out_dot_small"
+ android:scaleType="center"
+ android:layout_weight="0"
/>
</LinearLayout>
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 5f1ae58..e6c0b96 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -25,6 +25,7 @@ import android.content.res.Resources;
import android.os.ServiceManager;
import android.util.AttributeSet;
import android.util.Slog;
+import android.view.animation.AccelerateInterpolator;
import android.view.Display;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -47,6 +48,8 @@ public class NavigationBarView extends LinearLayout {
final static boolean NAVBAR_ALWAYS_AT_RIGHT = true;
+ final static boolean ANIMATE_HIDE_TRANSITION = false; // turned off because it introduces unsightly delay when videos goes to full screen
+
protected IStatusBarService mBarService;
final Display mDisplay;
View mCurrentView = null;
@@ -56,7 +59,7 @@ public class NavigationBarView extends LinearLayout {
int mBarSize;
boolean mVertical;
- boolean mHidden;
+ boolean mHidden, mLowProfile;
boolean mEnabled = true;
public View getRecentsButton() {
@@ -87,6 +90,65 @@ public class NavigationBarView extends LinearLayout {
mCurrentView.setVisibility(enable ? View.VISIBLE : View.INVISIBLE);
}
+ View.OnTouchListener mLightsOutListener = new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent ev) {
+ if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ // even though setting the systemUI visibility below will turn these views
+ // on, we need them to come up faster so that they can catch this motion
+ // event
+ setLowProfile(false, false);
+
+ try {
+ mBarService.setSystemUiVisibility(0);
+ } catch (android.os.RemoteException ex) {
+ }
+ }
+ return false;
+ }
+ };
+
+ public void setLowProfile(final boolean lightsOut) {
+ setLowProfile(lightsOut, true);
+ }
+
+ public void setLowProfile(final boolean lightsOut, final boolean animate) {
+ if (lightsOut == mLowProfile) return;
+
+ mLowProfile = lightsOut;
+
+ if (DEBUG) Slog.d(TAG, "setting lights " + (lightsOut?"out":"on"));
+
+ final View navButtons = mCurrentView.findViewById(R.id.nav_buttons);
+ final View lowLights = mCurrentView.findViewById(R.id.lights_out);
+
+ if (!animate) {
+ lowLights.setVisibility(View.GONE);
+ navButtons.setAlpha(1f);
+ } else {
+ navButtons.animate()
+ .alpha(lightsOut ? 0f : 1f)
+ .setDuration(lightsOut ? 600 : 200)
+ .start();
+
+ lowLights.setOnTouchListener(mLightsOutListener);
+ lowLights.setAlpha(0f);
+ lowLights.setVisibility(View.VISIBLE);
+ lowLights.animate()
+ .alpha(lightsOut ? 1f : 0f)
+ .setStartDelay(lightsOut ? 500 : 0)
+ .setDuration(lightsOut ? 1000 : 300)
+ .setInterpolator(new AccelerateInterpolator(2.0f))
+ .setListener(lightsOut ? null : new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator _a) {
+ lowLights.setVisibility(View.GONE);
+ }
+ })
+ .start();
+ }
+ }
+
public void setHidden(final boolean hide) {
if (hide == mHidden) return;
@@ -94,6 +156,14 @@ public class NavigationBarView extends LinearLayout {
Slog.d(TAG,
(hide ? "HIDING" : "SHOWING") + " navigation bar");
+ // bring up the lights no matter what
+ setLowProfile(false);
+
+ if (!ANIMATE_HIDE_TRANSITION) {
+ setVisibility(hide ? View.GONE : View.VISIBLE);
+ return;
+ }
+
float oldAlpha = mCurrentView.getAlpha();
if (DEBUG) {
Slog.d(TAG, "animating alpha: " + oldAlpha + " -> "
@@ -147,8 +217,10 @@ public class NavigationBarView extends LinearLayout {
@Override
public boolean onTouchEvent(MotionEvent ev) {
- // immediately bring up the lights
- setHidden(false);
+ try {
+ mBarService.setSystemUiVisibility(0);
+ } catch (android.os.RemoteException ex) {
+ }
return false; // pass it on
}
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 fab593e..7a563c7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1494,11 +1494,18 @@ public class PhoneStatusBar extends StatusBar {
@Override // CommandQueue
public void setSystemUiVisibility(int vis) {
- if (vis != mSystemUiVisibility) {
+ final int old = mSystemUiVisibility;
+ final int diff = vis ^ old;
+
+ if (diff != 0) {
mSystemUiVisibility = vis;
- if (0 != (vis & View.SYSTEM_UI_FLAG_LOW_PROFILE)) {
- animateCollapse();
+ if (0 != (diff & View.SYSTEM_UI_FLAG_LOW_PROFILE)) {
+ final boolean lightsOut = (0 != (vis & View.SYSTEM_UI_FLAG_LOW_PROFILE));
+ if (lightsOut) {
+ animateCollapse();
+ }
+ mNavigationBarView.setLowProfile(lightsOut);
}
notifyUiVisibilityChanged();