List of usage examples for android.support.v4.app NotificationCompat.InboxStyle NotificationCompat.InboxStyle
NotificationCompat.InboxStyle
From source file:org.jitsi.impl.androidtray.AndroidPopup.java
/** * Builds notification and returns the builder object which can be used to * extend the notification./*ww w . j ava2 s .c o m*/ * @return builder object describing current notification. */ NotificationCompat.Builder buildNotification() { Context ctx = JitsiApplication.getGlobalContext(); NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx).setSmallIcon(smallIcon) .setContentTitle(popupMessage.getMessageTitle()).setContentText(getMessage()).setAutoCancel(true)// will be cancelled once clciked .setVibrate(new long[] {}) // no vibration .setSound(null); // no sound // Big view comes with API11 if (AndroidUtils.hasAPI(11)) { Resources res = JitsiApplication.getAppResources(); // Preferred size int prefWidth = (int) res.getDimension(android.R.dimen.notification_large_icon_width); int prefHeight = (int) res.getDimension(android.R.dimen.notification_large_icon_height); // Use popup icon if any Bitmap iconBmp = null; byte[] icon = popupMessage.getIcon(); if (icon != null) { iconBmp = AndroidImageUtil.scaledBitmapFromBytes(icon, prefWidth, prefHeight); } // Set default avatar if (iconBmp == null && contact != null) { iconBmp = AndroidImageUtil.scaledBitmapFromResource(res, R.drawable.avatar, prefWidth, prefHeight); } if (iconBmp != null) { if (iconBmp.getWidth() > prefWidth || iconBmp.getHeight() > prefHeight) { iconBmp = Bitmap.createScaledBitmap(iconBmp, prefWidth, prefHeight, true); } builder.setLargeIcon(iconBmp); } // Build inbox style NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); onBuildInboxStyle(inboxStyle); builder.setStyle(inboxStyle); } return builder; }