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


Java NotificationCompat.WearableExtender方法代码示例

本文整理汇总了Java中android.support.v4.app.NotificationCompat.WearableExtender方法的典型用法代码示例。如果您正苦于以下问题:Java NotificationCompat.WearableExtender方法的具体用法?Java NotificationCompat.WearableExtender怎么用?Java NotificationCompat.WearableExtender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.NotificationCompat的用法示例。


在下文中一共展示了NotificationCompat.WearableExtender方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSummaryActions

import android.support.v4.app.NotificationCompat; //导入方法依赖的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);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:17,代码来源:WearNotifications.java

示例2: addWearActions

import android.support.v4.app.NotificationCompat; //导入方法依赖的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);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:21,代码来源:WearNotifications.java

示例3: sendNotification

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
/**
 * Method to send a notification to the application
 *
 * @param messageTitle is the title as it is set in the push messaged received through firebase
 * @param messageBody  is the body as it is set in the push messaged received through firebase
 */
private void sendNotification(String messageTitle, String messageBody) {
    Intent intent = new Intent(this, DashboardFragment.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
            PendingIntent.FLAG_ONE_SHOT);

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.mipmap.ic_launcher)
            .setContentTitle(messageTitle)
            .setContentText(messageBody)
            .setAutoCancel(true)
            .setContentIntent(pendingIntent);

    // Improve Android Wear
    NotificationCompat.WearableExtender wearableExtender =
            new NotificationCompat.WearableExtender()
            .setHintHideIcon(true)
            .setContentIcon(R.mipmap.ic_launcher);
    notificationBuilder.extend(wearableExtender);

    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}
 
开发者ID:schul-cloud,项目名称:schulcloud-mobile-android,代码行数:32,代码来源:MessagingService.java

示例4: CreateCameraNotification

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
public void CreateCameraNotification(
        int notificationId,
        @NonNull Class<?> receiverActivity) {

    if (!_settingsController.IsCameraNotificationEnabled()) {
        Logger.getInstance().Warning(TAG, "Not allowed to display camera notification!");
        return;
    }

    Bitmap bitmap = BitmapFactory.decodeResource(_context.getResources(), R.drawable.camera);
    NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender().setHintHideIcon(true).setBackground(bitmap);
    RemoteViews remoteViews = new RemoteViews(_context.getPackageName(), R.layout.notification_camera);

    // Action for button show camera
    Intent goToSecurityIntent = new Intent(_context, receiverActivity);
    PendingIntent goToSecurityPendingIntent = PendingIntent.getActivity(_context, 34678743, goToSecurityIntent, 0);
    NotificationCompat.Action goToSecurityWearAction = new NotificationCompat.Action.Builder(R.drawable.camera, "Go to security", goToSecurityPendingIntent).build();

    remoteViews.setOnClickPendingIntent(R.id.goToSecurity, goToSecurityPendingIntent);

    NotificationCompat.Builder builder = new NotificationCompat.Builder(_context);
    builder.setSmallIcon(R.drawable.camera)
            .setContentTitle("Camera is active!")
            .setContentText("Go to security!")
            .setTicker("")
            .extend(wearableExtender)
            .addAction(goToSecurityWearAction);

    Notification notification = builder.build();
    notification.contentView = remoteViews;
    notification.bigContentView = remoteViews;

    NotificationManagerCompat notificationManager = NotificationManagerCompat.from(_context);
    notificationManager.notify(notificationId, notification);
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:36,代码来源:NotificationController.java

示例5: mute

import android.support.v4.app.NotificationCompat; //导入方法依赖的package包/类
private void mute(TimedMuteCommand timedMuteCommand) {
    long mutedUntil = -1;

    if (timedMuteCommand.getMuteDurationMinutes() > 0) {
        mutedUntil = System.currentTimeMillis() + timedMuteCommand.getMuteDurationMinutes() * 1000 * 60;
    }

    PendingIntent unmutePendingIntent = PendingIntent.getBroadcast(service, 0, new Intent(ACTON_UNMUTE), PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Builder builder = new NotificationCompat.Builder(service, VibrationCenterChannels.CHANNEL_TEMPORARY_MUTE)
            .setSmallIcon(R.drawable.ic_notification)
            .setPriority(Notification.PRIORITY_MIN)
            .setDeleteIntent(unmutePendingIntent)
            .setContentTitle(service.getString(R.string.vibrations_muted_notification_title))
            .setContentText(service.getString(R.string.vibrations_muted_notification_explanation));

    NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender();
    wearableExtender.addAction(new NotificationCompat.Action(R.drawable.ic_dismiss_mute, service.getString(R.string.cancel_mute), unmutePendingIntent));
    builder.extend(wearableExtender);

    if (mutedUntil > 0) {
        builder
                .setWhen(mutedUntil)
                .setUsesChronometer(true);

        // NotificationCompat is missing setChronometerCountDown(), lets do it manually.
        builder.getExtras().putBoolean("android.chronometerCountDown", true);

        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                unmute();
            }
        }, mutedUntil - System.currentTimeMillis());
    }

    NotificationManagerCompat.from(service).notify(NOTIFICATION_ID_MUTE_DURATION, builder.build());
    mutedCurrently = true;

    previousZenMode = 0;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        activateZenMode();
    }
}
 
开发者ID:matejdro,项目名称:WearVibrationCenter,代码行数:45,代码来源:TimedMuteManager.java


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