Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make month title text change visibility accordingly #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public class CaldroidFragment extends DialogFragment {
public final static String MONTH = "month";
public final static String YEAR = "year";
public final static String SHOW_NAVIGATION_ARROWS = "showNavigationArrows";
public final static String SHOW_MONTH_TITLE_TEXT = "showMonthTitleText";
public final static String DISABLE_DATES = "disableDates";
public final static String SELECTED_DATES = "selectedDates";
public final static String MIN_DATE = "minDate";
Expand Down Expand Up @@ -208,6 +209,7 @@ public class CaldroidFragment extends DialogFragment {
*/
protected boolean enableSwipe = true;
protected boolean showNavigationArrows = true;
protected boolean showMonthTitleText = true;
protected boolean enableClickOnDisabledDates = false;

/**
Expand Down Expand Up @@ -466,6 +468,7 @@ public Bundle getSavedStates() {
}

bundle.putBoolean(SHOW_NAVIGATION_ARROWS, showNavigationArrows);
bundle.putBoolean(SHOW_MONTH_TITLE_TEXT, showMonthTitleText);
bundle.putBoolean(ENABLE_SWIPE, enableSwipe);
bundle.putInt(START_DAY_OF_WEEK, startDayOfWeek);
bundle.putBoolean(SIX_WEEKS_IN_CALENDAR, sixWeeksInCalendar);
Expand Down Expand Up @@ -757,6 +760,22 @@ public void setShowNavigationArrows(boolean showNavigationArrows) {
}
}

/**
* Check if the month title text is shown
*/
public boolean isShowMonthTitleText() {
return showMonthTitleText;
}

public void setShowMonthTitleText(boolean showMonthTitleText) {
this.showMonthTitleText = showMonthTitleText;
if (showMonthTitleText) {
monthTitleTextView.setVisibility(View.VISIBLE);
} else {
monthTitleTextView.setVisibility(View.INVISIBLE);
}
}

/**
* Enable / Disable swipe to navigate different months
*
Expand Down Expand Up @@ -1006,6 +1025,9 @@ protected void retrieveInitialArgs() {
showNavigationArrows = args
.getBoolean(SHOW_NAVIGATION_ARROWS, true);

// Should show month title text
showMonthTitleText = args.getBoolean(SHOW_MONTH_TITLE_TEXT, true);

// Should enable swipe to change month
enableSwipe = args.getBoolean(ENABLE_SWIPE, true);

Expand Down Expand Up @@ -1159,6 +1181,9 @@ public void onClick(View v) {
// Show navigation arrows depend on initial arguments
setShowNavigationArrows(showNavigationArrows);

// Show month title text depend on initial arguments
setShowMonthTitleText(showMonthTitleText);

// For the weekday gridview ("SUN, MON, TUE, WED, THU, FRI, SAT")
weekdayGridView = (GridView) view.findViewById(R.id.weekday_gridview);
WeekdayArrayAdapter weekdaysAdapter = getNewWeekdayAdapter();
Expand Down