diff options
author | Joe Onorato <joeo@google.com> | 2010-11-21 15:34:48 -0800 |
---|---|---|
committer | Joe Onorato <joeo@google.com> | 2010-11-21 16:16:29 -0800 |
commit | 52f80cd36f406725e85a1825741a45c69de3d898 (patch) | |
tree | 8d4e9132fbd8ef9cb25fb2e5c71d33b43fdf9771 /packages/SystemUI | |
parent | 4cddc98a4b63961e3528c5a70cd5c55a67a0c60a (diff) | |
download | frameworks_base-52f80cd36f406725e85a1825741a45c69de3d898.zip frameworks_base-52f80cd36f406725e85a1825741a45c69de3d898.tar.gz frameworks_base-52f80cd36f406725e85a1825741a45c69de3d898.tar.bz2 |
The icon sticks out of the ticker.
The ticker still needs to show up over the status bar, which will take a bit of
window manager work, so it's just out of position for now.
Change-Id: Ib5781925db63a22d9352a7b5017a36eec3229395
Diffstat (limited to 'packages/SystemUI')
9 files changed, 107 insertions, 36 deletions
diff --git a/packages/SystemUI/res/drawable/status_bar_ticker_background.xml b/packages/SystemUI/res/drawable/status_bar_ticker_background.xml new file mode 100644 index 0000000..c230358 --- /dev/null +++ b/packages/SystemUI/res/drawable/status_bar_ticker_background.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<layer-list + xmlns:android="http://schemas.android.com/apk/res/android" + android:opacity="translucent" + > + <item + android:drawable="@drawable/ticker_background_color" + android:top="12dp" + /> +</layer-list> + + diff --git a/packages/SystemUI/res/layout-xlarge/status_bar.xml b/packages/SystemUI/res/layout-xlarge/status_bar.xml index e9661a6..3292a92 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar.xml @@ -238,17 +238,5 @@ android:visibility="gone" /> </RelativeLayout> - - <!-- ticker: transient incoming notification information --> - <FrameLayout - android:id="@+id/ticker" - android:layout_width="392dp" - android:layout_height="match_parent" - android:layout_alignParentRight="true" - android:layout_toRightOf="@+id/systemInfo" - android:paddingLeft="6dip" - android:gravity="center_vertical" - /> - </RelativeLayout> </com.android.systemui.statusbar.tablet.TabletStatusBarView> diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_latest_event.xml b/packages/SystemUI/res/layout-xlarge/status_bar_latest_event.xml index 3633227..6b12d29 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar_latest_event.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_latest_event.xml @@ -18,8 +18,8 @@ <ImageView android:id="@+id/large_icon" - android:layout_width="60dp" - android:layout_height="60dp" + android:layout_width="@dimen/notification_large_icon_width" + android:layout_height="@dimen/notification_large_icon_height" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:scaleType="center" diff --git a/packages/SystemUI/res/layout-xlarge/ticker.xml b/packages/SystemUI/res/layout-xlarge/ticker.xml index 10acb13..cae6a77 100644 --- a/packages/SystemUI/res/layout-xlarge/ticker.xml +++ b/packages/SystemUI/res/layout-xlarge/ticker.xml @@ -20,8 +20,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:background="#ff1d1d1d" - android:paddingRight="48dp" + android:background="@drawable/status_bar_ticker_background" + android:gravity="bottom" > <!-- android:background="@drawable/ticker_background" @@ -29,8 +29,8 @@ <ImageView android:id="@+id/large_icon" - android:layout_width="60dp" - android:layout_height="60dp" + android:layout_width="@dimen/notification_large_icon_height" + android:layout_height="@dimen/notification_large_icon_width" android:scaleType="center" android:visibility="gone" /> diff --git a/packages/SystemUI/res/layout-xlarge/ticker_compat.xml b/packages/SystemUI/res/layout-xlarge/ticker_compat.xml index 90d4133..5d9a680 100644 --- a/packages/SystemUI/res/layout-xlarge/ticker_compat.xml +++ b/packages/SystemUI/res/layout-xlarge/ticker_compat.xml @@ -18,15 +18,15 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_height="@*android:dimen/status_bar_height" android:orientation="horizontal" - android:background="#ff1d1d1d" + android:background="@drawable/status_bar_ticker_background" > <ImageView android:id="@+id/large_icon" - android:layout_width="60dp" - android:layout_height="60dp" + android:layout_width="@dimen/notification_large_icon_width" + android:layout_height="@dimen/notification_large_icon_height" android:scaleType="center" android:visibility="gone" /> diff --git a/packages/SystemUI/res/values-xlarge/dimens.xml b/packages/SystemUI/res/values-xlarge/dimens.xml new file mode 100644 index 0000000..009b7a8 --- /dev/null +++ b/packages/SystemUI/res/values-xlarge/dimens.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * 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. +*/ +--> +<resources> + <!-- The width of the big icons in notifications. --> + <dimen name="notification_large_icon_width">60dp</dimen> + <!-- The width of the big icons in notifications. --> + <dimen name="notification_large_icon_height">60dp</dimen> + <!-- The width of the ticker, including the icon --> + <dimen name="notification_ticker_width">360dp</dimen> +</resources> + + diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index fd2cf99..964e69b 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -19,4 +19,5 @@ <resources> <drawable name="notification_number_text_color">#ffffffff</drawable> <drawable name="notification_item_background_color">#ff000000</drawable> + <drawable name="ticker_background_color">#ff1d1d1d</drawable> </resources> 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 266dade..ab509ef 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -132,8 +132,6 @@ public class TabletStatusBar extends StatusBar { NotificationIconArea.IconLayout mIconLayout; TabletTicker mTicker; - View mTickerView; - boolean mTicking; // for disabling the status bar int mDisabled = 0; @@ -278,7 +276,7 @@ public class TabletStatusBar extends StatusBar { mNotificationPeekTapDuration = vc.getTapTimeout(); mNotificationFlingVelocity = 300; // px/s - mTicker = new TabletTicker(context, (FrameLayout)sb.findViewById(R.id.ticker)); + mTicker = new TabletTicker(context); // The icons mBatteryController = new BatteryController(mContext); @@ -385,9 +383,7 @@ public class TabletStatusBar extends StatusBar { if (DEBUG) Slog.d(TAG, "opening notifications panel"); if (mNotificationPanel.getVisibility() == View.GONE) { mNotificationPeekWindow.setVisibility(View.GONE); - mNotificationPanel.setVisibility(View.VISIBLE); - // synchronize with current shadow state mShadowController.hideElement(mNotificationArea); } @@ -396,7 +392,6 @@ public class TabletStatusBar extends StatusBar { if (DEBUG) Slog.d(TAG, "closing notifications panel"); if (mNotificationPanel.getVisibility() == View.VISIBLE) { mNotificationPanel.setVisibility(View.GONE); - // synchronize with current shadow state mShadowController.showElement(mNotificationArea); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java index cf4db41..d85fc5a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletTicker.java @@ -20,7 +20,9 @@ import java.util.Arrays; import android.app.Notification; import android.content.Context; +import android.content.res.Resources; import android.graphics.Bitmap; +import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Message; @@ -29,6 +31,8 @@ import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.WindowManager; +import android.view.WindowManagerImpl; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; @@ -45,20 +49,19 @@ public class TabletTicker extends Handler { private static final int MSG_ADVANCE = 1; - private static final int ADVANCE_DELAY = 5000; // 5 seconds + private static final int ADVANCE_DELAY = 10000; // 5 seconds private Context mContext; - private FrameLayout mParent; + private ViewGroup mWindow; private StatusBarNotification mCurrentNotification; private View mCurrentView; private StatusBarNotification[] mQueue; private int mQueuePos; - public TabletTicker(Context context, FrameLayout parent) { + public TabletTicker(Context context) { mContext = context; - mParent = parent; // TODO: Make this a configuration value. // 3 is enough to let us see most cases, but not get so far behind that it's annoying. @@ -105,7 +108,7 @@ public class TabletTicker extends Handler { private void advance() { // Out with the old... if (mCurrentView != null) { - mParent.removeView(mCurrentView); + mWindow.removeView(mCurrentView); mCurrentView = null; mCurrentNotification = null; } @@ -116,12 +119,23 @@ public class TabletTicker extends Handler { mCurrentNotification = next; mCurrentView = makeTickerView(next); if (mCurrentView != null) { - mParent.addView(mCurrentView); + if (mWindow == null) { + mWindow = makeWindow(); + WindowManagerImpl.getDefault().addView(mWindow, mWindow.getLayoutParams()); + } + mWindow.addView(mCurrentView); sendEmptyMessageDelayed(MSG_ADVANCE, ADVANCE_DELAY); break; } next = dequeue(); } + + // if there's nothing left, close the window + // TODO: Do this when the animation is done instead + if (mCurrentView == null) { + WindowManagerImpl.getDefault().removeView(mWindow); + mWindow = null; + } } private StatusBarNotification dequeue() { @@ -140,6 +154,23 @@ public class TabletTicker extends Handler { return notification; } + private ViewGroup makeWindow() { + final Resources res = mContext.getResources(); + final FrameLayout view = new FrameLayout(mContext); + final int width = res.getDimensionPixelSize(R.dimen.notification_ticker_width); + final int height = res.getDimensionPixelSize(R.dimen.notification_large_icon_height); + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, height, + WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, + WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN + | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM + | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, + PixelFormat.TRANSLUCENT); + lp.gravity = Gravity.BOTTOM | Gravity.RIGHT; + lp.setTitle("NotificationTicker"); + view.setLayoutParams(lp); + return view; + } + private View makeTickerView(StatusBarNotification notification) { final Notification n = notification.notification; @@ -170,12 +201,14 @@ public class TabletTicker extends Handler { Slog.e(TAG, "couldn't inflate view for notification " + ident, exception); return null; } + final int statusBarHeight = mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.status_bar_height); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1.0f); + ViewGroup.LayoutParams.WRAP_CONTENT, statusBarHeight, 1.0f); lp.gravity = Gravity.BOTTOM; group.addView(expanded, lp); } else if (n.tickerText != null) { - group = (ViewGroup)inflater.inflate(R.layout.ticker_compat, mParent, false); + group = (ViewGroup)inflater.inflate(R.layout.ticker_compat, mWindow, false); final Drawable icon = StatusBarIconView.getIcon(mContext, new StatusBarIcon(notification.pkg, n.icon, n.iconLevel, 0)); ImageView iv = (ImageView)group.findViewById(iconId); |