diff options
author | Joe Onorato <joeo@google.com> | 2010-11-21 11:48:15 -0800 |
---|---|---|
committer | Joe Onorato <joeo@google.com> | 2010-11-21 16:16:29 -0800 |
commit | 4cddc98a4b63961e3528c5a70cd5c55a67a0c60a (patch) | |
tree | af8aaa2506d218d277cc21c3b95f95c0be6213c9 | |
parent | 561d3858bb9409b999a19f7ba93f0b12e1db835f (diff) | |
download | frameworks_base-4cddc98a4b63961e3528c5a70cd5c55a67a0c60a.zip frameworks_base-4cddc98a4b63961e3528c5a70cd5c55a67a0c60a.tar.gz frameworks_base-4cddc98a4b63961e3528c5a70cd5c55a67a0c60a.tar.bz2 |
Deal with more notifications than fit on screen.
Change-Id: I432b9ee73a473fe4af8b0caeede4993c67be6518
3 files changed, 47 insertions, 29 deletions
diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml index b23cc7b..f9e2d5e 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml +++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml @@ -1,43 +1,40 @@ -<?xml version="1.0" encoding="utf-8"?> <!-- -/* apps/common/assets/default/default/skins/StatusBar.xml -** -** Copyright 2006, 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. -*/ + Copyright (C) 2006 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. --> <!-- 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="match_parent" - android:layout_width="540dp" + android:layout_width="match_parent" android:animateLayoutChanges="true" android:background="@drawable/bg_scrim_notification" + android:paddingTop="32dp" android:paddingBottom="32dp" + android:orientation="vertical" + android:gravity="right" > <com.android.systemui.statusbar.tablet.NotificationTitleArea android:id="@+id/title_area" - android:layout_height="wrap_content" + android:layout_height="160dp" android:layout_width="384dp" - android:layout_above="@+id/content_frame" android:layout_marginLeft="24dp" - android:paddingBottom="16dp" + android:paddingTop="20dp" android:orientation="vertical" android:animateLayoutChanges="true" - android:layout_alignParentRight="true" > <com.android.systemui.statusbar.tablet.HoloClock @@ -143,8 +140,6 @@ android:id="@+id/content_frame" android:layout_height="wrap_content" android:layout_width="408dp" - android:layout_alignParentBottom="true" - android:layout_alignParentRight="true" > <ScrollView android:id="@+id/notificationScroller" 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 80cb5b2..5f49d8c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java @@ -19,16 +19,16 @@ package com.android.systemui.statusbar.tablet; import android.content.Context; import android.util.AttributeSet; 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; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; import com.android.systemui.R; -public class NotificationPanel extends RelativeLayout implements StatusBarPanel, +public class NotificationPanel extends LinearLayout implements StatusBarPanel, View.OnClickListener { static final String TAG = "NotificationPanel"; @@ -71,6 +71,29 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel, } } + /** + * We need to be aligned at the bottom. LinearLayout can't do this, so instead, + * let LinearLayout do all the hard work, and then shift everything down to the bottom. + */ + @Override + protected void onLayout(boolean changed, int l, int t, int r, int b) { + super.onLayout(changed, l, t, r, b); + // We know that none of our children are GONE, so don't worry about skipping GONE views. + final int N = getChildCount(); + if (N == 0) { + return; + } + final int allocatedBottom = getChildAt(N-1).getBottom(); + final int shift = b - allocatedBottom - getPaddingBottom(); + if (shift <= 0) { + return; + } + for (int i=0; i<N; i++) { + final View c = getChildAt(i); + c.layout(c.getLeft(), c.getTop() + shift, c.getRight(), c.getBottom() + shift); + } + } + public void onClick(View v) { if (v == mSettingsButton) { switchToSettingsMode(); 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 7cc546a..266dade 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -167,7 +167,7 @@ public class TabletStatusBar extends StatusBar { mStatusBarView.setIgnoreChildren(0, mNotificationTrigger, mNotificationPanel); WindowManager.LayoutParams lp = new WindowManager.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |