Ejemplo n.º 1
0
 private String getSelectedDatesString() {
   CalendarDay date = calendarView.getSelectedDate();
   if (date == null) {
     return FORMATTER.format(new Date());
   }
   return FORMATTER.format(date.getDate());
 }
 @Override
 public void onDateSelected(@NonNull MaterialCalendarView widget, @Nullable CalendarDay date) {
   if (date == null) {
     textView.setText(null);
   } else {
     textView.setText(FORMATTER.format(date.getDate()));
   }
 }
Ejemplo n.º 3
0
  public static void refreshNote(CalendarDay calendarDay) {
    date = String.valueOf(formatter.format(calendarDay.getDate()));

    add_note.setVisibility(View.VISIBLE);
    sched_title.setVisibility(View.VISIBLE);
    sched_details.setVisibility(View.GONE);
    note_edit_delete.setVisibility(View.GONE);

    if (GuideProfileFragment.notes.size() > 0) {
      note = getNoteByDate(date);
      if (note != null) {
        add_note.setVisibility(View.GONE);
        note_edit_delete.setVisibility(View.VISIBLE);
        sched_details.setVisibility(View.VISIBLE);

        sched_title.setText(note.note_title);
        sched_details.setText(note.note_detail);

        edit_note.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                showAlertDialog("Edit Note", "edit");
              }
            });

        delete_note.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                AlertDialog.Builder builder = new AlertDialog.Builder(context);
                builder.setIcon(R.drawable.guia_dialog);
                builder.setTitle("Warning!");
                builder.setMessage("\nAre you sure you want to delete note?\n");
                builder.setNegativeButton("No", null);
                builder.setPositiveButton(
                    "Yes",
                    new DialogInterface.OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                        JSONParser.getInstance(context)
                            .deleteNote(Constants.deleteNote + note.note_id);
                      }
                    });
                builder.show();
              }
            });
      } else {
        sched_title.setText("Nothing to do " + date);
      }
    } else {
      sched_title.setText("Nothing to do " + date);
    }

    calendar.removeDecorators();
    markDates();
  }
Ejemplo n.º 4
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    dialogOpened = false;

    if (resultCode != Activity.RESULT_OK) {
      return;
    }

    switch (requestCode) {
      case DatePickerDialog.FROM_DATE_PICKED:
        CalendarDay day = data.getParcelableExtra("date");
        fromDate.setText(EnvUtil.getFormattedDate(day.getDate().getTime()));
        break;
      case DatePickerDialog.TO_DATE_PICKED:
        day = data.getParcelableExtra("date");
        toDate.setText(EnvUtil.getFormattedDate(day.getDate().getTime()));
        break;
    }

    updateData();
  }
Ejemplo n.º 5
0
 /** {@inheritDoc} */
 @Override
 public @NonNull String format(@NonNull CalendarDay day) {
   return dateFormat.format(day.getDate());
 }
 @Override
 public void onMonthChanged(MaterialCalendarView widget, CalendarDay date) {
   Toast.makeText(this, FORMATTER.format(date.getDate()), Toast.LENGTH_SHORT).show();
 }
Ejemplo n.º 7
0
 @Override
 public void onMonthChanged(MaterialCalendarView materialCalendarView, CalendarDay calendarDay) {
   Toast.makeText(
           getApplicationContext(), FORMATTER.format(calendarDay.getDate()), Toast.LENGTH_SHORT)
       .show();
 }
Ejemplo n.º 8
0
 private void setTotal() {
   CalendarDay date = calendarView.getSelectedDate();
   promise_date = new SimpleDateFormat("yyMMdd").format(date.getDate()).toString();
   total = promise_date + promise_time; /* format : '%y%m%d%I%i' */
 }