Pour one out for the old notification ticker.
Heads-up notifications are what it always wanted to be, anyway. Bug: 14588447 Change-Id: I64aa1ed85fb162d8577468019e68df9de183a992
This commit is contained in:
@@ -111,47 +111,13 @@
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/ticker"
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/ticker_stub"
|
||||
android:inflatedId="@+id/ticker"
|
||||
android:layout="@layout/status_bar_ticker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="6dip"
|
||||
android:animationCache="false"
|
||||
android:orientation="horizontal" >
|
||||
<ImageSwitcher android:id="@+id/tickerIcon"
|
||||
android:layout_width="@dimen/status_bar_icon_size"
|
||||
android:layout_height="@dimen/status_bar_icon_size"
|
||||
android:layout_marginEnd="4dip"
|
||||
>
|
||||
<com.android.systemui.statusbar.AnimatedImageView
|
||||
android:layout_width="@dimen/status_bar_icon_size"
|
||||
android:layout_height="@dimen/status_bar_icon_size"
|
||||
android:scaleType="center"
|
||||
/>
|
||||
<com.android.systemui.statusbar.AnimatedImageView
|
||||
android:layout_width="@dimen/status_bar_icon_size"
|
||||
android:layout_height="@dimen/status_bar_icon_size"
|
||||
android:scaleType="center"
|
||||
/>
|
||||
</ImageSwitcher>
|
||||
<com.android.systemui.statusbar.phone.TickerView android:id="@+id/tickerText"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="2dip"
|
||||
android:paddingEnd="10dip">
|
||||
<TextView
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
<TextView
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
</com.android.systemui.statusbar.phone.TickerView>
|
||||
</LinearLayout>
|
||||
/>
|
||||
|
||||
</com.android.systemui.statusbar.phone.PhoneStatusBarView>
|
||||
|
||||
62
packages/SystemUI/res/layout/status_bar_ticker.xml
Normal file
62
packages/SystemUI/res/layout/status_bar_ticker.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
$<?xml version="1.0" encoding="utf-8"?>
|
||||
$<!--
|
||||
$- Copyright 2014, 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.
|
||||
$-->
|
||||
<LinearLayout android:id="@+id/ticker"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="6dip"
|
||||
android:animationCache="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageSwitcher android:id="@+id/tickerIcon"
|
||||
android:layout_width="@dimen/status_bar_icon_size"
|
||||
android:layout_height="@dimen/status_bar_icon_size"
|
||||
android:layout_marginEnd="4dip"
|
||||
>
|
||||
<com.android.systemui.statusbar.AnimatedImageView
|
||||
android:layout_width="@dimen/status_bar_icon_size"
|
||||
android:layout_height="@dimen/status_bar_icon_size"
|
||||
android:scaleType="center"
|
||||
/>
|
||||
<com.android.systemui.statusbar.AnimatedImageView
|
||||
android:layout_width="@dimen/status_bar_icon_size"
|
||||
android:layout_height="@dimen/status_bar_icon_size"
|
||||
android:scaleType="center"
|
||||
/>
|
||||
</ImageSwitcher>
|
||||
<com.android.systemui.statusbar.phone.TickerView android:id="@+id/tickerText"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="2dip"
|
||||
android:paddingEnd="10dip">
|
||||
<TextView
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
<TextView
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.PhoneTicker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
</com.android.systemui.statusbar.phone.TickerView>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -141,5 +141,10 @@
|
||||
|
||||
<!-- Wait on the touch feedback this long before performing an action. -->
|
||||
<integer name="feedback_start_delay">300</integer>
|
||||
|
||||
<!-- Set to true to enable the classic notification ticker that scrolls
|
||||
Notification.tickerText across the status bar for what seems like an
|
||||
eternity. -->
|
||||
<bool name="enable_ticker">false</bool>
|
||||
</resources>
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ import android.view.ViewAnimationUtils;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.ViewPropertyAnimator;
|
||||
import android.view.ViewStub;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
@@ -289,6 +290,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
int mTrackingPosition; // the position of the top of the tracking view.
|
||||
|
||||
// ticker
|
||||
private boolean mTickerEnabled;
|
||||
private Ticker mTicker;
|
||||
private View mTickerView;
|
||||
private boolean mTicking;
|
||||
@@ -644,7 +646,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
mMoreIcon = mStatusBarView.findViewById(R.id.moreIcon);
|
||||
mNotificationIcons.setOverflowIndicator(mMoreIcon);
|
||||
mStatusBarContents = (LinearLayout)mStatusBarView.findViewById(R.id.status_bar_contents);
|
||||
mTickerView = mStatusBarView.findViewById(R.id.ticker);
|
||||
|
||||
mStackScroller = (NotificationStackScrollLayout) mStatusBarWindow.findViewById(
|
||||
R.id.notification_stack_scroller);
|
||||
@@ -684,10 +685,17 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
mDateTimeView.setEnabled(true);
|
||||
}
|
||||
|
||||
mTicker = new MyTicker(context, mStatusBarView);
|
||||
mTickerEnabled = res.getBoolean(R.bool.enable_ticker);
|
||||
if (mTickerEnabled) {
|
||||
final ViewStub tickerStub = (ViewStub) mStatusBarView.findViewById(R.id.ticker_stub);
|
||||
if (tickerStub != null) {
|
||||
mTickerView = tickerStub.inflate();
|
||||
mTicker = new MyTicker(context, mStatusBarView);
|
||||
|
||||
TickerView tickerView = (TickerView)mStatusBarView.findViewById(R.id.tickerText);
|
||||
tickerView.mTicker = mTicker;
|
||||
TickerView tickerView = (TickerView) mStatusBarView.findViewById(R.id.tickerText);
|
||||
tickerView.mTicker = mTicker;
|
||||
}
|
||||
}
|
||||
|
||||
mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore);
|
||||
|
||||
@@ -1145,7 +1153,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
|
||||
if (old != null) {
|
||||
// Cancel the ticker if it's still running
|
||||
mTicker.removeEntry(old);
|
||||
if (mTickerEnabled) {
|
||||
mTicker.removeEntry(old);
|
||||
}
|
||||
|
||||
// Recalculate the position of the sliding windows and the titles.
|
||||
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
|
||||
@@ -2118,6 +2128,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
|
||||
@Override
|
||||
protected void tick(StatusBarNotification n, boolean firstTime) {
|
||||
if (!mTickerEnabled) return;
|
||||
|
||||
// no ticking in lights-out mode
|
||||
if (!areLightsOn()) return;
|
||||
|
||||
@@ -2134,7 +2146,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
if (n.getNotification().tickerText != null && mStatusBarWindow != null
|
||||
&& mStatusBarWindow.getWindowToken() != null) {
|
||||
if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
|
||||
| StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
|
||||
| StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
|
||||
mTicker.addEntry(n);
|
||||
}
|
||||
}
|
||||
@@ -2143,10 +2155,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
private class MyTicker extends Ticker {
|
||||
MyTicker(Context context, View sb) {
|
||||
super(context, sb);
|
||||
if (!mTickerEnabled) {
|
||||
Log.w(TAG, "MyTicker instantiated with mTickerEnabled=false", new Throwable());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickerStarting() {
|
||||
if (!mTickerEnabled) return;
|
||||
mTicking = true;
|
||||
mStatusBarContents.setVisibility(View.GONE);
|
||||
mTickerView.setVisibility(View.VISIBLE);
|
||||
@@ -2156,6 +2172,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
|
||||
@Override
|
||||
public void tickerDone() {
|
||||
if (!mTickerEnabled) return;
|
||||
mStatusBarContents.setVisibility(View.VISIBLE);
|
||||
mTickerView.setVisibility(View.GONE);
|
||||
mStatusBarContents.startAnimation(loadAnim(com.android.internal.R.anim.push_down_in, null));
|
||||
@@ -2164,6 +2181,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
|
||||
public void tickerHalting() {
|
||||
if (!mTickerEnabled) return;
|
||||
if (mStatusBarContents.getVisibility() != View.VISIBLE) {
|
||||
mStatusBarContents.setVisibility(View.VISIBLE);
|
||||
mStatusBarContents
|
||||
@@ -2202,11 +2220,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
pw.println("Current Status Bar state:");
|
||||
pw.println(" mExpandedVisible=" + mExpandedVisible
|
||||
+ ", mTrackingPosition=" + mTrackingPosition);
|
||||
pw.println(" mTicking=" + mTicking);
|
||||
pw.println(" mTickerEnabled=" + mTickerEnabled);
|
||||
if (mTickerEnabled) {
|
||||
pw.println(" mTicking=" + mTicking);
|
||||
pw.println(" mTickerView: " + viewInfo(mTickerView));
|
||||
}
|
||||
pw.println(" mTracking=" + mTracking);
|
||||
pw.println(" mDisplayMetrics=" + mDisplayMetrics);
|
||||
pw.println(" mStackScroller: " + viewInfo(mStackScroller));
|
||||
pw.println(" mTickerView: " + viewInfo(mTickerView));
|
||||
pw.println(" mStackScroller: " + viewInfo(mStackScroller)
|
||||
+ " scroll " + mStackScroller.getScrollX()
|
||||
+ "," + mStackScroller.getScrollY());
|
||||
@@ -2676,7 +2697,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
|
||||
@Override
|
||||
protected void haltTicker() {
|
||||
mTicker.halt();
|
||||
if (mTickerEnabled) {
|
||||
mTicker.halt();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,7 +32,7 @@ public class TickerView extends TextSwitcher
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
mTicker.reflowText();
|
||||
if (mTicker != null) mTicker.reflowText();
|
||||
}
|
||||
|
||||
public void setTicker(Ticker t) {
|
||||
|
||||
Reference in New Issue
Block a user