当前位置: 首页>>代码示例>>Java>>正文


Java Style类代码示例

本文整理汇总了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);
	}
}
 
开发者ID:haku,项目名称:Onosendai,代码行数:39,代码来源:Notifications.java

示例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;
}
 
开发者ID:haku,项目名称:Onosendai,代码行数:16,代码来源:Notifications.java

示例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);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:7,代码来源:NotificationCompat.java


注:本文中的android.support.v4.app.NotificationCompat.Style类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。