forked from prolificinteractive/material-calendarview
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request prolificinteractive#333 from prolificinteractive/f…
…uture-1.x Release 1.4.0
- Loading branch information
Showing
19 changed files
with
528 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
language: android | ||
|
||
jdk: | ||
- oraclejdk8 | ||
|
||
android: | ||
components: | ||
- tools | ||
- platform-tools | ||
- build-tools-23.0.3 | ||
- android-23 | ||
- extra-android-m2repository | ||
- extra-google-m2repository | ||
|
||
script: | ||
- ./gradlew clean check assemble -Dpre-dex=false | ||
|
||
notifications: | ||
email: false | ||
|
||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- $HOME/.gradle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
State builder | ||
============= | ||
|
||
Certain parameters are only modifiable using the state builder of the `MaterialCalendarView`. | ||
Using the builder prevents from updating the view each time one of the setters is called. The view is updated when calling `Builder#commit()` and that improve performances. | ||
Previously, the fields could be customize using casual setters. | ||
|
||
Here is a concrete example of how to use the builder: | ||
|
||
```java | ||
mcv.state().edit() | ||
.setFirstDayOfWeek(Calendar.WEDNESDAY) | ||
.setMinimumDate(CalendarDay.from(2016, 4, 3)) | ||
.setMaximumDate(CalendarDay.from(2016, 5, 12)) | ||
.setCalendarDisplayMode(CalendarMode.WEEKS) | ||
.commit(); | ||
``` | ||
|
||
## state.edit() vs newState() | ||
|
||
Using `mcv.state().edit()` will preserve the current state of the `MaterialCalendarView` while `mcv.newState()` will initialize the builder with new parameters. | ||
Only the fields that are modifiable using the builder can be reset or edit. Here is the list of the fields: | ||
|
||
- First Day Of Week | ||
- Minimum Date | ||
- Maximum Date | ||
- Calendar Display Mode | ||
|
||
As an example, if you are setting `firstDayOfWeek` inside your xml, and you want to preserve the field when using the builder, you should use `state.edit()`. | ||
However if you don't want to preserve any current parameters from the list above, use `newState()`. In most cases `state.edit()` should be the right method to use. | ||
|
||
### First Day Of The Week | ||
|
||
The default first day of the week is Sunday. You can set a custom day of the week by setting `mcv_firstDayOfWeek` in xml, or by calling `setFirstDayOfWeek()`. | ||
The xml attribute is an enum of `sunday` through `saturday` and `setFirstDayOfWeek()` accepts values from `java.util.Calendar` such as `Calendar.MONDAY`. | ||
|
||
|
||
### Date Ranges | ||
|
||
By default, the calendar displays months for 200 years before today and 200 years after. | ||
You can specify different minimum and maximum dates by calling `setMinimumDate(CalendarDay)` and `setMaximumDate(CalendarDay)`. | ||
Passing `null` will reset back to the default 200 years. | ||
There are also convenience methods that accept a `Calendar` or a `Date` object and convert them to a `CalendarDay` using the relevant `CalendarDay.from()` factory method. | ||
|
||
### Calendar Display Mode | ||
|
||
`MaterialCalendarView` propose two display modes: weekly and monthly. You can set the display mode in your xml using the attribute `mcv_calendarMode` with `month` for monthly mode, or `week` for weekly mode. | ||
You can also use the builder `setCalendarDisplayMode(CalendarMode)` parameter. | ||
|
||
It is **important** to note that the `CalendarMode.WEEKS` is still experimental. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.