diff options
author | Daniel Sandler <dsandler@android.com> | 2012-10-22 08:19:06 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-10-22 08:19:06 -0700 |
commit | 17d237e1de4398a8045da2cdcb047c1fd862f8d4 (patch) | |
tree | e30da4ea05ab6e3eb1fe02ee1aaf70e274c68151 /packages | |
parent | a33079c7bc2a6a33341fe2560ae3c61442cf56de (diff) | |
parent | cc0106cd99831ce7d3715e3c85e5b3e6c5c6ca78 (diff) | |
download | frameworks_base-17d237e1de4398a8045da2cdcb047c1fd862f8d4.zip frameworks_base-17d237e1de4398a8045da2cdcb047c1fd862f8d4.tar.gz frameworks_base-17d237e1de4398a8045da2cdcb047c1fd862f8d4.tar.bz2 |
am cc0106cd: Merge "Properly show emoji in the notification ticker." into jb-mr1-dev
* commit 'cc0106cd99831ce7d3715e3c85e5b3e6c5c6ca78':
Properly show emoji in the notification ticker.
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java index 67846a3..ecc70d6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java @@ -53,6 +53,16 @@ public abstract class Ticker { private TextSwitcher mTextSwitcher; private float mIconScale; + public static boolean isGraphicOrEmoji(char c) { + int gc = Character.getType(c); + return gc != Character.CONTROL + && gc != Character.FORMAT + && gc != Character.UNASSIGNED + && gc != Character.LINE_SEPARATOR + && gc != Character.PARAGRAPH_SEPARATOR + && gc != Character.SPACE_SEPARATOR; + } + private final class Segment { StatusBarNotification notification; Drawable icon; @@ -68,7 +78,7 @@ public abstract class Ticker { } CharSequence rtrim(CharSequence substr, int start, int end) { - while (end > start && !TextUtils.isGraphic(substr.charAt(end-1))) { + while (end > start && !isGraphicOrEmoji(substr.charAt(end-1))) { end--; } if (end > start) { @@ -101,7 +111,7 @@ public abstract class Ticker { this.first = false; int index = this.next; final int len = this.text.length(); - while (index < len && !TextUtils.isGraphic(this.text.charAt(index))) { + while (index < len && !isGraphicOrEmoji(this.text.charAt(index))) { index++; } if (index >= len) { @@ -136,7 +146,7 @@ public abstract class Ticker { this.text = text; int index = 0; final int len = text.length(); - while (index < len && !TextUtils.isGraphic(text.charAt(index))) { + while (index < len && !isGraphicOrEmoji(text.charAt(index))) { index++; } this.current = index; @@ -194,7 +204,8 @@ public abstract class Ticker { final Drawable icon = StatusBarIconView.getIcon(mContext, new StatusBarIcon(n.pkg, n.user, n.notification.icon, n.notification.iconLevel, 0, n.notification.tickerText)); - final Segment newSegment = new Segment(n, icon, n.notification.tickerText); + final CharSequence text = n.notification.tickerText; + final Segment newSegment = new Segment(n, icon, text); // If there's already a notification schedule for this package and id, remove it. for (int i=0; i<mSegments.size(); i++) { |