From aae7843cbe5d628d72397b1c04a20deac8c64506 Mon Sep 17 00:00:00 2001 From: Quentin Colle Date: Wed, 25 Jul 2018 16:10:04 -0400 Subject: [PATCH] Chore - Getter Activity --- .../materialcalendarview/MonthView.java | 1 + sample/src/main/AndroidManifest.xml | 18 ++++ .../sample/GettersActivity.java | 80 ++++++++++++++++++ .../src/main/res/layout/activity_getters.xml | 83 +++++++++++++++++++ sample/src/main/res/values/strings.xml | 1 + 5 files changed, 183 insertions(+) create mode 100644 sample/src/main/java/com/prolificinteractive/materialcalendarview/sample/GettersActivity.java create mode 100644 sample/src/main/res/layout/activity_getters.xml diff --git a/library/src/main/java/com/prolificinteractive/materialcalendarview/MonthView.java b/library/src/main/java/com/prolificinteractive/materialcalendarview/MonthView.java index 9ca3f165..cad81741 100644 --- a/library/src/main/java/com/prolificinteractive/materialcalendarview/MonthView.java +++ b/library/src/main/java/com/prolificinteractive/materialcalendarview/MonthView.java @@ -3,6 +3,7 @@ import android.annotation.SuppressLint; import android.support.annotation.NonNull; +import android.util.Log; import java.util.Calendar; import java.util.Collection; import org.threeten.bp.DayOfWeek; diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index e05353b7..d7cb36c9 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -111,6 +111,24 @@ + + + + + + + + + + + { + widget.setSelectionMode(which); + dialog.dismiss(); + }) + .show(); + } + + @OnClick(R.id.get_current_date) public void getCurrentDatesClick(final View v) { + Toast.makeText(this, widget.getCurrentDate().toString(), Toast.LENGTH_SHORT).show(); + Log.e("GettersActivity", widget.getCurrentDate().toString()); + } + + @OnClick(R.id.get_selected_date) public void getSelectedDatesClick(final View v) { + final CalendarDay selectedDate = widget.getSelectedDate(); + if (selectedDate != null) { + Toast.makeText(this, selectedDate.toString(), Toast.LENGTH_SHORT).show(); + Log.e("GettersActivity", selectedDate.toString()); + } else { + Toast.makeText(this, "No Selection", Toast.LENGTH_SHORT).show(); + } + } + + @OnClick(R.id.get_selected_dates) public void getSelectedDateClick(final View v) { + final List selectedDates = widget.getSelectedDates(); + if (!selectedDates.isEmpty()) { + Toast.makeText(this, selectedDates.toString(), Toast.LENGTH_SHORT).show(); + Log.e("GettersActivity", selectedDates.toString()); + } else { + Toast.makeText(this, "No Selection", Toast.LENGTH_SHORT).show(); + } + } + + @OnClick(R.id.get_selection_mode) public void getSelectionModeClick(final View v) { + Toast.makeText(this, ITEMS[widget.getSelectionMode()], Toast.LENGTH_SHORT).show(); + Log.e("GettersActivity", ITEMS[widget.getSelectionMode()].toString()); + } +} diff --git a/sample/src/main/res/layout/activity_getters.xml b/sample/src/main/res/layout/activity_getters.xml new file mode 100644 index 00000000..06fdbe73 --- /dev/null +++ b/sample/src/main/res/layout/activity_getters.xml @@ -0,0 +1,83 @@ + + + + + + + + + +