Ejemplo n.º 1
0
 public void removeNotification(int groupPosition) {
   SimpleNotification n = notifications.get(groupPosition);
   notifications.remove(n);
   adapter.notifyDataSetChanged();
   Context context = getApplicationContext();
   new NotificationsAlarmManager(context).removeAlarm(context, n);
 }
Ejemplo n.º 2
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {
      SimpleNotification notification = createNotificationFromIntent(data);
      Context context = getApplicationContext();
      switch (requestCode) {
        case REQUEST_CODE_EDIT:
          notifications.removeById(notification.getId());
          new NotificationsAlarmManager(context).removeAlarm(context, notification);

        case REQUEST_CODE_ADD:
          new NotificationsAlarmManager(context).setAlarm(context, notification);
          notifications.add(notification);
          adapter.notifyDataSetChanged();
          break;

        default:
          break;
      }
    }
  }