• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Action类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.app.Notification.Action的典型用法代码示例。如果您正苦于以下问题:Java Action类的具体用法?Java Action怎么用?Java Action使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Action类属于android.app.Notification包,在下文中一共展示了Action类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: Notification

import android.app.Notification.Action; //导入依赖的package包/类
public Notification(Parcel in) {
    this.expandedInboxText = new ArrayList();
    this.people = new ArrayList();
    this.actions = new ArrayList();
    this.packageName = in.readString();
    this.id = in.readInt();
    this.tag = in.readString();
    this.key = in.readString();
    this.when = in.readLong();
    this.smallIcon = in.readInt();
    this.largeIcon = (Bitmap) in.readParcelable(Bitmap.class.getClassLoader());
    this.tickerText = in.readString();
    this.contentTitle = in.readString();
    this.contentText = in.readString();
    this.contentInfoText = in.readString();
    this.expandedLargeIconBig = (Bitmap) in.readParcelable(Bitmap.class.getClassLoader());
    this.expandedContentTitle = in.readString();
    this.expandedContentText = in.readString();
    in.readStringList(this.expandedInboxText);
    in.readList(this.people, Uri.class.getClassLoader());
    this.picture = (Bitmap) in.readParcelable(Bitmap.class.getClassLoader());
    this.priority = in.readInt();
    this.pendingLaunchIntent = (PendingIntent) in.readParcelable(PendingIntent.class.getClassLoader());
    in.readList(this.actions, Action.class.getClassLoader());
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:26,代码来源:Notification.java


示例2: a

import android.app.Notification.Action; //导入依赖的package包/类
public static void a(Notification.Builder paramBuilder, ea paramea)
{
  Notification.Action.Builder localBuilder = new Notification.Action.Builder(paramea.a(), paramea.b(), paramea.c());
  if (paramea.e() != null)
  {
    RemoteInput[] arrayOfRemoteInput = a(paramea.e());
    int i1 = arrayOfRemoteInput.length;
    for (int i2 = 0; i2 < i1; i2++) {
      localBuilder.addRemoteInput(arrayOfRemoteInput[i2]);
    }
  }
  if (paramea.d() != null) {
    localBuilder.addExtras(paramea.d());
  }
  paramBuilder.addAction(localBuilder.build());
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:17,代码来源:efj.java


示例3: newStreamNotification

import android.app.Notification.Action; //导入依赖的package包/类
private Notification.Builder newStreamNotification(CharSequence title, CharSequence text) {
    return new Notification.Builder(appContext)
            .setContentTitle(title)
            .setContentText(text)
            .setSmallIcon(R.mipmap.ic_launcher)
            .setLocalOnly(true)
            .setPriority(Notification.PRIORITY_MAX)
            .setVibrate(new long[]{0, 50}) // Vibrate to bring card to top of stream
            .setDeleteIntent(newLogPendingIntent("Delete intent triggered", PendingIntent.FLAG_CANCEL_CURRENT))
            .addAction(new Action(R.drawable.ic_fullscreen_white_48dp, "Fullscreen", newLaunchFullscreenPendingIntent()))
            .addAction(new Action(R.drawable.ic_network_wifi_white_48dp, "Connect to Wi-Fi", newConnectWifiPendingIntent()));
}
 
开发者ID:jbarr21,项目名称:gopro-remote,代码行数:13,代码来源:WearNotificationManager.java


示例4: newStatusNotification

import android.app.Notification.Action; //导入依赖的package包/类
private Notification.Builder newStatusNotification(CharSequence contentTitle, CharSequence contentText) {
    saveNotificationLabels(title, text);
    return new Notification.Builder(appContext)
            .setContentTitle(contentTitle)  // Current status and quick action icon
            .setContentText(contentText)
            .setSmallIcon(R.mipmap.ic_launcher)
            .setLocalOnly(true)
            .setPriority(Notification.PRIORITY_MAX)
            .setVibrate(new long[]{0, 50}) // Vibrate to bring card to top of stream
            .setDeleteIntent(newLogPendingIntent("Delete intent triggered", PendingIntent.FLAG_CANCEL_CURRENT))
            .extend(new Notification.WearableExtender()
                            .setBackground(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.background))
                            .addPage(new Notification.Builder(appContext)
                                            .extend(new WearableExtender()
                                                            .setDisplayIntent(newControlPendingIntent()) // On, Off, Start, Stop
                                                            .setCustomSizePreset(WearableExtender.SIZE_FULL_SCREEN)
                                            )
                                            .build()
                            )
                            .addPage(new Notification.Builder(appContext)
                                            .extend(new WearableExtender()
                                                            .setDisplayIntent(newModePendingIntent()) // Mode wearable list view
                                                            .setCustomSizePreset(WearableExtender.SIZE_FULL_SCREEN)
                                            )
                                            .build()
                            )
                            .addAction(new Action(R.drawable.ic_network_wifi_white_48dp, "Connect to Wi-Fi", newConnectWifiPendingIntent()))
            );
}
 
开发者ID:jbarr21,项目名称:gopro-remote,代码行数:30,代码来源:WearNotificationManager.java


示例5: onCreate

import android.app.Notification.Action; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Create a notification with an action to toggle an alarm on the phone.
    Intent toggleAlarmOperation = new Intent(this, FindPhoneService.class);
    toggleAlarmOperation.setAction(FindPhoneService.ACTION_TOGGLE_ALARM);
    PendingIntent toggleAlarmIntent = PendingIntent.getService(this, 0, toggleAlarmOperation,
            PendingIntent.FLAG_CANCEL_CURRENT);
    Action alarmAction = new Action(R.drawable.alarm_action_icon, "", toggleAlarmIntent);
    // This intent turns off the alarm if the user dismisses the card from the wearable.
    Intent cancelAlarmOperation = new Intent(this, FindPhoneService.class);
    cancelAlarmOperation.setAction(FindPhoneService.ACTION_CANCEL_ALARM);
    PendingIntent cancelAlarmIntent = PendingIntent.getService(this, 0, cancelAlarmOperation,
            PendingIntent.FLAG_CANCEL_CURRENT);
    // Use a spannable string for the notification title to resize it.
    SpannableString title = new SpannableString(getString(R.string.app_name));
    title.setSpan(new RelativeSizeSpan(0.85f), 0, title.length(), Spannable.SPAN_POINT_MARK);
    notification = new Notification.Builder(this)
            .setContentTitle(title)
            .setContentText(getString(R.string.turn_alarm_on))
            .setSmallIcon(R.drawable.ic_launcher)
            .setVibrate(new long[] {0, 50})  // Vibrate to bring card to top of stream.
            .setDeleteIntent(cancelAlarmIntent)
            .extend(new Notification.WearableExtender()
                    .addAction(alarmAction)
                    .setContentAction(0)
                    .setHintHideIcon(true))
            .setLocalOnly(true)
            .setPriority(Notification.PRIORITY_MAX);
    ((NotificationManager) getSystemService(NOTIFICATION_SERVICE))
            .notify(FIND_PHONE_NOTIFICATION_ID, notification.build());

    finish();
}
 
开发者ID:mauimauer,项目名称:AndroidWearable-Samples,代码行数:36,代码来源:FindPhoneActivity.java


示例6: getActions

import android.app.Notification.Action; //导入依赖的package包/类
public List<Action> getActions() {
    return this.actions;
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:4,代码来源:Notification.java


示例7: postNotificationForGeofenceId

import android.app.Notification.Action; //导入依赖的package包/类
/**
 * Posts a local notification for the given geofence id, with an option to check in.
 * @param geofenceId The geofence id that the user has triggered.
 * @param dataItemUri The Uri for the DataItem that triggered this notification. Used to delete
 *                    this DataItem when the notification is dismissed.
 */
private void postNotificationForGeofenceId(String geofenceId, Uri dataItemUri) {
    // Use the geofenceId to determine the title and background of the check-in notification.
    // A SpannableString is used for the notification title for resizing capabilities.
    SpannableString checkInTitle;
    Bitmap notificationBackground;
    if (ANDROID_BUILDING_ID.equals(geofenceId)) {
        checkInTitle = new SpannableString(getText(R.string.android_building_title));
        notificationBackground =
                BitmapFactory.decodeResource(getResources(), R.drawable.android_building);
    } else if (YERBA_BUENA_ID.equals(geofenceId)) {
        checkInTitle = new SpannableString(getText(R.string.yerba_buena_title));
        notificationBackground =
                BitmapFactory.decodeResource(getResources(), R.drawable.yerba_buena);
    } else {
        Log.e(TAG, "Unrecognized geofence id: " + geofenceId);
        return;
    }
    // Resize the title to avoid truncation.
    checkInTitle.setSpan(new RelativeSizeSpan(0.8f), 0, checkInTitle.length(),
            Spannable.SPAN_POINT_MARK);

    Intent checkInOperation =
            new Intent(this, CheckInAndDeleteDataItemsService.class).setData(dataItemUri);
    PendingIntent checkInIntent = PendingIntent.getService(this, 0,
            checkInOperation.setAction(ACTION_CHECK_IN), PendingIntent.FLAG_CANCEL_CURRENT);
    PendingIntent deleteDataItemIntent = PendingIntent.getService(this, 1,
            checkInOperation.setAction(ACTION_DELETE_DATA_ITEM),
            PendingIntent.FLAG_CANCEL_CURRENT);
    // This action will be embedded into the notification.
    Action checkInAction = new Action(R.drawable.ic_action_check_in,
            getText(R.string.check_in_prompt), checkInIntent);

    Notification notification = new Notification.Builder(this)
            .setContentTitle(checkInTitle)
            .setContentText(getText(R.string.check_in_prompt))
            .setSmallIcon(R.drawable.ic_launcher)
            .setDeleteIntent(deleteDataItemIntent)
            .extend(new Notification.WearableExtender()
                    .setBackground(notificationBackground)
                    .addAction(checkInAction)
                    .setContentAction(0)
                    .setHintHideIcon(true))
            .setLocalOnly(true)
            .build();

    ((NotificationManager) getSystemService(NOTIFICATION_SERVICE))
            .notify(NOTIFICATION_ID, notification);
}
 
开发者ID:mauimauer,项目名称:AndroidWearable-Samples,代码行数:55,代码来源:HomeListenerService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DataTransferProtocol类代码示例发布时间:2022-05-23
下一篇:
Java ContinuationPending类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap