use of android.support.v4.app.NotificationCompat.BigTextStyle in project k-9 by k9mail.
the class BaseNotificationsTest method testCreateBigTextStyleNotification.
@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);
}
use of android.support.v4.app.NotificationCompat.BigTextStyle in project AprilBeacon-Android-SDK by AprilBrother.
the class NotifyService method setBigTextStyleNotification.
/**
* Big Text Style Notification
*
* @return Notification
* @see CreateNotification
*/
private Notification setBigTextStyleNotification(String content) {
Bitmap remote_picture = null;
// Create the style object with BigTextStyle subclass.
NotificationCompat.BigTextStyle notiStyle = new NotificationCompat.BigTextStyle();
notiStyle.setBigContentTitle("Big Text Expanded");
notiStyle.setSummaryText("Nice big text.");
try {
remote_picture = BitmapFactory.decodeStream((InputStream) new URL(sample_url).getContent());
} catch (IOException e) {
e.printStackTrace();
}
// Add the big text to the style.
CharSequence bigText = "This is an example of a large string to demo how much " + "text you can show in a 'Big Text Style' notification.";
notiStyle.bigText(bigText);
// Creates an explicit intent for an ResultActivity to receive.
Intent resultIntent = new Intent(this, ResultActivity.class);
// This ensures that the back button follows the recommended convention
// for the back key.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack for the Intent (but not the Intent itself).
stackBuilder.addParentStack(ResultActivity.class);
// Adds the Intent that starts the Activity to the top of the stack.
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
return new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_launcher).setAutoCancel(true).setLargeIcon(remote_picture).setContentIntent(resultPendingIntent).addAction(R.drawable.ic_launcher, "One", resultPendingIntent).addAction(R.drawable.ic_launcher, "Two", resultPendingIntent).addAction(R.drawable.ic_launcher, "Three", resultPendingIntent).setContentTitle("Big Text Normal").setContentText(content).setStyle(notiStyle).build();
}
use of android.support.v4.app.NotificationCompat.BigTextStyle in project AprilBeacon-Android-SDK by AprilBrother.
the class NotifyService method setBigTextStyleNotification.
/**
* Big Text Style Notification
*
* @return Notification
* @see CreateNotification
*/
private Notification setBigTextStyleNotification(String content) {
Bitmap remote_picture = null;
// Create the style object with BigTextStyle subclass.
NotificationCompat.BigTextStyle notiStyle = new NotificationCompat.BigTextStyle();
notiStyle.setBigContentTitle("Big Text Expanded");
notiStyle.setSummaryText("Nice big text.");
try {
remote_picture = BitmapFactory.decodeStream((InputStream) new URL(sample_url).getContent());
} catch (IOException e) {
e.printStackTrace();
}
// Add the big text to the style.
CharSequence bigText = "This is an example of a large string to demo how much " + "text you can show in a 'Big Text Style' notification.";
notiStyle.bigText(bigText);
// Creates an explicit intent for an ResultActivity to receive.
Intent resultIntent = new Intent(this, ResultActivity.class);
// This ensures that the back button follows the recommended convention
// for the back key.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack for the Intent (but not the Intent itself).
stackBuilder.addParentStack(ResultActivity.class);
// Adds the Intent that starts the Activity to the top of the stack.
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
return new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_launcher).setAutoCancel(true).setLargeIcon(remote_picture).setContentIntent(resultPendingIntent).addAction(R.drawable.ic_launcher, "One", resultPendingIntent).addAction(R.drawable.ic_launcher, "Two", resultPendingIntent).addAction(R.drawable.ic_launcher, "Three", resultPendingIntent).setContentTitle("Big Text Normal").setContentText(content).setStyle(notiStyle).build();
}
use of android.support.v4.app.NotificationCompat.BigTextStyle in project k-9 by k9mail.
the class AuthenticationErrorNotifications method showAuthenticationErrorNotification.
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, null, NOTIFICATION_LED_FAILURE_COLOR, NOTIFICATION_LED_BLINK_FAST, true);
getNotificationManager().notify(notificationId, builder.build());
}
use of android.support.v4.app.NotificationCompat.BigTextStyle in project qksms by moezbhatti.
the class RemoteMessagingReceiver method getConversationExtender.
public static WearableExtender getConversationExtender(Context context, String name, String address, long threadId) {
WearableExtender wearableExtender = new WearableExtender();
wearableExtender.setGravity(Gravity.BOTTOM);
wearableExtender.setStartScrollBottom(true);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
Bitmap background = ContactHelper.getBitmap(context, ContactHelper.getId(context, address));
if (background == null) {
background = Bitmap.createBitmap(640, 400, Bitmap.Config.ARGB_8888);
// We can't use ThemeManager here because it might not be initialized
background.eraseColor(Integer.parseInt(prefs.getString(SettingsFragment.THEME, "" + ThemeManager.DEFAULT_COLOR)));
}
wearableExtender.setBackground(background);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
BigTextStyle chatPageStyle = new BigTextStyle();
chatPageStyle.setBigContentTitle(name).setSummaryText(address).bigText(SmsHelper.getHistoryForWearable(context, name, threadId));
Notification chatPage = new NotificationCompat.Builder(context).setStyle(chatPageStyle).extend(new NotificationCompat.WearableExtender().setStartScrollBottom(true)).build();
wearableExtender.addPage(chatPage);
}
wearableExtender.addAction(getReplyAction(context, address, threadId));
Intent readIntent = new Intent(NotificationManager.ACTION_MARK_READ);
readIntent.putExtra(EXTRA_THREAD_ID, threadId);
PendingIntent readPI = PendingIntent.getBroadcast(context, 2, readIntent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Action readAction = new NotificationCompat.Action.Builder(R.drawable.ic_accept, context.getString(R.string.mark_read), readPI).build();
wearableExtender.addAction(readAction);
return wearableExtender;
}
Aggregations