diff --git a/library/src/main/java/com/prolificinteractive/materialcalendarview/LocalUtils.java b/library/src/main/java/com/prolificinteractive/materialcalendarview/LocalUtils.java
index 0ffeb42d..e9f1ddc8 100644
--- a/library/src/main/java/com/prolificinteractive/materialcalendarview/LocalUtils.java
+++ b/library/src/main/java/com/prolificinteractive/materialcalendarview/LocalUtils.java
@@ -4,15 +4,15 @@
class LocalUtils {
- private LocalUtils() { }
+ private LocalUtils() { }
- static boolean isRTL() {
- return isRTL(Locale.getDefault());
- }
+ static boolean isRTL() {
+ return isRTL(Locale.getDefault());
+ }
- private static boolean isRTL(Locale locale) {
- final int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
- return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT ||
- directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
- }
+ private static boolean isRTL(Locale locale) {
+ final int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
+ return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT ||
+ directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
+ }
}
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index 6dedbeb8..1b41869b 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -4,14 +4,14 @@
>
@@ -22,14 +22,14 @@
@@ -40,14 +40,14 @@
@@ -60,12 +60,12 @@
@@ -76,14 +76,14 @@
@@ -94,14 +94,14 @@
@@ -114,12 +114,12 @@
@@ -130,14 +130,14 @@
@@ -148,14 +148,14 @@
@@ -166,14 +166,14 @@
@@ -186,12 +186,12 @@
@@ -202,14 +202,14 @@
@@ -220,14 +220,14 @@
@@ -237,20 +237,38 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sample/src/main/java/com/prolificinteractive/materialcalendarview/sample/GettersActivity.java b/sample/src/main/java/com/prolificinteractive/materialcalendarview/sample/GettersActivity.java
new file mode 100644
index 00000000..42d9bd96
--- /dev/null
+++ b/sample/src/main/java/com/prolificinteractive/materialcalendarview/sample/GettersActivity.java
@@ -0,0 +1,80 @@
+package com.prolificinteractive.materialcalendarview.sample;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.view.View;
+import android.widget.Toast;
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnCheckedChanged;
+import butterknife.OnClick;
+import com.prolificinteractive.materialcalendarview.CalendarDay;
+import com.prolificinteractive.materialcalendarview.CalendarMode;
+import com.prolificinteractive.materialcalendarview.MaterialCalendarView;
+import java.util.List;
+
+/**
+ * Because the calendar has a lot of getters method, this activity is here to demonstrate what each
+ * getter is returning. For more information, make sure to check the documentation.
+ */
+public class GettersActivity extends AppCompatActivity {
+ public static final CharSequence[] ITEMS =
+ new CharSequence[] { "NONE", "SINGLE", "MULTIPLE", "RANGE" };
+
+ @BindView(R.id.calendarView) MaterialCalendarView widget;
+
+ @Override protected void onCreate(@Nullable final Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_getters);
+ ButterKnife.bind(this);
+ }
+
+ @OnCheckedChanged(R.id.calendar_mode)
+ void onCalendarModeChanged(boolean checked) {
+ final CalendarMode mode = checked ? CalendarMode.WEEKS : CalendarMode.MONTHS;
+ widget.state().edit().setCalendarDisplayMode(mode).commit();
+ }
+
+ @OnClick(R.id.button_selection_mode) void onChangeSelectionMode() {
+ new AlertDialog.Builder(this)
+ .setTitle("Selection Mode")
+ .setSingleChoiceItems(ITEMS, widget.getSelectionMode(), (dialog, which) -> {
+ 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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml
index b545462f..bf3de6e8 100644
--- a/sample/src/main/res/values/strings.xml
+++ b/sample/src/main/res/values/strings.xml
@@ -13,6 +13,7 @@
Old CalendarView
Calendar in Dialogs
Calendar with Decorators
+ Calendar with Getters
Calendar Selection Modes
Calendar with Dynamic Modes
Multiple Basic Calendars