本文整理汇总了Java中android.support.v4.app.NotificationCompat.WearableExtender类的典型用法代码示例。如果您正苦于以下问题:Java WearableExtender类的具体用法?Java WearableExtender怎么用?Java WearableExtender使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WearableExtender类属于android.support.v4.app.NotificationCompat包,在下文中一共展示了WearableExtender类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSummaryActions
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
public void addSummaryActions(Builder builder, NotificationData notificationData) {
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender();
addMarkAllAsReadAction(wearableExtender, notificationData);
if (isDeleteActionAvailableForWear()) {
addDeleteAllAction(wearableExtender, notificationData);
}
Account account = notificationData.getAccount();
if (isArchiveActionAvailableForWear(account)) {
addArchiveAllAction(wearableExtender, notificationData);
}
builder.extend(wearableExtender);
}
示例2: addWearActions
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
private void addWearActions(Builder builder, Account account, NotificationHolder holder) {
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender();
addReplyAction(wearableExtender, holder);
addMarkAsReadAction(wearableExtender, holder);
if (isDeleteActionAvailableForWear()) {
addDeleteAction(wearableExtender, holder);
}
if (isArchiveActionAvailableForWear(account)) {
addArchiveAction(wearableExtender, holder);
}
if (isSpamActionAvailableForWear(account)) {
addMarkAsSpamAction(wearableExtender, holder);
}
builder.extend(wearableExtender);
}
示例3: buildNotifications
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
@Override
public Notification[] buildNotifications(Context context, BuildOptions options) {
Notification secondPage = new NotificationCompat.Builder(context)
.setContentTitle(context.getString(R.string.second_page_content_title))
.setContentText(context.getString(R.string.second_page_content_text))
.build();
Builder notificationBuilder = buildBasicNotification(context, options);
Notification twoPageNotification = new WearableExtender()
.addPage(secondPage)
.extend(notificationBuilder)
.build();
return new Notification[] { twoPageNotification };
}
示例4: showNotificationWithPages
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
public static void showNotificationWithPages(Context context) {
NotificationCompat.Builder builder =
new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(context.getString(R.string.page1_title))
.setContentText(context.getString(R.string.page1_text));
Notification second = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(context.getString(R.string.page2_title))
.setContentText(context.getString(R.string.page2_text))
.build();
NotificationManagerCompat.from(context).notify(getNewID(),
new WearableExtender()
.addPage(second)
.extend(builder)
.build());
}
示例5: showNotificationWithInputForPrimaryAction
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
public static void showNotificationWithInputForPrimaryAction(Context context) {
Intent intent = new Intent(ACTION_TEST);
PendingIntent pendingIntent =
PendingIntent.getActivity(context, 0, intent, 0);
RemoteInput remoteInput = new RemoteInput.Builder(ACTION_EXTRA)
.setLabel(context.getString(R.string.action_label))
.setChoices(context.getResources().getStringArray(R.array.input_choices))
.build();
NotificationCompat.Action action =
new NotificationCompat.Action.Builder(R.drawable.ic_launcher,
"Action", pendingIntent)
.addRemoteInput(remoteInput)
.build();
NotificationManagerCompat.from(context).notify(getNewID(),
new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(context.getString(R.string.action_title))
.setContentText(context.getString(R.string.action_text))
.setContentIntent(pendingIntent)
.extend(new WearableExtender().addAction(action))
.build());
}
示例6: showNotificationWithInputForSecondaryAction
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
public static void showNotificationWithInputForSecondaryAction(Context context) {
Intent intent = new Intent(ACTION_TEST);
PendingIntent pendingIntent =
PendingIntent.getActivity(context, 0, intent, 0);
RemoteInput remoteInput = new RemoteInput.Builder(ACTION_EXTRA)
.setLabel(context.getString(R.string.action_label))
.build();
NotificationCompat.Action action =
new NotificationCompat.Action.Builder(R.drawable.ic_launcher,
"Action", pendingIntent)
.addRemoteInput(remoteInput)
.build();
NotificationManagerCompat.from(context).notify(getNewID(),
new NotificationCompat.Builder(context)
.setContentTitle(context.getString(R.string.action_title))
.extend(new WearableExtender().addAction(action))
.build());
}
示例7: addMarkAllAsReadAction
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
private void addMarkAllAsReadAction(WearableExtender wearableExtender, NotificationData notificationData) {
int icon = R.drawable.ic_action_mark_as_read_dark;
String title = context.getString(R.string.notification_action_mark_all_as_read);
Account account = notificationData.getAccount();
ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences();
int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
PendingIntent action = actionCreator.getMarkAllAsReadPendingIntent(account, messageReferences, notificationId);
NotificationCompat.Action markAsReadAction = new NotificationCompat.Action.Builder(icon, title, action).build();
wearableExtender.addAction(markAsReadAction);
}
示例8: addDeleteAllAction
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
private void addDeleteAllAction(WearableExtender wearableExtender, NotificationData notificationData) {
int icon = R.drawable.ic_action_delete_dark;
String title = context.getString(R.string.notification_action_delete_all);
Account account = notificationData.getAccount();
ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences();
int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
PendingIntent action = actionCreator.getDeleteAllPendingIntent(account, messageReferences, notificationId);
NotificationCompat.Action deleteAction = new NotificationCompat.Action.Builder(icon, title, action).build();
wearableExtender.addAction(deleteAction);
}
示例9: addArchiveAllAction
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
private void addArchiveAllAction(WearableExtender wearableExtender, NotificationData notificationData) {
int icon = R.drawable.ic_action_archive_dark;
String title = context.getString(R.string.notification_action_archive_all);
Account account = notificationData.getAccount();
ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences();
int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
PendingIntent action = actionCreator.createArchiveAllPendingIntent(account, messageReferences, notificationId);
NotificationCompat.Action archiveAction = new NotificationCompat.Action.Builder(icon, title, action).build();
wearableExtender.addAction(archiveAction);
}
示例10: addReplyAction
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
private void addReplyAction(WearableExtender wearableExtender, NotificationHolder holder) {
int icon = R.drawable.ic_action_single_message_options_dark;
String title = context.getString(R.string.notification_action_reply);
MessageReference messageReference = holder.content.messageReference;
int notificationId = holder.notificationId;
PendingIntent action = actionCreator.createReplyPendingIntent(messageReference, notificationId);
NotificationCompat.Action replyAction = new NotificationCompat.Action.Builder(icon, title, action).build();
wearableExtender.addAction(replyAction);
}
示例11: addMarkAsReadAction
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
private void addMarkAsReadAction(WearableExtender wearableExtender, NotificationHolder holder) {
int icon = R.drawable.ic_action_mark_as_read_dark;
String title = context.getString(R.string.notification_action_mark_as_read);
MessageReference messageReference = holder.content.messageReference;
int notificationId = holder.notificationId;
PendingIntent action = actionCreator.createMarkMessageAsReadPendingIntent(messageReference, notificationId);
NotificationCompat.Action markAsReadAction = new NotificationCompat.Action.Builder(icon, title, action).build();
wearableExtender.addAction(markAsReadAction);
}
示例12: addDeleteAction
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
private void addDeleteAction(WearableExtender wearableExtender, NotificationHolder holder) {
int icon = R.drawable.ic_action_delete_dark;
String title = context.getString(R.string.notification_action_delete);
MessageReference messageReference = holder.content.messageReference;
int notificationId = holder.notificationId;
PendingIntent action = actionCreator.createDeleteMessagePendingIntent(messageReference, notificationId);
NotificationCompat.Action deleteAction = new NotificationCompat.Action.Builder(icon, title, action).build();
wearableExtender.addAction(deleteAction);
}
示例13: addArchiveAction
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
private void addArchiveAction(WearableExtender wearableExtender, NotificationHolder holder) {
int icon = R.drawable.ic_action_archive_dark;
String title = context.getString(R.string.notification_action_archive);
MessageReference messageReference = holder.content.messageReference;
int notificationId = holder.notificationId;
PendingIntent action = actionCreator.createArchiveMessagePendingIntent(messageReference, notificationId);
NotificationCompat.Action archiveAction = new NotificationCompat.Action.Builder(icon, title, action).build();
wearableExtender.addAction(archiveAction);
}
示例14: addMarkAsSpamAction
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
private void addMarkAsSpamAction(WearableExtender wearableExtender, NotificationHolder holder) {
int icon = R.drawable.ic_action_spam_dark;
String title = context.getString(R.string.notification_action_spam);
MessageReference messageReference = holder.content.messageReference;
int notificationId = holder.notificationId;
PendingIntent action = actionCreator.createMarkMessageAsSpamPendingIntent(messageReference, notificationId);
NotificationCompat.Action spamAction = new NotificationCompat.Action.Builder(icon, title, action).build();
wearableExtender.addAction(spamAction);
}
示例15: matches
import android.support.v4.app.NotificationCompat.WearableExtender; //导入依赖的package包/类
@Override
public boolean matches(Object argument) {
if (!(argument instanceof WearableExtender)) {
return false;
}
WearableExtender wearableExtender = (WearableExtender) argument;
for (Action action : wearableExtender.getActions()) {
if (action.icon == icon && action.title.equals(title) && action.actionIntent == pendingIntent) {
return true;
}
}
return false;
}