本文整理汇总了Java中android.support.v4.app.NotificationCompat.Style类的典型用法代码示例。如果您正苦于以下问题:Java Style类的具体用法?Java Style怎么用?Java Style使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Style类属于android.support.v4.app.NotificationCompat包,在下文中一共展示了Style类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateColumn
import android.support.v4.app.NotificationCompat.Style; //导入依赖的package包/类
private static void updateColumn (final Context context, final DbInterface db, final Column col, final NotificationManager nm) {
final int nId = idForColumn(col);
final int count = db.getUnreadCount(col);
if (count > 0) {
final Intent showMainActI = new Intent(context, MainActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
.putExtra(MainActivity.ARG_FOCUS_COLUMN_ID, col.getId());
final PendingIntent showMainActPi = PendingIntent.getActivity(context, col.getId(), showMainActI, PendingIntent.FLAG_CANCEL_CURRENT);
final List<Tweet> tweets = db.getTweets(col.getId(), Math.min(count, 5),
Selection.FILTERED, col.getExcludeColumnIds(),
col.getInlineMediaStyle() == InlineMediaStyle.SEAMLESS,
col.getNotificationStyle().isExcludeRetweets(),
!col.getNotificationStyle().isIncludeOwnTweets());
final String msg = makeMsg(col, tweets, count);
final Style style = makePreview(tweets, count);
final PendingIntent markAsReadPi = MarkAsReadReceiver.makePi(context, col, tweets);
final Builder nb = new NotificationCompat.Builder(context)
.setOnlyAlertOnce(true)
.setSmallIcon(notificationIcon())
.setContentTitle(col.getTitle())
.setContentText(msg)
.setTicker(msg)
.setNumber(count)
.setContentIntent(showMainActPi)
.setAutoCancel(true)
.setWhen(System.currentTimeMillis())
.setStyle(style);
if (markAsReadPi != null) nb.addAction(android.R.drawable.ic_menu_close_clear_cancel, "Mark as read", markAsReadPi); //ES
applyStyle(nb, col.getNotificationStyle());
nm.notify(nId, nb.build());
}
else {
nm.cancel(nId);
}
}
示例2: makePreview
import android.support.v4.app.NotificationCompat.Style; //导入依赖的package包/类
private static Style makePreview (final List<Tweet> tweets, final int count) {
if (tweets == null || tweets.size() < 1) return null;
if (tweets.size() == 1) return new NotificationCompat.BigTextStyle()
.bigText(tweetToSpanable(tweets.iterator().next()));
final InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
for (final Tweet tweet : tweets) {
inboxStyle.addLine(tweetToSpanable(tweet));
}
if (tweets.size() < count) {
inboxStyle.setSummaryText(String.format("+%s more", count - tweets.size()));
}
return inboxStyle;
}
示例3: addMediaStyleToBuilderLollipop
import android.support.v4.app.NotificationCompat.Style; //导入依赖的package包/类
private static void addMediaStyleToBuilderLollipop(NotificationBuilderWithBuilderAccessor builder, Style style) {
if (style instanceof MediaStyle) {
MediaStyle mediaStyle = (MediaStyle) style;
NotificationCompatImpl21.addMediaStyle(builder, mediaStyle.mActionsToShowInCompact, mediaStyle.mToken != null ? mediaStyle.mToken.getToken() : null);
}
}