File tree Expand file tree Collapse file tree 3 files changed +76
-1
lines changed
app/src/main/java/com/shrikanthravi/collapsiblecalendarview
collapsiblecalendarview2/src/main/java/com/shrikanthravi/collapsiblecalendarview Expand file tree Collapse file tree 3 files changed +76
-1
lines changed Original file line number Diff line number Diff line change 22
33import android .support .v7 .app .AppCompatActivity ;
44import android .os .Bundle ;
5+ import android .view .View ;
56
67import com .shrikanthravi .collapsiblecalendarview .widget .CollapsibleCalendar ;
78import com .shrikanthravi .collapsiblecalendarview .widget .UICalendar ;
@@ -18,6 +19,34 @@ protected void onCreate(Bundle savedInstanceState) {
1819
1920 CollapsibleCalendar collapsibleCalendar = findViewById (R .id .collapsibleCalendarView );
2021
22+ System .out .println ("Testing date " +collapsibleCalendar .getSelectedDay ().getDay ()+"/" +collapsibleCalendar .getSelectedDay ().getMonth ()+"/" +collapsibleCalendar .getSelectedDay ().getYear ());
23+ collapsibleCalendar .setCalendarListener (new CollapsibleCalendar .CalendarListener () {
24+ @ Override
25+ public void onDaySelect () {
26+
27+ }
28+
29+ @ Override
30+ public void onItemClick (View v ) {
31+
32+ }
33+
34+ @ Override
35+ public void onDataUpdate () {
36+
37+ }
38+
39+ @ Override
40+ public void onMonthChange () {
41+
42+ }
43+
44+ @ Override
45+ public void onWeekChange (int position ) {
46+
47+ }
48+ });
49+
2150
2251 }
2352}
Original file line number Diff line number Diff line change 11package com .shrikanthravi .collapsiblecalendarview .data ;
22
3+ import android .content .Intent ;
4+ import android .os .Parcel ;
5+ import android .os .Parcelable ;
6+
37/**
48 * Created by shrikanthravi on 06/03/18.
59 */
610
7- public class Day {
11+ public class Day implements Parcelable {
812
913 private int mYear ;
1014 private int mMonth ;
@@ -28,4 +32,36 @@ public int getDay(){
2832 return mDay ;
2933 }
3034
35+
36+
37+ public Day (Parcel in ){
38+ int [] data = new int [3 ];
39+ in .readIntArray (data );
40+ this .mYear = data [0 ];
41+ this .mMonth = data [1 ];
42+ this .mYear = data [2 ];
43+ }
44+
45+ @ Override
46+ public int describeContents () {
47+ return 0 ;
48+ }
49+
50+ @ Override
51+ public void writeToParcel (Parcel dest , int flags ) {
52+ dest .writeIntArray (new int [] {this .mYear ,
53+ this .mMonth ,
54+ this .mDay });
55+ }
56+ public static final Parcelable .Creator CREATOR = new Parcelable .Creator () {
57+ public Day createFromParcel (Parcel in ) {
58+ return new Day (in );
59+ }
60+
61+ public Day [] newArray (int size ) {
62+ return new Day [size ];
63+ }
64+ };
65+
66+
3167}
Original file line number Diff line number Diff line change @@ -368,6 +368,16 @@ public int getMonth() {
368368 }
369369
370370 public Day getSelectedDay () {
371+ if (getSelectedItem ()==null ){
372+ Calendar cal = Calendar .getInstance ();
373+ int day = cal .get (Calendar .DAY_OF_MONTH );
374+ int month = cal .get (Calendar .MONTH );
375+ int year = cal .get (Calendar .YEAR );
376+ return new Day (
377+ year ,
378+ month +1 ,
379+ day );
380+ }
371381 return new Day (
372382 getSelectedItem ().getYear (),
373383 getSelectedItem ().getMonth (),
You can’t perform that action at this time.
0 commit comments