diff options
author | Joe Onorato <joeo@google.com> | 2010-11-16 21:36:42 -0800 |
---|---|---|
committer | Joe Onorato <joeo@google.com> | 2010-11-16 21:36:42 -0800 |
commit | cf2b199e98de71dcac042484800c07366363a734 (patch) | |
tree | acca57752152902f733a39788441efc511d64308 | |
parent | 9d305170dc71cb6c070a341172e19a89a5fa8db0 (diff) | |
download | frameworks_base-cf2b199e98de71dcac042484800c07366363a734.zip frameworks_base-cf2b199e98de71dcac042484800c07366363a734.tar.gz frameworks_base-cf2b199e98de71dcac042484800c07366363a734.tar.bz2 |
Updated layouts for new status bar
Change-Id: I30dc7c458669c4e6a35c67b7815a00ebbbae8dd3
9 files changed, 309 insertions, 114 deletions
diff --git a/packages/SystemUI/res/drawable-nodpi/bg_scrim_notification.png b/packages/SystemUI/res/drawable-nodpi/bg_scrim_notification.png Binary files differnew file mode 100644 index 0000000..6e13ebe --- /dev/null +++ b/packages/SystemUI/res/drawable-nodpi/bg_scrim_notification.png diff --git a/packages/SystemUI/res/drawable-nodpi/panel_notification.png b/packages/SystemUI/res/drawable-nodpi/panel_notification.png Binary files differnew file mode 100644 index 0000000..eca47d7 --- /dev/null +++ b/packages/SystemUI/res/drawable-nodpi/panel_notification.png diff --git a/packages/SystemUI/res/layout-xlarge/status_bar.xml b/packages/SystemUI/res/layout-xlarge/status_bar.xml index a6e5c89..8f2bea4 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar.xml @@ -65,18 +65,21 @@ <LinearLayout android:id="@+id/notificationTrigger" android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_height="wrap_content" > + <!-- paddingLeft: 24 dips = 32dp (total space to icon) - 8dp in the icon. + TODO: Make sure the font has a small enough leading that we don't need this + negative margin business. --> <com.android.systemui.statusbar.policy.Clock style="@*android:style/TextAppearance.StatusBar.Icon" android:id="@+id/clock" - android:layout_width="64dip" - android:layout_height="48dip" + android:layout_width="wrap_content" + android:layout_height="65dp" + android:layout_marginTop="-17dp" android:singleLine="true" - android:gravity="center" - android:textSize="16sp" - android:textStyle="bold" - android:padding="2dip" + android:textSize="60sp" + android:paddingLeft="24dip" + android:textColor="#2e2e2e" /> <ImageView android:id="@+id/battery" diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml index 884a473..3e085f3 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml +++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml @@ -21,118 +21,135 @@ <!-- android:background="@drawable/status_bar_closed_default_background" --> <com.android.systemui.statusbar.tablet.NotificationPanel xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:background="@*android:drawable/dialog_full_holo_dark" - android:orientation="vertical" + android:layout_height="match_parent" + android:layout_width="wrap_content" android:animateLayoutChanges="true" + android:background="@drawable/bg_scrim_notification" + android:paddingLeft="140dp" + android:paddingBottom="32dp" > - <com.android.systemui.statusbar.policy.Clock - android:id="@+id/clock" + <com.android.systemui.statusbar.tablet.NotificationTitleArea + android:id="@+id/title_area" android:layout_height="wrap_content" - android:layout_width="match_parent" - android:layout_alignParentTop="true" - android:gravity="right" - /> + android:layout_width="384dp" + android:layout_above="@+id/content_frame" + android:layout_marginLeft="16dp" + android:paddingBottom="16dp" + android:orientation="vertical" + android:animateLayoutChanges="true" + > - <com.android.systemui.statusbar.policy.DateView - android:id="@+id/date" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:layout_below="@id/clock" - android:gravity="right" - /> + <com.android.systemui.statusbar.policy.Clock + android:id="@+id/clock" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_alignParentTop="true" + android:layout_marginRight="48dp" + android:textSize="70sp" + android:gravity="right" + /> - <ImageView - android:id="@+id/settings_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_below="@id/date" - android:layout_alignParentRight="true" - android:paddingRight="10dp" - android:src="@drawable/ic_sysbar_quicksettings" - android:baseline="17dp" - /> + <com.android.systemui.statusbar.policy.DateView + android:id="@+id/date" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_below="@id/clock" + android:layout_marginRight="48dp" + android:gravity="right" + /> - <ImageView - android:id="@+id/notification_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignBaseline="@id/settings_button" - android:layout_alignParentRight="true" - android:paddingRight="10dp" - android:visibility="invisible" - android:src="@drawable/status_bar_veto" - android:baseline="17dp" - /> + <ImageView + android:id="@+id/battery" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_alignParentLeft="true" + android:layout_below="@id/date" + android:layout_marginTop="16dp" + android:layout_marginLeft="48dp" + android:src="@drawable/ic_sysbar_battery_mini" + android:baseline="17dp" + /> - <ImageView - android:id="@+id/battery" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:layout_alignParentLeft="true" - android:layout_alignBaseline="@id/settings_button" - android:src="@drawable/ic_sysbar_battery_mini" - android:baseline="17dp" - /> + <TextView + android:id="@+id/battery_text" + android:layout_width="48dp" + android:layout_height="wrap_content" + android:layout_toRightOf="@id/battery" + android:layout_alignBaseline="@id/battery" + android:singleLine="true" + android:text="@string/system_panel_settings_button" + /> - <TextView - android:id="@+id/battery_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_toRightOf="@id/battery" - android:layout_alignBaseline="@id/settings_button" - android:singleLine="true" - android:text="@string/system_panel_settings_button" - /> + <ImageView + android:id="@+id/network" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_toRightOf="@id/battery_text" + android:layout_alignBaseline="@id/battery" + android:src="@drawable/ic_sysbar_wifi_mini" + android:baseline="21dp" + /> - <ImageView - android:id="@+id/network" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:layout_toRightOf="@id/battery_text" - android:layout_alignBaseline="@id/settings_button" - android:src="@drawable/ic_sysbar_wifi_mini" - android:baseline="21dp" - /> + <TextView + android:id="@+id/network_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toRightOf="@id/network" + android:layout_alignBaseline="@id/battery" + android:singleLine="true" + android:text="@string/system_panel_settings_button" + /> - <TextView - android:id="@+id/network_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_toRightOf="@id/network" - android:layout_alignBaseline="@id/settings_button" - android:singleLine="true" - android:text="@string/system_panel_settings_button" - /> + <ImageView + android:id="@+id/settings_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_alignBaseline="@id/battery" + android:paddingRight="16dp" + android:src="@drawable/ic_sysbar_quicksettings" + android:baseline="17dp" + /> - <FrameLayout - android:id="@+id/settings_frame" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:layout_below="@id/settings_button" - /> + <ImageView + android:id="@+id/notification_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_alignBaseline="@id/battery" + android:paddingRight="16dp" + android:visibility="invisible" + android:src="@drawable/status_bar_veto" + android:baseline="17dp" + /> + </com.android.systemui.statusbar.tablet.NotificationTitleArea> - <ScrollView - android:id="@+id/notificationScroller" + <FrameLayout + android:id="@+id/content_frame" android:layout_height="wrap_content" - android:layout_width="match_parent" - android:layout_below="@id/settings_button" + android:layout_width="400dp" + android:layout_alignParentBottom="true" > - <LinearLayout - android:id="@+id/content" - android:layout_width="match_parent" + <ScrollView + android:id="@+id/notificationScroller" android:layout_height="wrap_content" - android:gravity="center_horizontal|bottom" - android:animateLayoutChanges="true" - android:animationCache="false" - android:orientation="vertical" - android:background="@drawable/status_bar_background" - android:clickable="true" - android:focusable="true" - android:descendantFocusability="afterDescendants" + android:layout_width="match_parent" > - </LinearLayout> - </ScrollView> + <LinearLayout + android:id="@+id/content" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal|bottom" + android:animateLayoutChanges="true" + android:animationCache="false" + android:orientation="vertical" + android:background="@drawable/status_bar_background" + android:clickable="true" + android:focusable="true" + android:descendantFocusability="afterDescendants" + > + </LinearLayout> + </ScrollView> + </FrameLayout> </com.android.systemui.statusbar.tablet.NotificationPanel> diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_settings.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_settings.xml index c6ddfed..a800afb 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_settings.xml +++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_settings.xml @@ -19,6 +19,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="200dip" + android:background="#ff000000" > </com.android.systemui.statusbar.tablet.SettingsPanel> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java index ce81fdc..80cb5b2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java @@ -22,6 +22,7 @@ import android.util.Slog; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; +import android.view.LayoutInflater; import android.view.View; import android.widget.FrameLayout; @@ -31,10 +32,11 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, View.OnClickListener { static final String TAG = "NotificationPanel"; + View mTitleArea; View mSettingsButton; View mNotificationButton; View mNotificationScroller; - FrameLayout mSettingsFrame; + FrameLayout mContentFrame; View mSettingsPanel; public NotificationPanel(Context context, AttributeSet attrs) { @@ -49,13 +51,15 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, public void onFinishInflate() { super.onFinishInflate(); + mTitleArea = findViewById(R.id.title_area); + mSettingsButton = (ImageView)findViewById(R.id.settings_button); mSettingsButton.setOnClickListener(this); mNotificationButton = (ImageView)findViewById(R.id.notification_button); mNotificationButton.setOnClickListener(this); mNotificationScroller = findViewById(R.id.notificationScroller); - mSettingsFrame = (FrameLayout)findViewById(R.id.settings_frame); + mContentFrame = (FrameLayout)findViewById(R.id.content_frame); } @Override @@ -91,22 +95,24 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, } public boolean isInContentArea(int x, int y) { - final int l = getPaddingLeft(); - final int r = getWidth() - getPaddingRight(); - final int t = getPaddingTop(); - final int b = getHeight() - getPaddingBottom(); + final int l = mContentFrame.getLeft(); + final int r = mContentFrame.getRight(); + final int t = mTitleArea.getTop(); + final int b = mContentFrame.getBottom(); return x >= l && x < r && y >= t && y < b; } void removeSettingsPanel() { if (mSettingsPanel != null) { - mSettingsFrame.removeViewAt(0); + mContentFrame.removeView(mSettingsPanel); mSettingsPanel = null; } } void addSettingsPanel() { - mSettingsPanel = View.inflate(getContext(), R.layout.sysbar_panel_settings, mSettingsFrame); + LayoutInflater infl = LayoutInflater.from(getContext()); + mSettingsPanel = infl.inflate(R.layout.sysbar_panel_settings, mContentFrame, false); + mContentFrame.addView(mSettingsPanel); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationTitleArea.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationTitleArea.java new file mode 100644 index 0000000..d4413db --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationTitleArea.java @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.tablet; + +import android.content.Context; +import android.graphics.BitmapFactory; +import android.graphics.Bitmap; +import android.graphics.Paint; +import android.graphics.Canvas; +import android.util.AttributeSet; +import android.util.Slog; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; +import android.view.View; +import android.widget.FrameLayout; + +import com.android.systemui.R; + +public class NotificationTitleArea extends RelativeLayout { + static final String TAG = "NotificationTitleArea"; + + View mSettingsButton; + View mNotificationButton; + View mNotificationScroller; + FrameLayout mSettingsFrame; + View mSettingsPanel; + + // for drawing the background + Bitmap mTexture; + Paint mPaint; + int mTextureWidth; + int mTextureHeight; + + + public NotificationTitleArea(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public NotificationTitleArea(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + // for drawing the background + mTexture = BitmapFactory.decodeResource(getResources(), R.drawable.panel_notification); + mTextureWidth = mTexture.getWidth(); + mTextureHeight = mTexture.getHeight(); + + mPaint = new Paint(); + mPaint.setDither(false); + } + + public void onFinishInflate() { + super.onFinishInflate(); + setWillNotDraw(false); + } + + @Override + public void onDraw(Canvas canvas) { + final Bitmap texture = mTexture; + final Paint paint = mPaint; + + final int width = getWidth(); + final int height = getHeight(); + + final int textureWidth = mTextureWidth; + final int textureHeight = mTextureHeight; + + int x = 0; + int y; + + while (x < width) { + y = 0; + while (y < height) { + canvas.drawBitmap(texture, x, y, paint); + y += textureHeight; + } + x += textureWidth; + } + } +} + diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/PanelBackgroundView.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/PanelBackgroundView.java new file mode 100644 index 0000000..5eafdc1 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/PanelBackgroundView.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.phone; + +import android.content.Context; +import android.content.res.TypedArray; +import android.util.AttributeSet; +import android.util.Slog; +import android.view.View; +import android.graphics.BitmapFactory; +import android.graphics.Bitmap; +import android.graphics.Paint; +import android.graphics.Canvas; + +public class PanelBackgroundView extends View { + private Bitmap mTexture; + private Paint mPaint; + private int mTextureWidth; + private int mTextureHeight; + + public PanelBackgroundView(Context context, AttributeSet attrs) { + super(context, attrs); + /* + mTexture = BitmapFactory.decodeResource(getResources(), + com.android.internal.R.drawable.status_bar_background); + mTextureWidth = mTexture.getWidth(); + mTextureHeight = mTexture.getHeight(); + + mPaint = new Paint(); + mPaint.setDither(false); + */ + } + + @Override + public void onDraw(Canvas canvas) { + /* + final Bitmap texture = mTexture; + final Paint paint = mPaint; + + final int width = getWidth(); + final int height = getHeight(); + + final int textureWidth = mTextureWidth; + final int textureHeight = mTextureHeight; + + int x = 0; + int y; + + while (x < width) { + y = 0; + while (y < height) { + canvas.drawBitmap(texture, x, y, paint); + y += textureHeight; + } + x += textureWidth; + } + */ + } +} 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 983215e..0531f9d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -153,8 +153,8 @@ public class TabletStatusBar extends StatusBar { mStatusBarView.setIgnoreChildren(0, mNotificationTrigger, mNotificationPanel); WindowManager.LayoutParams lp = new WindowManager.LayoutParams( - 512, // ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM @@ -434,7 +434,7 @@ public class TabletStatusBar extends StatusBar { Slog.d(TAG, "Top activity is " + (immersive?"immersive":"not immersive")); } catch (RemoteException ex) { } - if (immersive) { + if (false && immersive) { // TODO: immersive mode popups for tablet } else if (notification.notification.fullScreenIntent != null) { // not immersive & a full-screen alert should be shown |