當前位置: 首頁>>代碼示例>>Java>>正文


Java StatusBarNotification.getTag方法代碼示例

本文整理匯總了Java中android.service.notification.StatusBarNotification.getTag方法的典型用法代碼示例。如果您正苦於以下問題:Java StatusBarNotification.getTag方法的具體用法?Java StatusBarNotification.getTag怎麽用?Java StatusBarNotification.getTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.service.notification.StatusBarNotification的用法示例。


在下文中一共展示了StatusBarNotification.getTag方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: notificationFromStatusBarNotification

import android.service.notification.StatusBarNotification; //導入方法依賴的package包/類
@TargetApi(21)
Notification notificationFromStatusBarNotification(StatusBarNotification sbn) {
    if (VERSION.SDK_INT < 21) {
        return new Notification(sbn.getPackageName(), sbn.getId(), sbn.getTag(), null, sbn.getNotification());
    }
    return new Notification(sbn.getPackageName(), sbn.getId(), sbn.getTag(), sbn.getKey(), sbn.getNotification());
}
 
開發者ID:bunnyblue,項目名稱:NoticeDog,代碼行數:8,代碼來源:NotificationService.java

示例2: containsSameNotification

import android.service.notification.StatusBarNotification; //導入方法依賴的package包/類
public boolean containsSameNotification(StatusBarNotification other) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        return contentNotification.getKey().equals(other.getKey());
    } else {
        return (contentNotification.getPackageName().equals(other.getPackageName()) &&
                (contentNotification.getId() == other.getId()) &&
                ((contentNotification.getTag() != null && contentNotification.getTag().equals(other.getTag())) || (contentNotification.getTag() == null && other.getTag() == null)));
    }
}
 
開發者ID:matejdro,項目名稱:WearVibrationCenter,代碼行數:10,代碼來源:ProcessedNotification.java

示例3: getIdentifier

import android.service.notification.StatusBarNotification; //導入方法依賴的package包/類
private String getIdentifier(StatusBarNotification statusBarNotif) {
    if (statusBarNotif == null) return null;
    String pkgName = statusBarNotif.getPackageName();
    if (SUPPORTED_PACKAGES.get(0).equals(pkgName)) {
        String tag = statusBarNotif.getTag();
        if (tag != null && tag.contains(":")) {
            return pkgName + ":" + tag.substring(tag.indexOf(":")+1);
        }
        if (DEBUG) log("getIdentifier: Unexpected notification tag: " + tag);
    } else {
        return (pkgName + ":" + String.valueOf(statusBarNotif.getId()));
    }
    return null;
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:15,代碼來源:ProgressBarController.java

示例4: onNotificationPosted

import android.service.notification.StatusBarNotification; //導入方法依賴的package包/類
@TargetApi(20)
@Override
public void onNotificationPosted(StatusBarNotification sbn, NotificationListenerService.RankingMap rankingMap) {
    TITLE = sbn.getNotification().extras.getCharSequence(Notification.EXTRA_TITLE).toString();
    //Log.e("GROUP KEY", " " + sbn.getPostTime());
    //Log.e("FROM", sbn.getNotification().contentIntent.getCreatorPackage());
    if(sbn.getTag() == null && TITLE != null){
        notificationCount = sbn.getNotification().number;
        notificationCount++;
    }else if ((sbn.getTag() != null) && Utilities.isAllowNotificationCountPrefEnabled(getApplicationContext())) {

        /*if((sbn.getTag() == null || TITLE != null)){
            names.add(TITLE);
            try {
                icons.add(sbn.getNotification().getLargeIcon().loadDrawable(getApplicationContext()));
            }catch (Exception e){
                Drawable drawable = new BitmapDrawable(getResources(), Launcher.getIcons().get(sbn.getPackageName()));
                icons.add(drawable);
            }
        }else {
            try {
                TITLE = sbn.getNotification().extras.getCharSequence(Notification.EXTRA_TITLE).toString();
                names.add(TITLE + "\n" + sbn.getNotification().extras.getCharSequence(Notification.EXTRA_TEXT).toString());
                icons.add(sbn.getNotification().getLargeIcon().loadDrawable(getApplicationContext()));
            } catch (Exception e) {

            }
        }*/


        /*if(sbn.getTag() != null  && Utilities.isAllowNotificationCountPrefEnabled(getApplicationContext())) {
            notificationCount++;
        }else if(sbn.getTag() == null  && Utilities.isAllowNotificationCountPrefEnabled(getApplicationContext())
                && TITLE != null){
            notificationCount++;
        }
        */

        notificationCount = sbn.getNotification().number;
        notificationCount++;


        for (final AppInfo app : AllAppsList.data) {
            if (sbn.getPackageName().equals(app.getTargetComponent().getPackageName())) {
                if(getNotificationCount(getApplicationContext(), app.getTargetComponent().getPackageName()) != -1){
                    int notificationCountPrev = getNotificationCount(getApplicationContext(), app.getTargetComponent().getPackageName());
                    notificationCountPrev++;
                    setNotificationCount(getApplicationContext(), app.getTargetComponent().getPackageName(), notificationCountPrev);
                }else {
                    setNotificationCount(getApplicationContext(), app.getTargetComponent().getPackageName(), notificationCount);
                }
                Launcher.getLauncherAppState().reloadWorkspace();
            }
        }
    }
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:57,代碼來源:MyNotificationListenerService.java


注:本文中的android.service.notification.StatusBarNotification.getTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。