Skip to content
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
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ Declare a DayPickerView inside your layout XML file:

``` xml

<com.andexert.calendarlistview.library.DayPickerView
android:id="@+id/pickerView"
xmlns:calendar="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.andexert.calendarlistview.library.DayPickerView
android:id="@+id/pickerView"
xmlns:calendar="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

```

Next, you have to implement `DatePickerController` in your Activity or your Fragment. You will have to set `getMaxYear` and `onDayOfMonthSelected`. The first one is the max year between the current one and this maxYear. The second one is called every time user selects a new date.

``` java

public class MyFragment extends Fragment implements DatePickerController {

...

@Override
public int getMaxYear()
{
Expand All @@ -44,11 +48,20 @@ Next, you have to implement `DatePickerController` in your Activity or your Frag
@Override
public void onDayOfMonthSelected(int year, int month, int day)
{
Log.e("Day Selected", day + " / " + month + " / " + year);
Log.d("Day Selected", day + " / " + month + " / " + year);
}

...

}
```

Finally, in `onCreate` or `onCreateView` method of your Activity or Fragment respectively, set the controller.

``` java
DayPickerView dayPickerView = (DayPickerView) findViewById(R.id.pickerView);
dayPickerView.setController(this);
```
---

### Customization
Expand Down