From cf2b199e98de71dcac042484800c07366363a734 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Tue, 16 Nov 2010 21:36:42 -0800 Subject: Updated layouts for new status bar Change-Id: I30dc7c458669c4e6a35c67b7815a00ebbbae8dd3 --- .../res/drawable-nodpi/bg_scrim_notification.png | Bin 0 -> 60874 bytes .../res/drawable-nodpi/panel_notification.png | Bin 0 -> 226 bytes packages/SystemUI/res/layout-xlarge/status_bar.xml | 17 +- .../layout-xlarge/sysbar_panel_notifications.xml | 211 +++++++++++---------- .../res/layout-xlarge/sysbar_panel_settings.xml | 1 + .../statusbar/tablet/NotificationPanel.java | 22 ++- .../statusbar/tablet/NotificationTitleArea.java | 95 ++++++++++ .../statusbar/tablet/PanelBackgroundView.java | 73 +++++++ .../systemui/statusbar/tablet/TabletStatusBar.java | 4 +- 9 files changed, 309 insertions(+), 114 deletions(-) create mode 100644 packages/SystemUI/res/drawable-nodpi/bg_scrim_notification.png create mode 100644 packages/SystemUI/res/drawable-nodpi/panel_notification.png create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationTitleArea.java create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/tablet/PanelBackgroundView.java (limited to 'packages') diff --git a/packages/SystemUI/res/drawable-nodpi/bg_scrim_notification.png b/packages/SystemUI/res/drawable-nodpi/bg_scrim_notification.png new file mode 100644 index 0000000..6e13ebe Binary files /dev/null and b/packages/SystemUI/res/drawable-nodpi/bg_scrim_notification.png differ diff --git a/packages/SystemUI/res/drawable-nodpi/panel_notification.png b/packages/SystemUI/res/drawable-nodpi/panel_notification.png new file mode 100644 index 0000000..eca47d7 Binary files /dev/null and b/packages/SystemUI/res/drawable-nodpi/panel_notification.png differ 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 @@ + - + android:layout_width="384dp" + android:layout_above="@+id/content_frame" + android:layout_marginLeft="16dp" + android:paddingBottom="16dp" + android:orientation="vertical" + android:animateLayoutChanges="true" + > - + - + - + - + - + - + - + - + + - - - - + + + + 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" > 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 -- cgit v1.1