diff options
author | Daniel Sandler <dsandler@android.com> | 2011-06-28 00:29:04 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@google.com> | 2011-06-28 12:07:35 -0400 |
commit | 5c8da949804ed4b55dcebae63796714e0028b488 (patch) | |
tree | 7bfb05e25696b18e8b84d050a9869acef2c09668 /packages | |
parent | 631c57c4967df3df0c5b5da665b2126a474bec8f (diff) | |
download | frameworks_base-5c8da949804ed4b55dcebae63796714e0028b488.zip frameworks_base-5c8da949804ed4b55dcebae63796714e0028b488.tar.gz frameworks_base-5c8da949804ed4b55dcebae63796714e0028b488.tar.bz2 |
Now showing: Navigation Bar, The Final Layout
Starring, in order of appearance:
BACK
and
HOME
and introducing in his first starring role on phones
RECENTS
with a special guest appearance by
MENU
presented in PORTRAVISION and LANSCOPE
Change-Id: I0b8459a6f648a4336a0e1a943e02ba82728a75cb
Diffstat (limited to 'packages')
5 files changed, 104 insertions, 46 deletions
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml index b97c6a5..bc2f7ee 100644 --- a/packages/SystemUI/res/layout/navigation_bar.xml +++ b/packages/SystemUI/res/layout/navigation_bar.xml @@ -35,32 +35,52 @@ <LinearLayout android:id="@+id/rot0" android:layout_height="match_parent" android:layout_width="match_parent" - android:paddingLeft="8dip" - android:paddingRight="8dip" android:orientation="horizontal" > <!-- navigation controls --> + <View + android:layout_width="32dp" + android:layout_height="match_parent" + android:layout_weight="0" + /> <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back" - android:layout_width="wrap_content" + android:layout_width="54dp" android:layout_height="match_parent" - android:src="@drawable/ic_sysbar_back" + android:src="@drawable/ic_sysbar_back_default" systemui:keyCode="4" + android:layout_weight="0" + /> + <View + android:layout_width="match_parent" + android:layout_height="match_parent" android:layout_weight="1" /> <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home" - android:layout_width="wrap_content" + android:layout_width="54dp" android:layout_height="match_parent" - android:src="@drawable/ic_sysbar_home" + android:src="@drawable/ic_sysbar_home_default" systemui:keyCode="3" + android:layout_weight="0" + /> + <View + android:layout_width="match_parent" + android:layout_height="match_parent" android:layout_weight="1" /> + <ImageView android:id="@+id/recent_apps" + android:layout_width="54dp" + android:layout_height="match_parent" + android:src="@drawable/ic_sysbar_recent_default" + android:layout_weight="0" + /> <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu" - android:layout_width="wrap_content" + android:layout_width="32dp" android:layout_height="match_parent" - android:src="@drawable/ic_sysbar_menu" + android:src="@drawable/ic_sysbar_menu_default" systemui:keyCode="82" - android:layout_weight="1" + android:layout_weight="0" + android:visibility="invisible" /> </LinearLayout> @@ -69,29 +89,52 @@ android:layout_width="match_parent" android:orientation="vertical" android:visibility="gone" + android:paddingTop="24dp" > - + <!-- navigation controls --> <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu" + android:layout_height="32dp" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:src="@drawable/ic_sysbar_menu" + android:src="@drawable/ic_sysbar_menu_default_land" systemui:keyCode="82" + android:layout_weight="0" + android:visibility="invisible" + /> + <ImageView android:id="@+id/recent_apps" + android:layout_height="54dp" + android:layout_width="match_parent" + android:src="@drawable/ic_sysbar_recent_default_land" + android:layout_weight="0" + /> + <View + android:layout_height="match_parent" + android:layout_width="match_parent" android:layout_weight="1" /> <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home" + android:layout_height="54dp" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:src="@drawable/ic_sysbar_home" + android:src="@drawable/ic_sysbar_home_default_land" systemui:keyCode="3" + android:layout_weight="0" + /> + <View + android:layout_height="match_parent" + android:layout_width="match_parent" android:layout_weight="1" /> <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back" + android:layout_height="54dp" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:src="@drawable/ic_sysbar_back" + android:src="@drawable/ic_sysbar_back_default_land" systemui:keyCode="4" - android:layout_weight="1" + android:layout_weight="0" + /> + <View + android:layout_height="32dp" + android:layout_width="match_parent" + android:layout_weight="0" /> </LinearLayout> @@ -102,28 +145,7 @@ android:visibility="gone" > - <!-- navigation controls --> - <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:src="@drawable/ic_sysbar_back" - systemui:keyCode="4" - android:layout_weight="1" - /> - <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:src="@drawable/ic_sysbar_home" - systemui:keyCode="3" - android:layout_weight="1" - /> - <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:src="@drawable/ic_sysbar_menu" - systemui:keyCode="82" - android:layout_weight="1" - /> + <!-- not used --> </LinearLayout> </FrameLayout> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index fc35a48..3944c20 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -40,7 +40,7 @@ <dimen name="peek_window_y_offset">-12dp</dimen> <!-- thickness (height) of the navigation bar on phones that require it --> - <dimen name="navigation_bar_size">42dp</dimen> + <dimen name="navigation_bar_size">32dp</dimen> <!-- thickness (height) of each notification row, including any separators or padding --> <dimen name="notification_height">65dp</dimen> 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 7dafb89..22181b8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -40,10 +40,19 @@ public class NavigationBarView extends LinearLayout { protected IStatusBarService mBarService; final Display mDisplay; + View mCurrentView = null; View[] mRotatedViews = new View[4]; View mBackground; Animator mLastAnimator = null; + public View getRecentsButton() { + return mCurrentView.findViewById(R.id.recent_apps); + } + + public View getMenuButton() { + return mCurrentView.findViewById(R.id.menu); + } + public NavigationBarView(Context context, AttributeSet attrs) { super(context, attrs); mDisplay = ((WindowManager)context.getSystemService( @@ -93,6 +102,8 @@ public class NavigationBarView extends LinearLayout { mRotatedViews[Surface.ROTATION_270] = NAVBAR_ALWAYS_AT_RIGHT ? findViewById(R.id.rot90) : findViewById(R.id.rot270); + + mCurrentView = mRotatedViews[Surface.ROTATION_0]; } @Override @@ -107,7 +118,8 @@ public class NavigationBarView extends LinearLayout { for (int i=0; i<4; i++) { mRotatedViews[i].setVisibility(View.GONE); } - mRotatedViews[rot].setVisibility(View.VISIBLE); + mCurrentView = mRotatedViews[rot]; + mCurrentView.setVisibility(View.VISIBLE); android.util.Log.d("NavigationBarView", "reorient(): rot=" + mDisplay.getRotation()); } 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 f3c2623..d8474db 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -372,11 +372,20 @@ public class PhoneStatusBar extends StatusBar { return res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); } + private View.OnClickListener mRecentsClickListener = new View.OnClickListener() { + public void onClick(View v) { + toggleRecentApps(); + } + }; + // For small-screen devices (read: phones) that lack hardware navigation buttons private void addNavigationBar() { if (mNavigationBarView == null) return; mNavigationBarView.reorient(); + + mNavigationBarView.getRecentsButton().setOnClickListener(mRecentsClickListener); + WindowManagerImpl.getDefault().addView( mNavigationBarView, getNavigationBarLayoutParams()); } @@ -385,6 +394,9 @@ public class PhoneStatusBar extends StatusBar { if (mNavigationBarView == null) return; mNavigationBarView.reorient(); + + mNavigationBarView.getRecentsButton().setOnClickListener(mRecentsClickListener); + WindowManagerImpl.getDefault().updateViewLayout( mNavigationBarView, getNavigationBarLayoutParams()); } @@ -1230,8 +1242,20 @@ public class PhoneStatusBar extends StatusBar { } } + public void topAppWindowChanged(boolean showMenu) { + if (DEBUG) { + Slog.d(TAG, (showMenu?"showing":"hiding") + " the MENU button"); + } + if (mNavigationBarView != null) { + mNavigationBarView.getMenuButton().setVisibility(showMenu + ? View.VISIBLE : View.INVISIBLE); + } + + // See above re: lights-out policy for legacy apps. + if (showMenu) setLightsOn(true); + } + // Not supported - public void topAppWindowChanged(boolean visible) { } public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { } @Override public void setHardKeyboardStatus(boolean available, boolean enabled) { } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index fe279c8..df09f84 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -1001,14 +1001,14 @@ public class TabletStatusBar extends StatusBar implements mHandler.sendEmptyMessage(on ? MSG_SHOW_CHROME : MSG_HIDE_CHROME); } - public void topAppWindowChanged(boolean windowVisible) { + public void topAppWindowChanged(boolean showMenu) { if (DEBUG) { - Slog.d(TAG, (windowVisible?"showing":"hiding") + " the MENU button"); + Slog.d(TAG, (showMenu?"showing":"hiding") + " the MENU button"); } - mMenuButton.setVisibility(windowVisible ? View.VISIBLE : View.GONE); + mMenuButton.setVisibility(showMenu ? View.VISIBLE : View.GONE); // See above re: lights-out policy for legacy apps. - if (windowVisible) setLightsOn(true); + if (showMenu) setLightsOn(true); mCompatModeButton.refresh(); if (mCompatModeButton.getVisibility() == View.VISIBLE) { |