Tablet ticker.

Change-Id: Ia3db5cc29eac1703123de3e1c6dc7c22e7d024eb
This commit is contained in:
Joe Onorato
2010-09-17 18:38:38 -04:00
parent 4200dcaa7b
commit ef1e7763c2
9 changed files with 562 additions and 104 deletions

View File

@@ -21,6 +21,7 @@ import java.util.Date;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Parcel;
@@ -124,10 +125,46 @@ public class Notification implements Parcelable
/**
* Text to scroll across the screen when this item is added to
* the status bar.
* the status bar on large and smaller devices.
*
* <p>This field is provided separately from the other ticker fields
* both for compatibility and to allow an application to choose different
* text for when the text scrolls in and when it is displayed all at once
* in conjunction with one or more icons.
*
* @see #tickerTitle
* @see #tickerSubtitle
* @see #tickerIcons
*/
public CharSequence tickerText;
/**
* The title line for the ticker over a the fat status bar on xlarge devices.
*
* @see #tickerText
* @see #tickerSubtitle
* @see #tickerIcons
*/
public CharSequence tickerTitle;
/**
* The subtitle line for the ticker over a the fat status bar on xlarge devices.
*
* @see #tickerText
* @see #tickerTitle
* @see #tickerIcons
*/
public CharSequence tickerSubtitle;
/**
* The icons to show to the left of the other ticker fields.
*
* @see #tickerText
* @see #tickerTitle
* @see #tickerSubtitle
*/
public Bitmap[] tickerIcons;
/**
* The view that will represent this notification in the expanded status bar.
*/
@@ -346,6 +383,21 @@ public class Notification implements Parcelable
if (parcel.readInt() != 0) {
tickerText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
}
if (parcel.readInt() != 0) {
tickerTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
}
if (parcel.readInt() != 0) {
tickerSubtitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
}
final int tickerIconCount = parcel.readInt();
if (tickerIconCount >= 0) {
tickerIcons = new Bitmap[tickerIconCount];
for (int i=0; i<tickerIconCount; i++) {
if (parcel.readInt() != 0) {
tickerIcons[i] = Bitmap.CREATOR.createFromParcel(parcel);
}
}
}
if (parcel.readInt() != 0) {
contentView = RemoteViews.CREATOR.createFromParcel(parcel);
}
@@ -382,6 +434,19 @@ public class Notification implements Parcelable
if (this.tickerText != null) {
that.tickerText = this.tickerText.toString();
}
if (this.tickerTitle != null) {
that.tickerTitle = this.tickerTitle.toString();
}
if (this.tickerSubtitle != null) {
that.tickerSubtitle = this.tickerSubtitle.toString();
}
if (this.tickerIcons != null) {
final int N = this.tickerIcons.length;
that.tickerIcons = new Bitmap[N];
for (int i=0; i<N; i++) {
that.tickerIcons[i] = Bitmap.createBitmap(this.tickerIcons[i]);
}
}
if (this.contentView != null) {
that.contentView = this.contentView.clone();
}
@@ -438,6 +503,32 @@ public class Notification implements Parcelable
} else {
parcel.writeInt(0);
}
if (tickerTitle != null) {
parcel.writeInt(1);
TextUtils.writeToParcel(tickerTitle, parcel, flags);
} else {
parcel.writeInt(0);
}
if (tickerSubtitle != null) {
parcel.writeInt(1);
TextUtils.writeToParcel(tickerSubtitle, parcel, flags);
} else {
parcel.writeInt(0);
}
if (tickerIcons != null) {
final int N = tickerIcons.length;
parcel.writeInt(N);
for (int i=0; i<N; i++) {
if (tickerIcons[i] != null) {
parcel.writeInt(1);
tickerIcons[i].writeToParcel(parcel, flags);
} else {
parcel.writeInt(0);
}
}
} else {
parcel.writeInt(-1);
}
if (contentView != null) {
parcel.writeInt(1);
contentView.writeToParcel(parcel, 0);