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


Java Builder類代碼示例

本文整理匯總了Java中android.support.v4.app.NotificationCompat.Builder的典型用法代碼示例。如果您正苦於以下問題:Java Builder類的具體用法?Java Builder怎麽用?Java Builder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Builder類屬於android.support.v4.app.NotificationCompat包,在下文中一共展示了Builder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: backupFound

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
private void backupFound(){
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
    if(jbBackupM.toString().trim().length()>0){
        Intent dialogIntent = new Intent(this, AddToContactList.class);
        dialogIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        dialogIntent.putExtra("data", jbBackupM.toString());
        PendingIntent intent = PendingIntent.getActivity(this, 0, dialogIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);
        mBuilder.setContentIntent(intent);
    }
    mBuilder.setSmallIcon(R.drawable.ic_custom_notification);
    mBuilder.setAutoCancel(true);
    mBuilder.setContentTitle("Contact Sync!!");
    mBuilder.setContentText("You have lost some contact, we have backup");
    NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    // notificationID allows you to update the notification later on.
    mNotificationManager.notify(notificaitonId, mBuilder.build());
}
 
開發者ID:mityung,項目名稱:XERUNG,代碼行數:19,代碼來源:ContactSync.java

示例2: createSimpleSummaryNotification

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
private NotificationCompat.Builder createSimpleSummaryNotification(Account account, int unreadMessageCount) {
    String accountName = controller.getAccountName(account);
    CharSequence newMailText = context.getString(R.string.notification_new_title);
    String unreadMessageCountText = context.getResources().getQuantityString(R.plurals.notification_new_one_account_fmt,
            unreadMessageCount, unreadMessageCount, accountName);

    int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
    PendingIntent contentIntent = actionCreator.createViewFolderListPendingIntent(account, notificationId);

    return createAndInitializeNotificationBuilder(account)
            .setNumber(unreadMessageCount)
            .setTicker(newMailText)
            .setContentTitle(unreadMessageCountText)
            .setContentText(newMailText)
            .setContentIntent(contentIntent);
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:17,代碼來源:DeviceNotifications.java

示例3: addSummaryActions

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的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

示例4: addWearActions

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的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

示例5: createBigTextStyleNotification

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
protected NotificationCompat.Builder createBigTextStyleNotification(Account account, NotificationHolder holder,
        int notificationId) {
    String accountName = controller.getAccountName(account);
    NotificationContent content = holder.content;
    String groupKey = NotificationGroupKeys.getGroupKey(account);

    NotificationCompat.Builder builder = createAndInitializeNotificationBuilder(account)
            .setTicker(content.summary)
            .setGroup(groupKey)
            .setContentTitle(content.sender)
            .setContentText(content.subject)
            .setSubText(accountName);

    NotificationCompat.BigTextStyle style = createBigTextStyle(builder);
    style.bigText(content.preview);

    builder.setStyle(style);

    PendingIntent contentIntent = actionCreator.createViewMessagePendingIntent(
            content.messageReference, notificationId);
    builder.setContentIntent(contentIntent);

    return builder;
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:25,代碼來源:BaseNotifications.java

示例6: testCreateBigTextStyleNotification

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
@Test
public void testCreateBigTextStyleNotification() throws Exception {
    Account account = createFakeAccount();
    int notificationId = 23;
    NotificationHolder holder = createNotificationHolder(notificationId);

    Builder builder = notifications.createBigTextStyleNotification(account, holder, notificationId);

    verify(builder).setTicker(NOTIFICATION_SUMMARY);
    verify(builder).setGroup("newMailNotifications-" + ACCOUNT_NUMBER);
    verify(builder).setContentTitle(SENDER);
    verify(builder).setContentText(SUBJECT);
    verify(builder).setSubText(ACCOUNT_NAME);

    BigTextStyle bigTextStyle = notifications.bigTextStyle;
    verify(bigTextStyle).bigText(NOTIFICATION_PREVIEW);

    verify(builder).setStyle(bigTextStyle);
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:20,代碼來源:BaseNotificationsTest.java

示例7: displayOpenFileNotification

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
private void displayOpenFileNotification() {
    Intent notificationIntent = getOpenIntent();
    int icon =  R.mipmap.video2;
    CharSequence title = getResources().getText(R.string.open_file);
    long when = System.currentTimeMillis();
    PendingIntent contentIntent = PendingIntent.getBroadcast(this, 0, notificationIntent, 0);
    Builder notificationBuilder = new NotificationCompat.Builder(this);
    notificationBuilder.setSmallIcon(icon);
    notificationBuilder.setTicker(null);
    notificationBuilder.setOnlyAlertOnce(true);
    notificationBuilder.setContentTitle(title);
    notificationBuilder.setContentText(mProcessedFiles.get(0).getName());
    notificationBuilder.setContentIntent(contentIntent);
    notificationBuilder.setWhen(when);
    notificationBuilder.setDefaults(0); // no sound, no light, no vibrate
    mNotificationManager.notify(OPEN_NOTIFICATION_ID, notificationBuilder.build());
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:18,代碼來源:FileManagerService.java

示例8: download

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
private void download(UpdateInfo info) {
    if (info == null || TextUtils.isEmpty(info.apk_url) || TextUtils.isEmpty(info.new_md5)) {
        stopSelf();
        return;
    }
    File folder = UpdateUtil.getUpdateDir(this);
    String title = info.new_md5 + ShareConstants.PATCH_SUFFIX;
    DownloadRequest request = new DownloadRequest.Builder().setTitle(title).setFolder(folder)
            .setUri(info.apk_url).build();
    File downloadFile = new File(folder, title);
    Builder builder = new Builder(this);
    builder.setSmallIcon(17301633).setContentTitle("薄荷").setContentText("開始下載").setProgress
            (100, 0, true).setTicker("正在下載薄荷");
    startForeground(4096, builder.build());
    this.sDownloadManager.download(request, info.apk_url, new UpdateDownloadCallback(this,
            downloadFile, info, builder));
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:UpdateService.java

示例9: initNotification

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
private void initNotification() {
    if (StepsPreference.isStepNotificationOpen()) {
        this.showTaskIntent = new Intent(getApplicationContext(), MainActivity.class);
        this.showTaskIntent.setAction("android.intent.action.MAIN");
        this.showTaskIntent.addCategory("android.intent.category.LAUNCHER");
        this.showTaskIntent.addFlags(268435456);
        this.contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, this
                .showTaskIntent, 134217728);
        this.builder = new Builder(getApplicationContext()).setContentTitle(getString(R
                .string.a78)).setWhen(System.currentTimeMillis()).setContentIntent(this
                .contentIntent).setLargeIcon(BitmapFactory.decodeResource(getResources(), R
                .drawable.icon));
        if (VERSION.SDK_INT >= 21) {
            this.builder.setColor(ContextCompat.getColor(this, R.color.hb)).setSmallIcon(R
                    .drawable.qm);
        } else {
            this.builder.setSmallIcon(R.drawable.icon);
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:21,代碼來源:StepCounterService.java

示例10: init

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
private void init() {
    this.mActivity = this;
    this.mNotificationManager = (NotificationManager) getSystemService("notification");
    this.mNFBuilder = new Builder(this.ctx);
    this.group_id = getIntExtra(Const.GROUP_ID);
    ArrayList<String> tempList = getIntent().getStringArrayListExtra(KEY_SELECTED_PICTURES);
    if (tempList != null && tempList.size() > 0) {
        this.mSelectPictures.clear();
        this.mSelectPictures.addAll(0, tempList);
        this.mSelectPictures.add("add");
    }
    initSendApi();
    if (getIntent() != null) {
        this.attachMent = (AttachMent) getIntent().getParcelableExtra(EXTRA_ATTACHMENT);
    }
    restoreDraft();
    initPicGridView();
    if (this.attachMent != null) {
        this.attachmentLayout.setVisibility(0);
        this.imageLoader.displayImage(this.attachMent.pic, this.ivAttachment);
        this.tvAttachment.setText(this.attachMent.title);
    }
    initEmoji();
    handlePictureURL();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:26,代碼來源:StatusPostTextActivity.java

示例11: createForegroundNotification

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
public Notification createForegroundNotification() {
	final NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService);

	mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.conversations_foreground_service));
	if (Config.SHOW_CONNECTED_ACCOUNTS) {
		List<Account> accounts = mXmppConnectionService.getAccounts();
		int enabled = 0;
		int connected = 0;
		for (Account account : accounts) {
			if (account.isOnlineAndConnected()) {
				connected++;
				enabled++;
			} else if (!account.isOptionSet(Account.OPTION_DISABLED)) {
				enabled++;
			}
		}
		mBuilder.setContentText(mXmppConnectionService.getString(R.string.connected_accounts, connected, enabled));
	} else {
		mBuilder.setContentText(mXmppConnectionService.getString(R.string.touch_to_open_conversations));
	}
	mBuilder.setContentIntent(createOpenConversationsIntent());
	mBuilder.setWhen(0);
	mBuilder.setPriority(Config.SHOW_CONNECTED_ACCOUNTS ? NotificationCompat.PRIORITY_DEFAULT : NotificationCompat.PRIORITY_MIN);
	mBuilder.setSmallIcon(R.drawable.ic_link_white_24dp);
	return mBuilder.build();
}
 
開發者ID:syntafin,項目名稱:TenguChat,代碼行數:27,代碼來源:NotificationService.java

示例12: buildSummary

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
public Notification buildSummary(Context context, NotificationManager manager, String group, List<NotificationMessage> messages) {
    NotificationCompat.WearableExtender extender = new NotificationCompat.WearableExtender();

    Intent intent = new Intent(context, NotificationIntentService.class);
    manager.setCancelAll(intent, group);
    intent.setData(Uri.parse("nuclei://notifications?_g=" + group));
    PendingIntent pendingIntent = PendingIntent.getService(context, getDeleteIntentRequestId(), intent, PendingIntent.FLAG_UPDATE_CURRENT);

    Builder builder = new Builder(context)
            .setSmallIcon(manager.getDefaultSmallIcon())
            .setLargeIcon(manager.getDefaultLargeIcon())
            .setAutoCancel(true)
            .setGroup(group)
            .setGroupSummary(true);

    onBuildSummary(context, manager, builder, extender, group, messages);

    builder.setDeleteIntent(pendingIntent);

    extender.extend(builder);

    return builder.build();
}
 
開發者ID:lifechurch,項目名稱:nuclei-android,代碼行數:24,代碼來源:NotificationBuilder.java

示例13: buildNotification

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
public Notification buildNotification(Context context, NotificationManager manager, NotificationMessage message, List<NotificationMessage> messages) {
    NotificationCompat.WearableExtender extender = new NotificationCompat.WearableExtender();

    Intent intent = new Intent(context, NotificationIntentService.class);
    manager.setCancelMessage(intent, message);
    intent.setData(Uri.parse("nuclei://notifications?_id=" + message._id + "&_g=" + message.groupKey));
    PendingIntent pendingIntent = PendingIntent.getService(context, getDeleteIntentRequestId(), intent, PendingIntent.FLAG_UPDATE_CURRENT);

    Builder builder = new Builder(context)
            .setSmallIcon(manager.getDefaultSmallIcon())
            .setLargeIcon(manager.getDefaultLargeIcon())
            .setOngoing(false)
            .setAutoCancel(true);

    if (messages.size() > 1) {
        builder.setGroup(message.groupKey).setGroupSummary(false);
    }

    onBuildNotification(context, manager, builder, extender, message);

    builder.setDeleteIntent(pendingIntent);

    extender.extend(builder);

    return builder.build();
}
 
開發者ID:lifechurch,項目名稱:nuclei-android,代碼行數:27,代碼來源:NotificationBuilder.java

示例14: createSimpleSummaryNotification

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
private NotificationCompat.Builder createSimpleSummaryNotification(Account account, int unreadMessageCount) {
    String accountName = controller.getAccountName(account);
    CharSequence newMailText = context.getString(R.string.notification_new_title);
    String unreadMessageCountText = context.getString(R.string.notification_new_one_account_fmt,
            unreadMessageCount, accountName);

    int notificationId = NotificationIds.getNewMailSummaryNotificationId(account);
    PendingIntent contentIntent = actionCreator.createViewFolderListPendingIntent(account, notificationId);

    return createAndInitializeNotificationBuilder(account)
            .setNumber(unreadMessageCount)
            .setTicker(newMailText)
            .setContentTitle(unreadMessageCountText)
            .setContentText(newMailText)
            .setContentIntent(contentIntent);
}
 
開發者ID:scoute-dich,項目名稱:K9-MailClient,代碼行數:17,代碼來源:DeviceNotifications.java

示例15: if

import android.support.v4.app.NotificationCompat.Builder; //導入依賴的package包/類
private void showStorageFullAlertOrNotification$fb5dc8d(String paramString1, String paramString2, String paramString3, String paramString4, boolean paramBoolean)
{
  if ((this.mListener != null) && (!this.mListener.shouldShowAppNotification$14e1ec69(paramString1)))
  {
    if (FinskyApp.get().getExperiments().isEnabled(12603367L))
    {
      this.mListener.showAppAlert(paramString1, paramString3, paramString4, 3);
      return;
    }
    if (paramBoolean) {}
    for (int i = 47;; i = 48)
    {
      ErrorDialog.Builder localBuilder = (ErrorDialog.Builder)((ErrorDialog.Builder)((ErrorDialog.Builder)((ErrorDialog.Builder)((ErrorDialog.Builder)((ErrorDialog.Builder)new ErrorDialog.Builder().setTitle(paramString3)).setMessageHtml(paramString4)).setPositiveId(2131362841)).setNegativeId(2131361915)).setCallback(null, i, null)).setEventLog(324, null, 2904, 2903, null);
      this.mListener.showAppAlert(paramString1, localBuilder);
      return;
    }
  }
  showAppNotificationOnly$1f519fb9(paramString1, paramString2, paramString3, paramString4, -1, "err");
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:20,代碼來源:NotificationManager.java


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