com.prolificinteractive.materialcalendarview.MaterialCalendarView Java Examples
The following examples show how to use
com.prolificinteractive.materialcalendarview.MaterialCalendarView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SwappableBasicActivityDecorated.java From material-calendarview with MIT License | 6 votes |
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_basic_modes); ButterKnife.bind(this); widget.setOnDateChangedListener(this); widget.setShowOtherDates(MaterialCalendarView.SHOW_ALL); final LocalDate instance = LocalDate.now(); widget.setSelectedDate(instance); final LocalDate min = LocalDate.of(instance.getYear(), Month.JANUARY, 1); final LocalDate max = LocalDate.of(instance.getYear(), Month.DECEMBER, 31); widget.state().edit().setMinimumDate(min).setMaximumDate(max).commit(); widget.addDecorators( new MySelectorDecorator(this), new HighlightWeekendsDecorator(), oneDayDecorator ); }
Example #2
Source File: DialogsActivity.java From material-calendarview with MIT License | 6 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); //inflate custom layout and get views //pass null as parent view because will be in dialog layout View view = inflater.inflate(R.layout.dialog_basic, null); textView = view.findViewById(R.id.textView); MaterialCalendarView widget = view.findViewById(R.id.calendarView); widget.setOnDateChangedListener(this); return new AlertDialog.Builder(getActivity()) .setTitle(R.string.title_activity_dialogs) .setView(view) .setPositiveButton(android.R.string.ok, null) .create(); }
Example #3
Source File: BasicActivityDecorated.java From material-calendarview with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_basic); ButterKnife.bind(this); widget.setOnDateChangedListener(this); widget.setShowOtherDates(MaterialCalendarView.SHOW_ALL); final LocalDate instance = LocalDate.now(); widget.setSelectedDate(instance); final LocalDate min = LocalDate.of(instance.getYear(), Month.JANUARY, 1); final LocalDate max = LocalDate.of(instance.getYear(), Month.DECEMBER, 31); widget.state().edit().setMinimumDate(min).setMaximumDate(max).commit(); widget.addDecorators( new MySelectorDecorator(this), new HighlightWeekendsDecorator(), oneDayDecorator ); new ApiSimulator().executeOnExecutor(Executors.newSingleThreadExecutor()); }
Example #4
Source File: DynamicSettersActivity.java From material-calendarview with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dynamic_setters); ButterKnife.bind(this); currentTileSize = MaterialCalendarView.DEFAULT_TILE_SIZE_DP; currentTileWidth = MaterialCalendarView.DEFAULT_TILE_SIZE_DP; currentTileHeight = MaterialCalendarView.DEFAULT_TILE_SIZE_DP; widget.setOnTitleClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { Toast.makeText(DynamicSettersActivity.this, R.string.today, Toast.LENGTH_SHORT).show(); } }); widget.setOnDateLongClickListener(this); }
Example #5
Source File: SelectionModesActivity.java From material-calendarview with MIT License | 5 votes |
@Override public void onRangeSelected( @NonNull final MaterialCalendarView widget, @NonNull final List<CalendarDay> dates) { if (dates.size() > 0) { decorator.addFirstAndLast(dates.get(0), dates.get(dates.size() - 1)); range.invalidateDecorators(); } }
Example #6
Source File: MonthWeekMaterialCalendarView.java From monthweekmaterialcalendarview with Apache License 2.0 | 5 votes |
@Override protected void onFinishInflate() { super.onFinishInflate(); mCalendarViewMonth = (MaterialCalendarView) getChildAt(0); mCalendarViewWeek = (MaterialCalendarView) getChildAt(1); mRecyclerView = (RecyclerView) getChildAt(2); mTopWeekView = getChildAt(3); mCalendarViewMonth.setTopbarVisible(false); newState().commit(); setListener(); }
Example #7
Source File: SelectionModesActivity.java From material-calendarview with MIT License | 5 votes |
@Override public void onDateSelected( @NonNull final MaterialCalendarView widget, @NonNull final CalendarDay date, final boolean selected) { final String text = selected ? FORMATTER.format(date.getDate()) : "No Selection"; Toast.makeText(SelectionModesActivity.this, text, Toast.LENGTH_SHORT).show(); }
Example #8
Source File: SwappableBasicActivityDecorated.java From material-calendarview with MIT License | 5 votes |
@Override public void onDateSelected( @NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) { //If you change a decorate, you need to invalidate decorators oneDayDecorator.setDate(date.getDate()); widget.invalidateDecorators(); }
Example #9
Source File: CustomizeCodeActivity.java From material-calendarview with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_basic); ButterKnife.bind(this); widget.setShowOtherDates(MaterialCalendarView.SHOW_ALL); widget.setLeftArrow(R.drawable.ic_arrow_back); widget.setRightArrow(R.drawable.ic_arrow_forward); widget.setSelectionColor(getResources().getColor(R.color.sample_primary)); widget.setWeekDayTextAppearance(R.style.CustomTextAppearance); widget.setHeaderTextAppearance(R.style.CustomTextAppearance); widget.setDateTextAppearance(R.style.CustomTextAppearance); widget.setTitleFormatter(new MonthArrayTitleFormatter(getResources().getTextArray(R.array.custom_months))); widget.setWeekDayFormatter(new ArrayWeekDayFormatter(getResources().getTextArray(R.array.custom_weekdays))); widget.setTileSize((int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 36, getResources().getDisplayMetrics() )); widget.setTitleAnimationOrientation(MaterialCalendarView.VERTICAL); CalendarDay today = CalendarDay.from(2016, 5, 2); widget.setCurrentDate(today); widget.setSelectedDate(today); widget.state().edit() .setFirstDayOfWeek(DayOfWeek.WEDNESDAY) .setMinimumDate(CalendarDay.from(2016, 4, 3)) .setMaximumDate(CalendarDay.from(2016, 5, 12)) .setCalendarDisplayMode(CalendarMode.WEEKS) .commit(); }
Example #10
Source File: DialogsActivity.java From material-calendarview with MIT License | 5 votes |
@Override public void onDateSelected( @NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) { textView.setText(FORMATTER.format(date.getDate())); }
Example #11
Source File: DynamicSettersActivity.java From material-calendarview with MIT License | 5 votes |
@OnClick(R.id.button_change_orientation) void onButtonChangeOrientation() { widget.setTitleAnimationOrientation( widget.getTitleAnimationOrientation() == MaterialCalendarView.VERTICAL ? MaterialCalendarView.HORIZONTAL : MaterialCalendarView.VERTICAL); Toast.makeText( this, widget.getTitleAnimationOrientation() == MaterialCalendarView.VERTICAL ? "Vertical" : "Horizontal", Toast.LENGTH_SHORT ).show(); }
Example #12
Source File: DynamicSettersActivity.java From material-calendarview with MIT License | 5 votes |
@OnCheckedChanged(R.id.check_text_appearance) void onTextAppearanceChecked(boolean checked) { if (checked) { widget.setHeaderTextAppearance(R.style.TextAppearance_AppCompat_Large); widget.setDateTextAppearance(R.style.TextAppearance_AppCompat_Medium); widget.setWeekDayTextAppearance(R.style.TextAppearance_AppCompat_Medium); } else { widget.setHeaderTextAppearance(R.style.TextAppearance_MaterialCalendarWidget_Header); widget.setDateTextAppearance(R.style.TextAppearance_MaterialCalendarWidget_Date); widget.setWeekDayTextAppearance(R.style.TextAppearance_MaterialCalendarWidget_WeekDay); } widget.setShowOtherDates( checked ? MaterialCalendarView.SHOW_ALL : MaterialCalendarView.SHOW_NONE); }
Example #13
Source File: CustomTileDimensions.java From material-calendarview with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_custom_tile); ButterKnife.bind(this); currentTileWidth = MaterialCalendarView.DEFAULT_TILE_SIZE_DP; currentTileHeight = MaterialCalendarView.DEFAULT_TILE_SIZE_DP; widget.addDecorator(new TodayDecorator()); }
Example #14
Source File: BasicActivityDecorated.java From material-calendarview with MIT License | 5 votes |
@Override public void onDateSelected( @NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) { //If you change a decorate, you need to invalidate decorators oneDayDecorator.setDate(date.getDate()); widget.invalidateDecorators(); }
Example #15
Source File: BasicActivity.java From material-calendarview with MIT License | 5 votes |
@Override public void onDateSelected( @NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) { textView.setText(selected ? FORMATTER.format(date.getDate()) : "No Selection"); }
Example #16
Source File: CalendarManager.java From ReactNativeCalendarAndroid with MIT License | 5 votes |
@ReactProp(name = "selectionMode") public void setSelectionMode(Calendar view, String mode) { if (mode != null) { if (mode.equals("none")) { view.setSelectionMode(MaterialCalendarView.SELECTION_MODE_NONE); } else if (mode.equals("single")) { view.setSelectionMode(MaterialCalendarView.SELECTION_MODE_SINGLE); } else if (mode.equals("multiple")) { view.setSelectionMode(MaterialCalendarView.SELECTION_MODE_MULTIPLE); } else { throw new JSApplicationIllegalArgumentException("Unknown selectionMode property: " + mode); } } }
Example #17
Source File: CalendarManager.java From ReactNativeCalendarAndroid with MIT License | 5 votes |
@ReactProp(name = "showDate") public void setShowDate(Calendar view, String showDate) { if (showDate != null) { if (showDate.equals("all")) { view.setShowOtherDates(MaterialCalendarView.SHOW_OTHER_MONTHS); } else if (showDate.equals("current")) { view.setShowOtherDates(MaterialCalendarView.SHOW_DEFAULTS); } else { throw new JSApplicationIllegalArgumentException("Unknown showDate property: " + showDate); } } }
Example #18
Source File: CalendarManager.java From ReactNativeCalendarAndroid with MIT License | 5 votes |
@Override protected void addEventEmitters(final ThemedReactContext reactContext, final Calendar view) { view.setOnDateChangedListener(new OnDateSelectedListener() { @Override public void onDateSelected(MaterialCalendarView widget, CalendarDay date, boolean selected) { reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher() .dispatchEvent(new CalendarEvent( view.getId(), date, selected)); } }); }
Example #19
Source File: HoraireFragment.java From ETSMobile-Android2 with Apache License 2.0 | 5 votes |
@Override public void onDateSelected(MaterialCalendarView widget, CalendarDay date, boolean selected) { widget.setSelectedDate(date); fillSeancesList(date.getDate()); openCourseListDialog(); }
Example #20
Source File: BasicActivity.java From material-calendarview with MIT License | 4 votes |
@Override public void onMonthChanged(MaterialCalendarView widget, CalendarDay date) { //noinspection ConstantConditions getSupportActionBar().setTitle(FORMATTER.format(date.getDate())); }
Example #21
Source File: BasicActivity.java From material-calendarview with MIT License | 4 votes |
@Override public void onDateLongClick(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date) { final String text = String.format("%s is available", FORMATTER.format(date.getDate())); Toast.makeText(this, text, Toast.LENGTH_SHORT).show(); }
Example #22
Source File: DynamicSettersActivity.java From material-calendarview with MIT License | 4 votes |
@Override public void onDateLongClick(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date) { Toast.makeText(this, FORMATTER.format(date.getDate()), Toast.LENGTH_SHORT).show(); }
Example #23
Source File: RotationActivity.java From material-calendarview with MIT License | 4 votes |
@Override public void onDateLongClick(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date) { final String text = String.format("%s is available", FORMATTER.format(date.getDate())); Toast.makeText(this, text, Toast.LENGTH_SHORT).show(); }
Example #24
Source File: RotationActivity.java From material-calendarview with MIT License | 4 votes |
@Override public void onMonthChanged(MaterialCalendarView widget, CalendarDay date) { //noinspection ConstantConditions getSupportActionBar().setTitle(FORMATTER.format(date.getDate())); }
Example #25
Source File: MonthWeekMaterialCalendarView.java From monthweekmaterialcalendarview with Apache License 2.0 | votes |
void onMonthChanged(MaterialCalendarView widget, CalendarDay date);
Example #26
Source File: MonthWeekMaterialCalendarView.java From monthweekmaterialcalendarview with Apache License 2.0 | votes |
void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected);