private void initializeCalendar() {

    calendario.setOnDateChangedListener(listener);
    calendario.setShowOtherDates(MaterialCalendarView.SHOW_ALL);

    Calendar calendar = Calendar.getInstance();
    calendario.setSelectedDate(calendar.getTime());

    /*calendar.set(calendar.get(Calendar.YEAR), Calendar.JANUARY, 1);
    calendario.setMinimumDate(calendar.getTime());

    calendar.set(calendar.get(Calendar.YEAR), Calendar.DECEMBER, 31);
    calendario.setMaximumDate(calendar.getTime());*/

    calendar.getInstance();
    calendar.add(Calendar.DAY_OF_MONTH, -2);

    OneDayDecorator diaDecor = new OneDayDecorator();

    ArrayList<CalendarDay> dates = new ArrayList<>();
    CalendarDay cal = CalendarDay.from(calendar);

    dates.add(cal);

    // calendario.addDecorator(new EventDecorator(0xffcccccc, dates));
    diaDecor.setDate(new Date(calendar.getTimeInMillis()));
    calendario.addDecorator(diaDecor);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_basic);
    ButterKnife.bind(this);

    widget.setOnDateChangedListener(this);
    widget.setOnMonthChangedListener(this);
  }
Ejemplo n.º 3
0
  private void initView() {
    calendarView = (MaterialCalendarView) findViewById(R.id.calendarView);
    newSchDate = (TextView) findViewById(R.id.new_sch_date);

    timePicker = (TimePicker) findViewById(R.id.timePicker);
    newSchTime = (TextView) findViewById(R.id.new_sch_time);
    timePicker.setOnTimeChangedListener(this);

    calendarView.setOnDateChangedListener(this);
    calendarView.setOnMonthChangedListener(this);

    spinner = (Spinner) findViewById(R.id.spinner_location);
    setCourseNames();

    schContentsNew = (EditText) findViewById(R.id.sch_contents_new);
  }
Ejemplo n.º 4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    widget = (MaterialCalendarView) findViewById(R.id.calendar);
    widget.setShowOtherDates(MaterialCalendarView.SHOW_DEFAULTS);

    Calendar calendar = Calendar.getInstance();

    widget.setSelectedDate(calendar.getTime());
    widget.setSelectionColor(R.color.colorAccent);
    //
    //        widget.addDecorators(
    //                new MySelectorDecorator(this),
    //                oneDayDecorator
    //        );
    widget.setOnDateChangedListener(this);
    new ApiSimulator().executeOnExecutor(Executors.newSingleThreadExecutor());
  }
Ejemplo n.º 5
0
  @Nullable
  @Override
  public View onCreateView(
      final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.calendar, container, false);

    this.inflater = inflater;
    calendar = (MaterialCalendarView) view.findViewById(R.id.calendarView);
    sched_title = (TextView) view.findViewById(R.id.sched_title);
    sched_details = (TextView) view.findViewById(R.id.sched_details);
    add_note = (ImageView) view.findViewById(R.id.add_note);
    edit_note = (ImageView) view.findViewById(R.id.note_edit);
    delete_note = (ImageView) view.findViewById(R.id.note_delete);
    note_edit_delete = (LinearLayout) view.findViewById(R.id.note_edit_delete);

    context = getContext();
    markDates();

    calendar.setOnDateChangedListener(
        new OnDateChangedListener() {
          @Override
          public void onDateChanged(
              MaterialCalendarView materialCalendarView, @Nullable CalendarDay calendarDay) {
            // sched_details.setText(formatter.format(calendarDay.getDate()));
            refreshNote(calendarDay);
          }
        });

    add_note.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            showAlertDialog("Create Note", "add");
          }
        });
    return view;
  }