@Test public void testBuildNotification() { mNotification.parseMessageData(); Notification notification = mNotification.buildNotification(mContext, null); assertNotNull(notification); StoredNotification stored = mNotification.getStoredNotification(); assertNotNull(stored); assertEquals(stored.getType(), NotificationTypes.ALLIANCE_SELECTION); assertEquals(stored.getTitle(), mContext.getString(R.string.notification_alliances_updated_title, "NECMP")); assertEquals(stored.getBody(), mContext.getString(R.string.notification_alliances_updated, "New England")); assertEquals(stored.getMessageData(), mData.toString()); assertEquals(stored.getIntent(), MyTBAHelper.serializeIntent(mNotification.getIntent(mContext))); assertNotNull(stored.getTime()); }
@Override public Notification buildNotification(Context context, FollowsChecker followsChecker) { Resources r = context.getResources(); String eventName = event.getShortName(); String contentText = r.getString(R.string.notification_alliances_updated, eventName); Intent instance = getIntent(context); stored = new StoredNotification(); stored.setType(getNotificationType()); String eventCode = EventHelper.getEventCode(eventKey); String title = r.getString(R.string.notification_alliances_updated_title, eventCode); stored.setTitle(title); stored.setBody(contentText); stored.setMessageData(messageData); stored.setIntent(MyTBAHelper.serializeIntent(instance)); stored.setTime(Calendar.getInstance().getTime()); stored.setSystemId(getNotificationId()); NotificationCompat.Builder builder = getBaseBuilder(context, instance) .setContentTitle(title) .setContentText(contentText); NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle().bigText(contentText); builder.setStyle(style); return builder.build(); }
AllianceSelectionNotification extends BaseNotification<AllianceSelectionNotificationViewModel> { @Override public Notification buildNotification(Context context, FollowsChecker followsChecker) { Resources r = context.getResources(); String eventName = event.getShortName(); String contentText = r.getString(R.string.notification_alliances_updated, eventName); Intent instance = getIntent(context); stored = new StoredNotification(); stored.setType(getNotificationType()); String eventCode = EventHelper.getEventCode(eventKey); String title = r.getString(R.string.notification_alliances_updated_title, eventCode); stored.setTitle(title); stored.setBody(contentText); stored.setMessageData(messageData); stored.setIntent(MyTBAHelper.serializeIntent(instance)); stored.setTime(Calendar.getInstance().getTime()); stored.setSystemId(getNotificationId()); NotificationCompat.Builder builder = getBaseBuilder(context, instance) .setContentTitle(title) .setContentText(contentText); NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle().bigText(contentText); builder.setStyle(style); return builder.build(); } }
AllianceSelectionNotification extends BaseNotification<AllianceSelectionNotificationViewModel> { @Override public Notification buildNotification(Context context, FollowsChecker followsChecker) { Resources r = context.getResources(); String eventName = event.getShortName(); String contentText = r.getString(R.string.notification_alliances_updated, eventName); Intent instance = getIntent(context); stored = new StoredNotification(); stored.setType(getNotificationType()); String eventCode = EventHelper.getEventCode(eventKey); String title = r.getString(R.string.notification_alliances_updated_title, eventCode); stored.setTitle(title); stored.setBody(contentText); stored.setMessageData(messageData); stored.setIntent(MyTBAHelper.serializeIntent(instance)); stored.setTime(Calendar.getInstance().getTime()); stored.setSystemId(getNotificationId()); NotificationCompat.Builder builder = getBaseBuilder(context, instance) .setContentTitle(title) .setContentText(contentText); NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle().bigText(contentText); builder.setStyle(style); return builder.build(); } AllianceSelectionNotification(String messageData, EventWriter writer); }
AllianceSelectionNotification extends BaseNotification<AllianceSelectionNotificationViewModel> { @Override public Notification buildNotification(Context context, FollowsChecker followsChecker) { Resources r = context.getResources(); String eventName = event.getShortName(); String contentText = r.getString(R.string.notification_alliances_updated, eventName); Intent instance = getIntent(context); stored = new StoredNotification(); stored.setType(getNotificationType()); String eventCode = EventHelper.getEventCode(eventKey); String title = r.getString(R.string.notification_alliances_updated_title, eventCode); stored.setTitle(title); stored.setBody(contentText); stored.setMessageData(messageData); stored.setIntent(MyTBAHelper.serializeIntent(instance)); stored.setTime(Calendar.getInstance().getTime()); stored.setSystemId(getNotificationId()); NotificationCompat.Builder builder = getBaseBuilder(context, instance) .setContentTitle(title) .setContentText(contentText); NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle().bigText(contentText); builder.setStyle(style); return builder.build(); } AllianceSelectionNotification(String messageData, EventWriter writer); Event getEvent(); String getEventKey(); @Override void parseMessageData(); @Override Notification buildNotification(Context context, FollowsChecker followsChecker); @Override Intent getIntent(Context context); @Override void updateDataLocally(); @Override int getNotificationId(); @Override View getView(Context c, LayoutInflater inflater, View convertView); @Nullable @Override AllianceSelectionNotificationViewModel renderToViewModel(Context context, @Nullable Void aVoid); }
AllianceSelectionNotification extends BaseNotification<AllianceSelectionNotificationViewModel> { @Override public Notification buildNotification(Context context, FollowsChecker followsChecker) { Resources r = context.getResources(); String eventName = event.getShortName(); String contentText = r.getString(R.string.notification_alliances_updated, eventName); Intent instance = getIntent(context); stored = new StoredNotification(); stored.setType(getNotificationType()); String eventCode = EventHelper.getEventCode(eventKey); String title = r.getString(R.string.notification_alliances_updated_title, eventCode); stored.setTitle(title); stored.setBody(contentText); stored.setMessageData(messageData); stored.setIntent(MyTBAHelper.serializeIntent(instance)); stored.setTime(Calendar.getInstance().getTime()); stored.setSystemId(getNotificationId()); NotificationCompat.Builder builder = getBaseBuilder(context, instance) .setContentTitle(title) .setContentText(contentText); NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle().bigText(contentText); builder.setStyle(style); return builder.build(); } AllianceSelectionNotification(String messageData, EventWriter writer); Event getEvent(); String getEventKey(); @Override void parseMessageData(); @Override Notification buildNotification(Context context, FollowsChecker followsChecker); @Override Intent getIntent(Context context); @Override void updateDataLocally(); @Override int getNotificationId(); @Override View getView(Context c, LayoutInflater inflater, View convertView); @Nullable @Override AllianceSelectionNotificationViewModel renderToViewModel(Context context, @Nullable Void aVoid);  }