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


Java SnoozeOnNotificationDismissService类代码示例

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


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

示例1: snoozeIntent

import com.eveningoutpost.dexdrip.Services.SnoozeOnNotificationDismissService; //导入依赖的package包/类
private PendingIntent snoozeIntent(Context ctx, int minsSinceStartPlaying){
    final Intent intent = new Intent(ctx, SnoozeOnNotificationDismissService.class);
    intent.putExtra("alertType", "bg_alerts");
    intent.putExtra("raisedTimeStamp", JoH.tsl());
    intent.putExtra("minsSinceStartPlaying", minsSinceStartPlaying);
    return PendingIntent.getService(ctx, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:8,代码来源:AlertPlayer.java

示例2: OtherAlert

import com.eveningoutpost.dexdrip.Services.SnoozeOnNotificationDismissService; //导入依赖的package包/类
private static void OtherAlert(Context context, String type, String message, int notificatioId, long reraiseSec) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    String otherAlertsSound = prefs.getString("other_alerts_sound", "content://settings/system/notification_sound");
    Boolean otherAlertsOverrideSilent = prefs.getBoolean("other_alerts_override_silent", false);

    Log.d(TAG,"OtherAlert called " + type + " " + message);
    UserNotification userNotification = UserNotification.GetNotificationByType(type); //"bg_unclear_readings_alert"
    if ((userNotification == null) || userNotification.timestamp <= new Date().getTime() ) {
        if (userNotification != null) {
            userNotification.delete();
        }
        UserNotification.create(message, type, new Date().getTime() + reraiseSec * 1000);

        Intent deleteIntent = new Intent(context, SnoozeOnNotificationDismissService.class);
        deleteIntent.putExtra("alertType", type);
        Intent intent = new Intent(context, Home.class);
        NotificationCompat.Builder mBuilder =
                new NotificationCompat.Builder(context)
                        .setSmallIcon(R.drawable.ic_action_communication_invert_colors_on)
                        .setContentTitle(message)
                        .setContentText(message)
                        .setContentIntent(PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT))
                        .setDeleteIntent(PendingIntent.getService(context, 0, deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT));
        mBuilder.setVibrate(vibratePattern);
        mBuilder.setLights(0xff00ff00, 300, 1000);
        if(otherAlertsOverrideSilent) {
            mBuilder.setSound(Uri.parse(otherAlertsSound), AudioAttributes.USAGE_ALARM);
        } else {
            mBuilder.setSound(Uri.parse(otherAlertsSound));
        }
        NotificationManager mNotifyMgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        mNotifyMgr.cancel(notificatioId);
        mNotifyMgr.notify(notificatioId, mBuilder.build());
    }
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:xDrip-Experimental,代码行数:36,代码来源:Notifications.java

示例3: snoozeIntent

import com.eveningoutpost.dexdrip.Services.SnoozeOnNotificationDismissService; //导入依赖的package包/类
private PendingIntent snoozeIntent(Context ctx){
    Intent intent = new Intent(ctx, SnoozeOnNotificationDismissService.class);
    intent.putExtra("alertType", "bg_alerts");
    return PendingIntent.getService(ctx, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:6,代码来源:AlertPlayer.java

示例4: OtherAlert

import com.eveningoutpost.dexdrip.Services.SnoozeOnNotificationDismissService; //导入依赖的package包/类
private static void OtherAlert(Context context, String type, String message, int notificatioId, boolean addDeleteIntent, long reraiseSec) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    String otherAlertsSound = prefs.getString(type+"_sound",prefs.getString("other_alerts_sound", "content://settings/system/notification_sound"));
    Boolean otherAlertsOverrideSilent = prefs.getBoolean("other_alerts_override_silent", false);

    Log.d(TAG,"OtherAlert called " + type + " " + message + " reraiseSec = " + reraiseSec);
    UserNotification userNotification = UserNotification.GetNotificationByType(type); //"bg_unclear_readings_alert"
    if ((userNotification == null) || userNotification.timestamp <= new Date().getTime() ) {
        if (userNotification != null) {
            try {
                userNotification.delete();
            } catch (NullPointerException e) {
                // ignore null pointer exception during delete as we emulate database records
            }
            Log.d(TAG, "Delete");
        }
        UserNotification.create(message, type, new Date().getTime() + reraiseSec * 1000);


        boolean localOnly =false;//KS
        if (notificatioId == persistentHighAlertNotificationId) {
            localOnly = (Home.get_forced_wear() && bg_notifications && bg_persistent_high_alert_enabled);
        }
        Log.d(TAG,"OtherAlert forced_wear localOnly=" + localOnly);
        Intent intent = new Intent(context, Home.class);
        NotificationCompat.Builder mBuilder =
                new NotificationCompat.Builder(context)
                        .setSmallIcon(R.drawable.ic_launcher)//KS ic_action_communication_invert_colors_on
                        .setContentTitle(message)
                        .setContentText(message)
                        .setLocalOnly(localOnly)//KS
                        .setContentIntent(PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT));
        if (addDeleteIntent) {
            Intent deleteIntent = new Intent(context, SnoozeOnNotificationDismissService.class);
            deleteIntent.putExtra("alertType", type);
            mBuilder.setDeleteIntent(PendingIntent.getService(context, 0, deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT));
        }
        mBuilder.setVibrate(vibratePattern);
        mBuilder.setLights(0xff00ff00, 300, 1000);
        if (AlertPlayer.notSilencedDueToCall()) {
            if (otherAlertsOverrideSilent) {
                mBuilder.setSound(Uri.parse(otherAlertsSound), AudioAttributes.USAGE_ALARM);
            } else {
                mBuilder.setSound(Uri.parse(otherAlertsSound));
            }
        }
        NotificationManager mNotifyMgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        //mNotifyMgr.cancel(notificatioId);
        //Log.d(TAG, "Notify");
        Log.ueh("Other Alert",message);
        mNotifyMgr.notify(notificatioId, mBuilder.build());
    }
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:54,代码来源:Notifications.java

示例5: OtherAlert

import com.eveningoutpost.dexdrip.Services.SnoozeOnNotificationDismissService; //导入依赖的package包/类
private static void OtherAlert(Context context, String type, String message, int notificatioId, String channelId, boolean addDeleteIntent, long reraiseSec) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    String otherAlertsSound = prefs.getString(type+"_sound",prefs.getString("other_alerts_sound", "content://settings/system/notification_sound"));
    Boolean otherAlertsOverrideSilent = prefs.getBoolean("other_alerts_override_silent", false);

    Log.d(TAG,"OtherAlert called " + type + " " + message + " reraiseSec = " + reraiseSec);
    UserNotification userNotification = UserNotification.GetNotificationByType(type); //"bg_unclear_readings_alert"
    if ((userNotification == null) || userNotification.timestamp <= new Date().getTime() ) {
        if (userNotification != null) {
            try {
                userNotification.delete();
            } catch (NullPointerException e) {
                // ignore null pointer exception during delete as we emulate database records
            }
            Log.d(TAG, "Delete");
        }
        UserNotification.create(message, type, new Date().getTime() + reraiseSec * 1000);


        boolean localOnly =false;
        if (notificatioId == persistentHighAlertNotificationId) {
            localOnly = (Home.get_forced_wear() && bg_notifications_watch && bg_persistent_high_alert_enabled_watch);
        }
        Log.d(TAG,"OtherAlert forced_wear localOnly=" + localOnly);
        Intent intent = new Intent(context, Home.class);
        NotificationCompat.Builder mBuilder =
                new NotificationCompat.Builder(context, channelId)
                        .setVisibility(Pref.getBooleanDefaultFalse("public_notifications") ? Notification.VISIBILITY_PUBLIC : Notification.VISIBILITY_PRIVATE)
                        .setSmallIcon(R.drawable.ic_action_communication_invert_colors_on)
                        .setContentTitle(message)
                        .setContentText(message)
                        .setLocalOnly(localOnly)
                        .setContentIntent(PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT));
        if (addDeleteIntent) {
            Intent deleteIntent = new Intent(context, SnoozeOnNotificationDismissService.class);
            deleteIntent.putExtra("alertType", type);
            deleteIntent.putExtra("raisedTimeStamp", JoH.tsl());
            mBuilder.setDeleteIntent(PendingIntent.getService(context, 0, deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT));
        }
        mBuilder.setVibrate(vibratePattern);
        mBuilder.setLights(0xff00ff00, 300, 1000);
        if (AlertPlayer.notSilencedDueToCall()) {
            if (otherAlertsOverrideSilent) {
                mBuilder.setSound(Uri.parse(otherAlertsSound), AudioAttributes.USAGE_ALARM);
            } else {
                mBuilder.setSound(Uri.parse(otherAlertsSound));
            }
        }
        NotificationManager mNotifyMgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        //mNotifyMgr.cancel(notificatioId);
        //Log.d(TAG, "Notify");
        Log.ueh("Other Alert",message);
        mNotifyMgr.notify(notificatioId, XdripNotificationCompat.build(mBuilder));
    }
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:56,代码来源:Notifications.java


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