微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.support.v4.app.NotificationCompat.BigTextStyle的实例源码

项目:q-mail    文件BaseNotifications.java   
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;
}
项目:q-mail    文件AuthenticationErrorNotifications.java   
public void showAuthenticationErrorNotification(Account account,boolean incoming) {
    int notificationId = NotificationIds.getAuthenticationErrorNotificationId(account,incoming);
    Context context = controller.getContext();

    PendingIntent editServerSettingsPendingIntent = createContentIntent(context,account,incoming);
    String title = context.getString(R.string.notification_authentication_error_title);
    String text = context.getString(R.string.notification_authentication_error_text,account.getDescription());

    NotificationCompat.Builder builder = controller.createNotificationBuilder()
            .setSmallIcon(R.drawable.notification_icon_warning)
            .setWhen(System.currentTimeMillis())
            .setAutoCancel(true)
            .setTicker(title)
            .setContentTitle(title)
            .setContentText(text)
            .setContentIntent(editServerSettingsPendingIntent)
            .setStyle(new BigTextStyle().bigText(text))
            .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
            .setCategory(NotificationCompat.CATEGORY_ERROR);

    controller.configureNotification(builder,null,NOTIFICATION_LED_FAILURE_COLOR,NOTIFICATION_LED_BLINK_FAST,true);

    getnotificationmanager().notify(notificationId,builder.build());
}
项目:q-mail    文件BaseNotificationsTest.java   
@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);
}
项目:K9-MailClient    文件BaseNotifications.java   
protected NotificationCompat.Builder createBigTextStyleNotification(Account account,notificationId);
    builder.setContentIntent(contentIntent);

    return builder;
}
项目:K9-MailClient    文件AuthenticationErrorNotifications.java   
public void showAuthenticationErrorNotification(Account account,builder.build());
}
项目:K9-MailClient    文件BaseNotificationsTest.java   
@Test
public void testCreateBigTextStyleNotification() throws Exception {
    Account account = createFakeAccount();
    int notificationId = 23;
    NotificationHolder holder = createNotificationHolder(notificationId);

    Builder builder = notifications.createBigTextStyleNotification(account,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);
}
项目:dashbar    文件NotificationService.java   
/**
 * Updated the notification data copy and also updates the notification in the notification
 * shade.
 * <br />
 * All the extension data is consumed and used for building the notification. The title of the
 * extension data becomes the notification's title,the body of the extension data becomes the
 * notification's content,the click intent of the extension data becomes the notification's
 * click intent,the icon of the extension data becomes the notification's icon and the status
 * of the extension data becomes the notifications info only if the status does not match the
 * title or the body (to prevent redundant @R_778_4045@ion cluttering up the notification.)
 *
 * @param component the component name of the extension
 * @param data      the data passed from the extension
 */
@SuppressWarnings("deprecation")
private void update(ComponentName component,ExtensionData data) {
    if (data != null && data.visible()) {

        int colour = getResources().getColor(R.color.notification_color);
        NotificationCompat.Builder notification = new NotificationCompat.Builder(this);
        notification.setColor(colour);
        notification.setCategory(NotificationCompat.CATEGORY_SERVICE);
        notification.setPriority(Integer.MIN_VALUE);
        notification.setonlyAlertOnce(true);
        notification.setongoing(true);
        notification.setShowWhen(true);

        PendingIntent click = PendingIntent.getActivity(getApplicationContext(),data.clickIntent(),0);
        Bitmap icon = Utils.loadExtensionIcon(getApplicationContext(),component,data.icon(),colour);
        notification.setStyle(new BigTextStyle().bigText(data.expandedBody()));
        notification.setSmallIcon(R.drawable.ic_notification);
        notification.setContentTitle(data.expandedTitle());
        notification.setContentText(data.expandedBody());
        notification.setGroup("dashbar");

        if (data.status() != null && !data.status().equalsIgnoreCase(data.expandedBody())
                && !data.status().equalsIgnoreCase(data.expandedTitle())) {
            notification.setContentInfo(data.status());
        }
        notification.setContentIntent(click);
        notification.setLargeIcon(icon);
        mNotifier.notify(component.getPackageName(),1,notification.build());
    }
}
项目:intellij-ce-playground    文件NotificationGenerator.java   
private static void generateStyle(NotificationCompat.Builder builder) {
    Integer styleValue = STYLE.getValueInt();

    if (STYLE_BIG_PICTURE.equals(styleValue)) {
        BigPictureStyle bigPicture = new NotificationCompat.BigPictureStyle();
        if (PICTURE.hasValue())
            bigPicture.bigPicture(PICTURE.getValueBitmap());
        if (BIG_CONTENT_TITLE.hasValue())
            bigPicture.setBigContentTitle(BIG_CONTENT_TITLE.getValueString());
        if (SUMMARY_TEXT.hasValue())
            bigPicture.setSummaryText(SUMMARY_TEXT.getValueString());
        builder.setStyle(bigPicture);
    } else if (STYLE_BIG_TEXT.equals(styleValue)) {
        BigTextStyle bigText = new NotificationCompat.BigTextStyle();
        if (BIG_TEXT.hasValue())
            bigText.bigText(BIG_TEXT.getValueString());
        if (BIG_CONTENT_TITLE.hasValue())
            bigText.setBigContentTitle(BIG_CONTENT_TITLE.getValueString());
        if (SUMMARY_TEXT.hasValue())
            bigText.setSummaryText(SUMMARY_TEXT.getValueString());
        builder.setStyle(bigText);
    } else if (STYLE_INBox.equals(styleValue)) {
        InBoxStyle inBoxStyle = new NotificationCompat.InBoxStyle();
        if (LInes.hasValue()) {
            for (String line : LInes.getValueString().split("\\n")) {
                inBoxStyle.addLine(line);
            }
        }
        if (BIG_CONTENT_TITLE.hasValue())
            inBoxStyle.setBigContentTitle(BIG_CONTENT_TITLE.getValueString());
        if (SUMMARY_TEXT.hasValue())
            inBoxStyle.setSummaryText(SUMMARY_TEXT.getValueString());
        builder.setStyle(inBoxStyle);
    }
}
项目:cusnews    文件MyGcmListenerService.java   
private void fallbackNotify( long id,String title,String desc,PendingIntent contentIntent,PendingIntent sharePi,PendingIntent facebookPi ) {
    mNotifyBuilder = new NotificationCompat.Builder( this ).setWhen( id ).setSmallIcon( R.drawable.ic_push_notify ).setTicker( title )
            .setContentTitle( title ).setContentText( desc ).setStyle( new BigTextStyle().bigText( desc ).setBigContentTitle( title ) )
            .setAutoCancel( true ).addAction( R.drawable.ic_action_social_share,getString( R.string.action_share ),sharePi ).addAction(
                    R.drawable.ic_stat_f,getString( R.string.action_fb ),facebookPi );
    mNotifyBuilder.setContentIntent( contentIntent );
    mnotificationmanager.notify( Utils.randInt( 1,9999 ),mNotifyBuilder.build() );
}
项目:AndroidWearNotification    文件MainActivity.java   
private void MorePagesWearNotificationView() {

        // Create builder for the main notification
        Intent viewIntent = new Intent(this,SpecialActivity.class);
        PendingIntent viewPendingIntent = PendingIntent.getActivity(this,viewIntent,0);

        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.ic_launcher).setContentTitle("第一页")
                .setContentText("亲,还有第二页噢").setContentIntent(viewPendingIntent);

        // Create a big text style for the second page
        BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle();
        secondPageStyle.setBigContentTitle("第二页").bigText(
                "这是一段很长的Text,用来测试用!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");

        // Create second page notification
        Notification secondPageNotification = new NotificationCompat.Builder(this).setStyle(
                secondPageStyle).build();

        // Add second page with wearable extender and extend the main
        // notification
        Notification twoPageNotification = new WearableExtender().addPage(secondPageNotification)
                .extend(notificationBuilder).build();

        // Issue the notification
        notificationmanagerCompat notificationmanager = notificationmanagerCompat.from(this);
        notificationmanager.notify(NOTIFICATION_ID_5,twoPageNotification);
        manager.cancel(NOTIFICATION_ID_4);

        manager.cancel(NOTIFICATION_ID_6);
        manager.cancel(NOTIFICATION_ID_3);
        manager.cancel(NOTIFICATION_ID_2);
        manager.cancel(NOTIFICATION_ID_1);

    }
项目:AndroidWearNotification    文件MainActivity.java   
private void BigWearNotificationView() {
    Intent mapIntent = new Intent(Intent.ACTION_VIEW);
    // 添加一个在地图上查看事件位置的action
    String location = "Beijing";
    Uri geoUri = Uri.parse("geo:0,0?q=" + Uri.encode(location));
    mapIntent.setData(geoUri);
    PendingIntent mapPendingIntent = PendingIntent.getActivity(this,mapIntent,0);

    BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
    bigStyle.bigText("这是一个很长的text,用来做测试用!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher)
            .setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher))
            .setContentTitle("消息标题").setContentText("消息正文").setContentIntent(mapPendingIntent)
            .addAction(R.drawable.ic_launcher,getString(R.string.map),mapPendingIntent)
            .setStyle(bigStyle);

    notificationmanagerCompat notificationmanager = notificationmanagerCompat.from(this);
    notificationmanager.notify(NOTIFICATION_ID_4,notificationBuilder.build());
    manager.cancel(NOTIFICATION_ID_3);
    manager.cancel(NOTIFICATION_ID_5);

    manager.cancel(NOTIFICATION_ID_6);
    manager.cancel(NOTIFICATION_ID_2);
    manager.cancel(NOTIFICATION_ID_1);
}
项目:schautup    文件App.java   
/**
 * Get the {@link android.support.v4.app.NotificationCompat.Builder} of {@link android.app.Notification}.
 *
 * @param cxt
 *      {@link android.content.Context}.
 * @param ticker
 *      Text shows on notification.
 * @param smallIcon
 *      Icon for the notification.
 * @param contentTitle
 *      Text shows above the content.
 * @param content
 *      Text shows when expand notification.
 * @param id
 *      The id of this notification.
 * @param bigText
 *      Some more @R_778_4045@ion.
 *
 * @return A {@link android.support.v4.app.NotificationCompat.Builder}.
 */
private static NotificationCompat.Builder buildNotificationCommon(Context cxt,String ticker,@DrawableRes int smallIcon,String contentTitle,String content,int id,String bigText) {
    NotificationCompat.Builder builder = new NotificationCompat.Builder(cxt).setWhen(System.currentTimeMillis())
            .setTicker(ticker).setAutoCancel(true).setSmallIcon(smallIcon).setLargeIcon(
                    BitmapFactory.decodeResource(cxt.getResources(),R.drawable.ic_action_logo)).setContentIntent(
                    createMainPendingIntent(cxt,id)).setContentTitle(contentTitle).setContentText(content);

    AudioManager audioManager = (AudioManager) cxt.getSystemService(Context.AUdio_SERVICE);
    if (audioManager.getRingerMode() == RINGER_MODE_VIBRATE) {
        builder.setVibrate(new long[] { 1000,1000,1000 });
    }
    if (audioManager.getRingerMode() == RINGER_MODE_norMAL) {
        builder.setSound(Uri.parse(String.format("android.resource://%s/%s",cxt.getPackageName(),R.raw.sound_bell)));
    }
    builder.setLights(Color.BLUE,3000,3000);

    if (!TextUtils.isEmpty(bigText)) {
        BigTextStyle inBoxStyle = new NotificationCompat.BigTextStyle();
        inBoxStyle.setBigContentTitle(contentTitle);
        inBoxStyle.bigText(bigText);
        inBoxStyle.setSummaryText(content);
        builder.setStyle(inBoxStyle);
    }
    return builder;
}
项目:wearable    文件MainActivity.java   
void bigTextNoti() {
    //create the intent to launch the notiactivity,then the pentingintent.
    Intent viewIntent = new Intent(this,NotiActivity.class);
    viewIntent.putExtra("NotiID","Notification ID is " + notificationID);

    PendingIntent viewPendingIntent =
            PendingIntent.getActivity(this,0);

    BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
    bigStyle.bigText("Big text style.\n"
            + "We should have more room to add text for the user to read,instead of a short message.");


    //Now create the notification.  We must use the NotificationCompat or it will not work on the wearable.
    NotificationCompat.Builder notificationBuilder =
            new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle("Simple Noti")
            .setContentText("This is a simple notification")
            .setContentIntent(viewPendingIntent)
            .setStyle(bigStyle);

    // Get an instance of the notificationmanager service
    notificationmanagerCompat notificationmanager =
            notificationmanagerCompat.from(this);

    // Build the notification and issues it with notification manager.
    notificationmanager.notify(notificationID,notificationBuilder.build());
    notificationID++;
}
项目:wearable    文件MainActivity.java   
void bigTextNoti() {
    //create the intent to launch the notiactivity,"Notification ID is " + notificationID);

    PendingIntent viewPendingIntent =
        PendingIntent.getActivity(this,0);

    BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
    bigStyle.bigText("Big text style.\n"
        + "We should have more room to add text for the user to read,instead of a short message.");


    //Now create the notification.  We must use the NotificationCompat or it will not work on the wearable.
    NotificationCompat.Builder notificationBuilder =
        new NotificationCompat.Builder(this,id)
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle("Simple Noti")
            .setContentText("This is a simple notification")
            .setContentIntent(viewPendingIntent)
            .setChannelId(id)
            .setStyle(bigStyle);

    // Get an instance of the notificationmanager service
    notificationmanagerCompat notificationmanager =
        notificationmanagerCompat.from(this);

    // Build the notification and issues it with notification manager.
    notificationmanager.notify(notificationID,notificationBuilder.build());
    notificationID++;
}
项目:q-mail    文件BaseNotifications.java   
protected BigTextStyle createBigTextStyle(Builder builder) {
    return new BigTextStyle(builder);
}
项目:q-mail    文件DeviceNotificationsTest.java   
@Override
protected BigTextStyle createBigTextStyle(Builder builder) {
    return bigTextStyle;
}
项目:q-mail    文件BaseNotificationsTest.java   
protected TestNotifications(NotificationController controller,NotificationActionCreator actionCreator) {
    super(controller,actionCreator);
    bigTextStyle = mock(BigTextStyle.class);
}
项目:q-mail    文件BaseNotificationsTest.java   
@Override
protected BigTextStyle createBigTextStyle(Builder builder) {
    return bigTextStyle;
}
项目:K9-MailClient    文件BaseNotifications.java   
protected BigTextStyle createBigTextStyle(Builder builder) {
    return new BigTextStyle(builder);
}
项目:K9-MailClient    文件DeviceNotificationsTest.java   
@Override
protected BigTextStyle createBigTextStyle(Builder builder) {
    return bigTextStyle;
}
项目:K9-MailClient    文件BaseNotificationsTest.java   
protected TestNotifications(NotificationController controller,actionCreator);
    bigTextStyle = mock(BigTextStyle.class);
}
项目:K9-MailClient    文件BaseNotificationsTest.java   
@Override
protected BigTextStyle createBigTextStyle(Builder builder) {
    return bigTextStyle;
}
项目:TextSecure    文件MessageNotifier.java   
private static void sendSingleThreadNotification(Context context,MasterSecret masterSecret,NotificationState notificationState,boolean signal)
{
  if (notificationState.getNotifications().isEmpty()) {
    ((notificationmanager)context.getSystemService(Context.NOTIFICATION_SERVICE))
        .cancel(NOTIFICATION_ID);
    return;
  }

  List<NotificationItem>notifications = notificationState.getNotifications();
  NotificationCompat.Builder builder  = new NotificationCompat.Builder(context);
  Recipient recipient                 = notifications.get(0).getIndividualRecipient();

  builder.setSmallIcon(R.drawable.icon_notification);
  builder.setLargeIcon(recipient.getContactPhoto());
  builder.setContentTitle(recipient.toShortString());
  builder.setContentText(notifications.get(0).getText());
  builder.setContentIntent(notifications.get(0).getPendingIntent(context));
  builder.setContentInfo(String.valueOf(notificationState.getMessageCount()));
  builder.setNumber(notificationState.getMessageCount());
  builder.setDeleteIntent(PendingIntent.getbroadcast(context,new Intent(DeleteReceiver.DELETE_REMINDER_ACTION),0));

  if (masterSecret != null) {
    builder.addAction(R.drawable.check,context.getString(R.string.MessageNotifier_mark_as_read),notificationState.getMarkAsReadIntent(context,masterSecret));
  }

  SpannableStringBuilder content = new SpannableStringBuilder();

  ListIterator<NotificationItem> iterator = notifications.listIterator(notifications.size());
  while(iterator.hasPrevIoUs()) {
    NotificationItem item = iterator.prevIoUs();
    content.append(item.getBigStyleSummary());
    content.append('\n');
  }

  builder.setStyle(new BigTextStyle().bigText(content));

  setNotificationAlarms(context,builder,signal);

  if (signal) {
    builder.setTicker(notifications.get(0).getTickerText());
  }

  ((notificationmanager)context.getSystemService(Context.NOTIFICATION_SERVICE))
    .notify(NOTIFICATION_ID,builder.build());
}
项目:FMTech    文件notificationmanager.java   
private void showNewNotification(final String paramString1,String paramString2,final String paramString3,final String paramString4,String paramString5,int paramInt1,Bitmap paramBitmap,int paramInt2,final Intent paramIntent1,boolean paramBoolean1,Intent paramIntent2,boolean paramBoolean2,String paramString6,Intent paramIntent3,String paramString7,int paramInt3,int paramInt4,NotificationCompat.Action paramAction)
{
  final NotificationCompat.Builder localBuilder = new NotificationCompat.Builder(this.mContext).setTicker(paramString2).setContentTitle(paramString3).setContentText(paramString4);
  localBuilder.mCategory = paramString6;
  localBuilder.mVisibility = 0;
  localBuilder.mLocalOnly = true;
  if (!TextUtils.isEmpty(paramString5)) {
    localBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(paramString5));
  }
  localBuilder.setSmallIcon(paramInt1);
  if (paramBitmap != null) {
    localBuilder.mLargeIcon = paramBitmap;
  }
  if (paramInt2 > 0) {
    localBuilder.mNumber = paramInt2;
  }
  localBuilder.mColor = paramInt3;
  localBuilder.mPriority = paramInt4;
  if (paramAction != null) {
    localBuilder.mActions.add(paramAction);
  }
  final int i = getNotificationId(paramString1);
  PendingIntent localPendingIntent1;
  if (!paramBoolean1)
  {
    localPendingIntent1 = PendingIntent.getActivity(this.mContext,i,paramIntent1,1342177280);
    localBuilder.mContentIntent = localPendingIntent1;
    if (paramIntent2 != null)
    {
      PendingIntent localPendingIntent3 = PendingIntent.getbroadcast(this.mContext,paramIntent2,1342177280);
      localBuilder.mNotification.deleteIntent = localPendingIntent3;
    }
    if ((paramIntent3 != null) && (!TextUtils.isEmpty(paramString7)))
    {
      PendingIntent localPendingIntent2 = PendingIntent.getbroadcast(this.mContext,paramIntent3,1342177280);
      localBuilder.mActions.add(new NotificationCompat.Action(2130838134,paramString7,localPendingIntent2));
    }
    if (!paramBoolean2) {
      break label316;
    }
    localBuilder.setFlag(2,true);
  }
  for (;;)
  {
    RestrictedDeviceHelper.isLimitedOrSchoolEduUser(new RestrictedDeviceHelper.OnCompleteListener()
    {
      public final void onComplete(boolean paramAnonymousBoolean)
      {
        if (!paramAnonymousBoolean) {
          this.val$mgr.notify(i,localBuilder.build());
        }
        if (!paramAnonymousBoolean) {}
        for (boolean bool = true;; bool = false)
        {
          notificationmanager.access$100(bool,paramString1,paramString3,paramString4,paramIntent1);
          return;
        }
      }
    });
    return;
    localPendingIntent1 = PendingIntent.getbroadcast(this.mContext,1342177280);
    break;
    label316:
    localBuilder.setAutoCancel$7abcb88d();
  }
}
项目:TextSecureSMP    文件MessageNotifier.java   
private static void sendSingleThreadNotification(Context context,boolean signal)
{
  if (notificationState.getNotifications().isEmpty()) {
    ((notificationmanager)context.getSystemService(Context.NOTIFICATION_SERVICE))
        .cancel(NOTIFICATION_ID);
    return;
  }

  List<NotificationItem>     notifications       = notificationState.getNotifications();
  NotificationCompat.Builder builder             = new NotificationCompat.Builder(context);
  Recipient                  recipient           = notifications.get(0).getIndividualRecipient();
  Drawable                   recipientPhoto      = recipient.getContactPhoto();
  int                        largeIconTargetSize = context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size);

  if (recipientPhoto != null) {
    Bitmap recipientPhotoBitmap = BitmapUtil.createFromDrawable(recipientPhoto,largeIconTargetSize,largeIconTargetSize);
    if (recipientPhotoBitmap != null) builder.setLargeIcon(recipientPhotoBitmap);
  }

  builder.setSmallIcon(R.drawable.icon_notification);
  builder.setColor(context.getResources().getColor(R.color.textsecure_primary));
  builder.setContentTitle(recipient.toShortString());
  builder.setContentText(notifications.get(0).getText());
  builder.setContentIntent(notifications.get(0).getPendingIntent(context));
  builder.setContentInfo(String.valueOf(notificationState.getMessageCount()));
  builder.setPriority(NotificationCompat.PRIORITY_HIGH);
  builder.setNumber(notificationState.getMessageCount());
  builder.setCategory(NotificationCompat.CATEGORY_MESSAGE);
  builder.setDeleteIntent(PendingIntent.getbroadcast(context,0));
  if (recipient.getContactUri() != null) builder.addPerson(recipient.getContactUri().toString());

  long timestamp = notifications.get(0).getTimestamp();
  if (timestamp != 0) builder.setWhen(timestamp);

  if (masterSecret != null) {
    Action markAsReadAction = new Action(R.drawable.check,masterSecret));
    builder.addAction(markAsReadAction);
    builder.extend(new NotificationCompat.WearableExtender().addAction(markAsReadAction));
  }

  SpannableStringBuilder content = new SpannableStringBuilder();

  ListIterator<NotificationItem> iterator = notifications.listIterator(notifications.size());
  while(iterator.hasPrevIoUs()) {
    NotificationItem item = iterator.prevIoUs();
    content.append(item.getBigStyleSummary());
    content.append('\n');
  }

  builder.setStyle(new BigTextStyle().bigText(content));

  setNotificationAlarms(context,signal,notificationState.getringtone(),notificationState.getVibrate());

  if (signal) {
    builder.setTicker(notifications.get(0).getTickerText());
  }

  ((notificationmanager)context.getSystemService(Context.NOTIFICATION_SERVICE))
    .notify(NOTIFICATION_ID,builder.build());
}
项目:Ti.NotificationFactory    文件BigTextStyleProxy.java   
public BigTextStyleProxy() {
    super();
    style = new BigTextStyle();
}
项目:Ti.NotificationFactory    文件BigTextStyleProxy.java   
@Kroll.method @Kroll.setProperty
public void setBigText(String cs) {
    ((BigTextStyle)style).bigText(cs);      
    setProperty(NotificationfactoryModule.PROPERTY_BIG_TEXT,cs);
}
项目:Ti.NotificationFactory    文件BigTextStyleProxy.java   
@Kroll.method @Kroll.setProperty
public void setBigContentTitle(String title) {      
    ((BigTextStyle)style).setBigContentTitle(title);    
    setProperty(NotificationfactoryModule.PROPERTY_BIG_CONTENT_TITLE,title);
}
项目:Ti.NotificationFactory    文件BigTextStyleProxy.java   
@Kroll.method @Kroll.setProperty
public void setSummaryText(String cs) { 
    ((BigTextStyle)style).setSummaryText(cs);
    setProperty(NotificationfactoryModule.PROPERTY_SUMMARY_TEXT,cs);
}
项目:Securecom-Messaging    文件MessageNotifier.java   
private static void sendSingleThreadNotification(Context context,boolean signal)
{
  if (notificationState.getNotifications().isEmpty()) {
    ((notificationmanager)context.getSystemService(Context.NOTIFICATION_SERVICE))
        .cancel(NOTIFICATION_ID);
    return;
  }

  List<NotificationItem>notifications = notificationState.getNotifications();
  NotificationCompat.Builder builder  = new NotificationCompat.Builder(context);
  Recipient recipient                 = notifications.get(0).getIndividualRecipient();

  builder.setSmallIcon(R.drawable.icon_notification);
  builder.setLargeIcon(recipient.getContactPhoto());
  builder.setContentTitle(recipient.toShortString());
  builder.setContentText(notifications.get(0).getText());
  builder.setContentIntent(notifications.get(0).getPendingIntent(context));
  builder.setContentInfo(String.valueOf(notificationState.getMessageCount()));
  builder.setNumber(notificationState.getMessageCount());

  if (masterSecret != null) {
    builder.addAction(R.drawable.check,masterSecret));
  }

  SpannableStringBuilder content = new SpannableStringBuilder();

  for (NotificationItem item : notifications) {
    content.append(item.getBigStyleSummary());
    content.append('\n');
  }

  builder.setStyle(new BigTextStyle().bigText(content));

  setNotificationAlarms(context,builder.build());
}
项目:Securecom-Text    文件MessageNotifier.java   
private static void sendSingleThreadNotification(Context context,builder.build());
}
项目:Chitchat    文件RecipientsActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    requestwindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recipients);
    getActionBar().setHomeButtonEnabled(true);
    //mSearch = (EditText)findViewById(R.id.etsearch);
    //mSearch.setVisibility(View.GONE);
    Uri soundUri = ringtoneManager.getDefaultUri(ringtoneManager.TYPE_NOTIFICATION);;
    Intent resultIntent = new Intent(this,ChatsActivity.class);
    PendingIntent resultPendingIntent =
            PendingIntent.getActivity(
            this,resultIntent,PendingIntent.FLAG_UPDATE_CURRENT
        );
    Calendar cal = Calendar.getInstance();              
    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setType("vnd.android.cursor.item/event");
    intent.putExtra("beginTime",cal.getTimeInMillis()+60*60*1000);
    intent.putExtra("allDay",false);
    intent.putExtra("rrule","FREQ=DAILY");
    intent.putExtra("endTime",cal.getTimeInMillis()+2*60*60*1000);
    intent.putExtra("title","Remember to check your inBox !");
    //startActivity(intent);
    PendingIntent actionPendingIntent =
            PendingIntent.getActivity(this,intent,PendingIntent.FLAG_UPDATE_CURRENT);
    NotificationCompat.Action action =
            new NotificationCompat.Action.Builder(R.drawable.notifications,getString(R.string.remind_me),actionPendingIntent)
                    .build();
    BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
    bigStyle.bigText("New chit !");
    mNotifBuilder = new NotificationCompat.Builder(
            this).setSmallIcon(R.drawable.ic_stat_ic_action_send_Now)
            .setContentTitle("Chitchat").setContentText("Your message has been sent !").extend(new WearableExtender().addAction(action)).setSound(soundUri).setStyle(bigStyle).setAutoCancel(true);;
    mNotifBuilder.setContentIntent(resultPendingIntent);
    mNotifyMgr = (notificationmanager) getSystemService(NOTIFICATION_SERVICE);
    mRecipientsList = (ListView)findViewById(R.id.recipient_list);
    mRecipientsList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    //mRecipientsGrid = (GridView) findViewById(R.id.friends_grid);
    mEmptyText = (TextView) findViewById(R.id.empty_state_text);
    mEmptyImage = (ImageView) findViewById(R.id.empty_state_image);
    //mRecipientsGrid.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE);
    mMediaUri = getIntent().getData();
    mFileType = getIntent().getExtras().getString(Constants.FILE_TYPE);
    /*mRecipientsGrid.setonItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent,View view,int position,long id) {
            // Todo Auto-generated method stub
            ImageView mCheckImage = (ImageView)findViewById(R.id.user_image_check); 
            if (mRecipientsGrid.getCheckedItemCount() > 0) {
                mSend.setVisible(true);
                mCheckImage.setVisibility(View.VISIBLE);

            } else {
                mSend.setVisible(false);
                mCheckImage.setVisibility(View.INVISIBLE);
            }
        }
    });*/
    mRecipientsList.setonItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent,long id) {
            // Todo Auto-generated method stub
            if (mRecipientsList.getCheckedItemCount() > 0) {
                mSend.setVisible(true);
            } else {
                mSend.setVisible(false);
            }
        }
    });

}
项目:QuickLyric    文件WearableRequestReceiver.java   
@Override
public void onLyricsDownloaded(Lyrics lyrics) {
    if (lyrics.isLRC()) {
        LrcView lrcView = new LrcView(mContext,null);
        lrcView.setoriginalLyrics(lyrics);
        lrcView.setSourceLrc(lyrics.getText());
        lyrics.setText(lrcView.getStaticLyrics().getText());
    }

    NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(mContext,NotificationUtil.TRACK_NOTIF_CHANNEL);
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(mContext);

    Intent activityIntent = new Intent("com.geecko.QuickLyric.getLyrics")
            .putExtra("TAGS",new String[]{lyrics.getArtist(),lyrics.getTitle()});
    PendingIntent openAction = PendingIntent.getActivity(mContext,activityIntent,PendingIntent.FLAG_CANCEL_CURRENT);

    BigTextStyle bigStyle = new BigTextStyle();
    bigStyle.bigText(lyrics.getText() != null ? Html.fromHtml(lyrics.getText()) : "");

    int[] themes = new int[]{R.style.Theme_QuickLyric,R.style.Theme_QuickLyric_Red,R.style.Theme_QuickLyric_Purple,R.style.Theme_QuickLyric_Indigo,R.style.Theme_QuickLyric_Green,R.style.Theme_QuickLyric_Lime,R.style.Theme_QuickLyric_brown,R.style.Theme_QuickLyric_Dark};
    int themeNum = Integer.valueOf(sharedPref.getString("pref_theme","0"));
    int notificationPref = Integer.valueOf(sharedPref.getString("pref_notifications","0"));

    mContext.setTheme(themes[themeNum]);

    notifBuilder.setSmallIcon(R.drawable.ic_notif)
            .setContentTitle(mContext.getString(R.string.app_name))
            .setContentText(String.format("%s - %s",lyrics.getArtist(),lyrics.getTitle()))
            .setStyle(bigStyle)
            .setGroup("Lyrics_Notification")
            .setongoing(false)
            .setColor(ColorUtils.getPrimaryColor(mContext))
            .setGroupSummary(false)
            .setContentIntent(openAction)
            .setVisibility(-1); // Notification.VISIBILITY_SECRET

    if (notificationPref == 2)
        notifBuilder.setPriority(-2);

    if (lyrics.getFlag() < 0)
        notifBuilder.extend(new NotificationCompat.WearableExtender()
                .setContentIntentAvailableOffline(false));

    Notification notif = notifBuilder.build();

    notificationmanagerCompat.from(mContext).notify(8,notif);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。