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
/>
</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"
<FrameLayout android:id="@+id/rot90"
android:layout_height="match_parent"
android:layout_width="match_parent"
- android:background="#FF000000"
android:visibility="gone"
android:paddingTop="24dp"
>
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"
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>
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;
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;
int mBarSize;
boolean mVertical;
- boolean mHidden;
+ boolean mHidden, mLowProfile;
boolean mEnabled = true;
public View getRecentsButton() {
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;
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 + " -> "
@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
}