diff options
author | Daniel Sandler <dsandler@android.com> | 2011-09-12 00:58:58 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@android.com> | 2011-09-12 01:02:30 -0400 |
commit | 029d5877b0c19af09c6a1cb7d1c3d3507e88430c (patch) | |
tree | 28e7cb97326d026aaa9a4b6d19bbd3e8f56a4648 | |
parent | f4b783f8a7f7ba56a879b0fce075257659e9f909 (diff) | |
download | frameworks_base-029d5877b0c19af09c6a1cb7d1c3d3507e88430c.zip frameworks_base-029d5877b0c19af09c6a1cb7d1c3d3507e88430c.tar.gz frameworks_base-029d5877b0c19af09c6a1cb7d1c3d3507e88430c.tar.bz2 |
Hide navigation buttons when they are DISABLEd.
Back is hidden by DISABLE_BACK; Home, Recents, and Menu are
hidden by DISABLE_NAVIGATION.
Bug: 5261576
Bug: 5284740 (confusion about visible inactive icons)
Change-Id: I410c133b737cc11d61bac0318dc24458353ee7b3
4 files changed, 20 insertions, 17 deletions
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml index fbca299..25bc2ea 100644 --- a/packages/SystemUI/res/layout/navigation_bar.xml +++ b/packages/SystemUI/res/layout/navigation_bar.xml @@ -38,6 +38,7 @@ android:clipChildren="false" android:clipToPadding="false" android:id="@+id/nav_buttons" + android:animateLayoutChanges="true" > <!-- navigation controls --> @@ -165,6 +166,7 @@ android:clipChildren="false" android:clipToPadding="false" android:id="@+id/nav_buttons" + android:animateLayoutChanges="true" > <!-- navigation controls --> 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 98dca92..cd361ad 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -60,7 +60,6 @@ public class NavigationBarView extends LinearLayout { boolean mVertical; boolean mHidden, mLowProfile; - boolean mEnabled = true; public View getRecentsButton() { return mCurrentView.findViewById(R.id.recent_apps); @@ -93,11 +92,6 @@ public class NavigationBarView extends LinearLayout { mVertical = false; } - public void setEnabled(final boolean enable) { - mEnabled = enable; - mCurrentView.setVisibility(enable ? View.VISIBLE : View.INVISIBLE); - } - View.OnTouchListener mLightsOutListener = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent ev) { @@ -116,6 +110,16 @@ public class NavigationBarView extends LinearLayout { } }; + public void setNavigationVisibility(int disabledFlags) { + boolean disableNavigation = ((disabledFlags & View.STATUS_BAR_DISABLE_NAVIGATION) != 0); + boolean disableBack = ((disabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0); + + getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE); + getHomeButton() .setVisibility(disableNavigation ? View.INVISIBLE : View.VISIBLE); + getRecentsButton().setVisibility(disableNavigation ? View.INVISIBLE : View.VISIBLE); + getMenuButton() .setVisibility(disableNavigation ? View.INVISIBLE : View.VISIBLE); + } + public void setLowProfile(final boolean lightsOut) { setLowProfile(lightsOut, true); } 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 3d05341..69e0752 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -297,7 +297,7 @@ public class PhoneStatusBar extends StatusBar { mNavigationBarView = (NavigationBarView) View.inflate(context, R.layout.navigation_bar, null); - mNavigationBarView.setEnabled((mDisabled & StatusBarManager.DISABLE_NAVIGATION) == 0); + setNavigationVisibility(mDisabled); sb.setOnSystemUiVisibilityChangeListener( new View.OnSystemUiVisibilityChangeListener() { @@ -1129,15 +1129,7 @@ public class PhoneStatusBar extends StatusBar { Slog.i(TAG, "DISABLE_NAVIGATION: " + (disableNavigation ? "yes" : "no")); if (mNavigationBarView != null) { - if (disableNavigation && disableBack) { - mNavigationBarView.setEnabled(false); - } else { - mNavigationBarView.getBackButton().setEnabled(!disableBack); - mNavigationBarView.getHomeButton().setEnabled(!disableNavigation); - mNavigationBarView.getRecentsButton().setEnabled(!disableNavigation); - - mNavigationBarView.setEnabled(true); - } + mNavigationBarView.setNavigationVisibility(visibility); } if (disableNavigation) { diff --git a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java index ad3073a..7c94c2d 100644 --- a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java +++ b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java @@ -114,7 +114,7 @@ public class StatusBarTest extends TestActivity // v.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); // } // }, - new Test("DISABLE_NAVIGATION") { + new Test("systemUiVisibility: STATUS_BAR_DISABLE_NAVIGATION") { public void run() { mListView.setSystemUiVisibility(View.STATUS_BAR_DISABLE_NAVIGATION); } @@ -232,6 +232,11 @@ public class StatusBarTest extends TestActivity mStatusBarManager.disable(StatusBarManager.DISABLE_NAVIGATION); } }, + new Test("Disable Back") { + public void run() { + mStatusBarManager.disable(StatusBarManager.DISABLE_BACK); + } + }, new Test("Disable Clock") { public void run() { mStatusBarManager.disable(StatusBarManager.DISABLE_CLOCK); |