├── README.md ├── images ├── sample1.gif └── sample2.gif └── library ├── .classpath ├── .project ├── .settings └── org.eclipse.core.resources.prefs ├── AndroidManifest.xml ├── bin ├── AndroidManifest.xml ├── ScrollerCalendar.apk ├── classes.dex ├── classes │ └── wgc │ │ └── shuwoom │ │ └── scrollercalendar │ │ ├── BuildConfig.class │ │ ├── CalendarUtils.class │ │ ├── CommonUtils.class │ │ ├── LunarYear.class │ │ ├── R$attr.class │ │ ├── R$color.class │ │ ├── R$dimen.class │ │ ├── R$drawable.class │ │ ├── R$id.class │ │ ├── R$layout.class │ │ ├── R$menu.class │ │ ├── R$string.class │ │ ├── R$style.class │ │ ├── R$styleable.class │ │ ├── R.class │ │ ├── ScrollerCalendar$1.class │ │ ├── ScrollerCalendar.class │ │ ├── ScrollerCalendarController.class │ │ ├── YearAdapter$CalendarMonth.class │ │ ├── YearAdapter$ViewHolder.class │ │ ├── YearAdapter.class │ │ ├── YearView$OnMonthClickListener.class │ │ ├── YearView.class │ │ └── demo │ │ └── MainActivity.class ├── dexedLibs │ ├── android-support-v4-230153cc99f4594ddd013caf92365d0e.jar │ ├── android-support-v4-b2c8fe38cf6eb1882feb5dda0df43489.jar │ ├── android-support-v7-recyclerview-bd99f62b0806e3288bdb07efd2895a77.jar │ └── android-support-v7-recyclerview-f4e9506e0059e453914d09f682236ef0.jar ├── jarlist.cache ├── res │ └── crunch │ │ ├── drawable-hdpi │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ │ └── drawable-xxhdpi │ │ └── ic_launcher.png └── resources.ap_ ├── gen └── wgc │ └── shuwoom │ └── scrollercalendar │ ├── BuildConfig.java │ └── R.java ├── ic_launcher-web.png ├── libs ├── android-support-v4.jar └── android-support-v7-recyclerview.jar ├── proguard-project.txt ├── project.properties ├── res ├── drawable-hdpi │ └── ic_launcher.png ├── drawable-mdpi │ └── ic_launcher.png ├── drawable-xhdpi │ └── ic_launcher.png ├── drawable-xxhdpi │ └── ic_launcher.png ├── layout │ └── activity_main.xml ├── menu │ └── main.xml ├── values-v11 │ └── styles.xml ├── values-v14 │ └── styles.xml ├── values-w820dp │ └── dimens.xml └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── src └── wgc └── shuwoom └── scrollercalendar ├── CalendarUtils.java ├── CommonUtils.java ├── LunarYear.java ├── ScrollerCalendar.java ├── ScrollerCalendarController.java ├── YearAdapter.java ├── YearView.java └── demo └── MainActivity.java /README.md: -------------------------------------------------------------------------------- 1 | # ScrollerCalendar 2 | ScrollerCalendar provides straightforward wayt to see calendar for Android 4.0+. 3 | ![image](https://github.com/guanchao/ScrollerCalendar/raw/master/images/sample1.gif) 4 | 5 | ![image](https://github.com/guanchao/ScrollerCalendar/raw/master/images/sample2.gif) 6 | ## Usage 7 | Declare a ScrollerCalendar inside your layout XML file: 8 | ```Java 9 | 17 | ``` 18 | Next, you have to implement `ScrollerCalendarController` in your Activity. Your will have to set `onMonthOfYearSelected` which is called every time user selects a new date. 19 | ```Java 20 | @Override 21 | public void onMonthOfYearSelected(int year, int month) 22 | { 23 | Log.e("Month Selected", year + "-" + month); 24 | } 25 | ``` 26 | ### Customization 27 | ScrollerCalendar is fully customizable: 28 | > * calendar:dividerColor [color #FFDDDDDD]===> The color of the line under the year header label. 29 | > * calendar:yearHeaderTextColor [color #FF000000]===> The color of year header label. 30 | > * calendar:yearHeaderTextHeight [dimension 40dp]===> The height of the year header label. 31 | > * calendar:yearHeaderTextSize [dimension 34sp]===> The size of year header text. 32 | > * calendar:yearHeaderLunarTextColor [color #FFCCCCCC]===> The color of the lunar label besides of the year header label. 33 | > * calendar:yearHeaderLunarTextSize [dimension 12sp]===> The size of the lunar label besides of the year header label. 34 | > * calendar:yearHeaderDashColor [color #FFFF0000]===> The color of the dash line on the left of the lunar label. 35 | > * calendar:monthLabelTextColor [color #FFFF0000]===> The color of the month label. 36 | > * calendar:monthLabelTextSize [dimension 16sp]===> The size of the month label. 37 | > * calendar:monthLabelTextHeight [dimension 35dp]===> The height of the month label. 38 | > * calendar:dayLabelTextColor [color #FF000000]===> The color of the day label. 39 | > * calendar:dayLabelTextTodayColor [color #FFFFFFFF]===> The color of the current day label. 40 | > * calendar:dayLabelTextSize [dimension 10sp]===> The size of the day label. 41 | > * calendar:dayLabelCircleBgColor [color #FFFF0000]===> The background color of the current day label. 42 | > * calendar:dayLabelCircleRadius [dimension 8dp]===> The radius of the circle. 43 | > * calendar:monthDayRowHeight [dimension 145dp]===> The height of every detailed month. 44 | > * calendar:showYearLunarLabel [boolean true]===> Whether to show lunar label. 45 | 46 | ### Acknowledgements 47 | Thanks to RobinChutaux for his [CalendarListview](https://github.com/traex/CalendarListview) 48 | 49 | ### MIT License 50 | The MIT License (MIT) 51 | 52 | Copyright (c) 2015 guanchao wen 53 | 54 | Permission is hereby granted, free of charge, to any person obtaining a copy 55 | of this software and associated documentation files (the "Software"), to deal 56 | in the Software without restriction, including without limitation the rights 57 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 58 | copies of the Software, and to permit persons to whom the Software is 59 | furnished to do so, subject to the following conditions: 60 | 61 | The above copyright notice and this permission notice shall be included in 62 | all copies or substantial portions of the Software. 63 | 64 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 67 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 68 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 69 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 70 | THE SOFTWARE. -------------------------------------------------------------------------------- /images/sample1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/images/sample1.gif -------------------------------------------------------------------------------- /images/sample2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/images/sample2.gif -------------------------------------------------------------------------------- /library/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ScrollerCalendar 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /library/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /library/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /library/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /library/bin/ScrollerCalendar.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/ScrollerCalendar.apk -------------------------------------------------------------------------------- /library/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes.dex -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/BuildConfig.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/CalendarUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/CalendarUtils.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/CommonUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/CommonUtils.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/LunarYear.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/LunarYear.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/R$attr.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/R$color.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/R$color.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/R$dimen.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/R$dimen.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/R$drawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/R$drawable.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/R$id.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/R$id.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/R$layout.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/R$layout.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/R$menu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/R$menu.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/R$string.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/R$style.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/R$style.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/R$styleable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/R$styleable.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/R.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/ScrollerCalendar$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/ScrollerCalendar$1.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/ScrollerCalendar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/ScrollerCalendar.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/ScrollerCalendarController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/ScrollerCalendarController.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/YearAdapter$CalendarMonth.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/YearAdapter$CalendarMonth.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/YearAdapter$ViewHolder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/YearAdapter$ViewHolder.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/YearAdapter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/YearAdapter.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/YearView$OnMonthClickListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/YearView$OnMonthClickListener.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/YearView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/YearView.class -------------------------------------------------------------------------------- /library/bin/classes/wgc/shuwoom/scrollercalendar/demo/MainActivity.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/classes/wgc/shuwoom/scrollercalendar/demo/MainActivity.class -------------------------------------------------------------------------------- /library/bin/dexedLibs/android-support-v4-230153cc99f4594ddd013caf92365d0e.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/dexedLibs/android-support-v4-230153cc99f4594ddd013caf92365d0e.jar -------------------------------------------------------------------------------- /library/bin/dexedLibs/android-support-v4-b2c8fe38cf6eb1882feb5dda0df43489.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/dexedLibs/android-support-v4-b2c8fe38cf6eb1882feb5dda0df43489.jar -------------------------------------------------------------------------------- /library/bin/dexedLibs/android-support-v7-recyclerview-bd99f62b0806e3288bdb07efd2895a77.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/dexedLibs/android-support-v7-recyclerview-bd99f62b0806e3288bdb07efd2895a77.jar -------------------------------------------------------------------------------- /library/bin/dexedLibs/android-support-v7-recyclerview-f4e9506e0059e453914d09f682236ef0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/dexedLibs/android-support-v7-recyclerview-f4e9506e0059e453914d09f682236ef0.jar -------------------------------------------------------------------------------- /library/bin/jarlist.cache: -------------------------------------------------------------------------------- 1 | # cache for current jar dependency. DO NOT EDIT. 2 | # format is 3 | # Encoding is UTF-8 4 | -------------------------------------------------------------------------------- /library/bin/res/crunch/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/res/crunch/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/bin/res/crunch/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/res/crunch/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/bin/res/crunch/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/res/crunch/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/bin/res/crunch/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/res/crunch/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/bin/resources.ap_ -------------------------------------------------------------------------------- /library/gen/wgc/shuwoom/scrollercalendar/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package wgc.shuwoom.scrollercalendar; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /library/gen/wgc/shuwoom/scrollercalendar/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package wgc.shuwoom.scrollercalendar; 9 | 10 | public final class R { 11 | public static final class attr { 12 | /**

Must be a color value, in the form of "#rgb", "#argb", 13 | "#rrggbb", or "#aarrggbb". 14 |

This may also be a reference to a resource (in the form 15 | "@[package:]type:name") or 16 | theme attribute (in the form 17 | "?[package:][type:]name") 18 | containing a value of this type. 19 | */ 20 | public static final int dayLabelCircleBgColor=0x7f01000e; 21 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 22 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 23 | in (inches), mm (millimeters). 24 |

This may also be a reference to a resource (in the form 25 | "@[package:]type:name") or 26 | theme attribute (in the form 27 | "?[package:][type:]name") 28 | containing a value of this type. 29 | */ 30 | public static final int dayLabelCircleRadius=0x7f01000f; 31 | /**

Must be a color value, in the form of "#rgb", "#argb", 32 | "#rrggbb", or "#aarrggbb". 33 |

This may also be a reference to a resource (in the form 34 | "@[package:]type:name") or 35 | theme attribute (in the form 36 | "?[package:][type:]name") 37 | containing a value of this type. 38 | */ 39 | public static final int dayLabelTextColor=0x7f01000b; 40 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 41 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 42 | in (inches), mm (millimeters). 43 |

This may also be a reference to a resource (in the form 44 | "@[package:]type:name") or 45 | theme attribute (in the form 46 | "?[package:][type:]name") 47 | containing a value of this type. 48 | */ 49 | public static final int dayLabelTextSize=0x7f01000d; 50 | /**

Must be a color value, in the form of "#rgb", "#argb", 51 | "#rrggbb", or "#aarrggbb". 52 |

This may also be a reference to a resource (in the form 53 | "@[package:]type:name") or 54 | theme attribute (in the form 55 | "?[package:][type:]name") 56 | containing a value of this type. 57 | */ 58 | public static final int dayLabelTextTodayColor=0x7f01000c; 59 | /**

Must be a color value, in the form of "#rgb", "#argb", 60 | "#rrggbb", or "#aarrggbb". 61 |

This may also be a reference to a resource (in the form 62 | "@[package:]type:name") or 63 | theme attribute (in the form 64 | "?[package:][type:]name") 65 | containing a value of this type. 66 | */ 67 | public static final int dividerColor=0x7f010000; 68 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 69 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 70 | in (inches), mm (millimeters). 71 |

This may also be a reference to a resource (in the form 72 | "@[package:]type:name") or 73 | theme attribute (in the form 74 | "?[package:][type:]name") 75 | containing a value of this type. 76 | */ 77 | public static final int monthDayRowHeight=0x7f010010; 78 | /**

Must be a color value, in the form of "#rgb", "#argb", 79 | "#rrggbb", or "#aarrggbb". 80 |

This may also be a reference to a resource (in the form 81 | "@[package:]type:name") or 82 | theme attribute (in the form 83 | "?[package:][type:]name") 84 | containing a value of this type. 85 | */ 86 | public static final int monthLabelTextColor=0x7f010008; 87 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 88 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 89 | in (inches), mm (millimeters). 90 |

This may also be a reference to a resource (in the form 91 | "@[package:]type:name") or 92 | theme attribute (in the form 93 | "?[package:][type:]name") 94 | containing a value of this type. 95 | */ 96 | public static final int monthLabelTextHeight=0x7f01000a; 97 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 98 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 99 | in (inches), mm (millimeters). 100 |

This may also be a reference to a resource (in the form 101 | "@[package:]type:name") or 102 | theme attribute (in the form 103 | "?[package:][type:]name") 104 | containing a value of this type. 105 | */ 106 | public static final int monthLabelTextSize=0x7f010009; 107 | /**

Must be a boolean value, either "true" or "false". 108 |

This may also be a reference to a resource (in the form 109 | "@[package:]type:name") or 110 | theme attribute (in the form 111 | "?[package:][type:]name") 112 | containing a value of this type. 113 | */ 114 | public static final int showYearLunarLabel=0x7f010011; 115 | /**

Must be a color value, in the form of "#rgb", "#argb", 116 | "#rrggbb", or "#aarrggbb". 117 |

This may also be a reference to a resource (in the form 118 | "@[package:]type:name") or 119 | theme attribute (in the form 120 | "?[package:][type:]name") 121 | containing a value of this type. 122 | */ 123 | public static final int yearHeaderDashColor=0x7f010007; 124 | /**

Must be a color value, in the form of "#rgb", "#argb", 125 | "#rrggbb", or "#aarrggbb". 126 |

This may also be a reference to a resource (in the form 127 | "@[package:]type:name") or 128 | theme attribute (in the form 129 | "?[package:][type:]name") 130 | containing a value of this type. 131 | */ 132 | public static final int yearHeaderLunarTextColor=0x7f010004; 133 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 134 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 135 | in (inches), mm (millimeters). 136 |

This may also be a reference to a resource (in the form 137 | "@[package:]type:name") or 138 | theme attribute (in the form 139 | "?[package:][type:]name") 140 | containing a value of this type. 141 | */ 142 | public static final int yearHeaderLunarTextHeight=0x7f010005; 143 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 144 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 145 | in (inches), mm (millimeters). 146 |

This may also be a reference to a resource (in the form 147 | "@[package:]type:name") or 148 | theme attribute (in the form 149 | "?[package:][type:]name") 150 | containing a value of this type. 151 | */ 152 | public static final int yearHeaderLunarTextSize=0x7f010006; 153 | /**

Must be a color value, in the form of "#rgb", "#argb", 154 | "#rrggbb", or "#aarrggbb". 155 |

This may also be a reference to a resource (in the form 156 | "@[package:]type:name") or 157 | theme attribute (in the form 158 | "?[package:][type:]name") 159 | containing a value of this type. 160 | */ 161 | public static final int yearHeaderTextColor=0x7f010001; 162 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 163 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 164 | in (inches), mm (millimeters). 165 |

This may also be a reference to a resource (in the form 166 | "@[package:]type:name") or 167 | theme attribute (in the form 168 | "?[package:][type:]name") 169 | containing a value of this type. 170 | */ 171 | public static final int yearHeaderTextHeight=0x7f010002; 172 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 173 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 174 | in (inches), mm (millimeters). 175 |

This may also be a reference to a resource (in the form 176 | "@[package:]type:name") or 177 | theme attribute (in the form 178 | "?[package:][type:]name") 179 | containing a value of this type. 180 | */ 181 | public static final int yearHeaderTextSize=0x7f010003; 182 | } 183 | public static final class color { 184 | public static final int day_label_circle_bg_color=0x7f040007; 185 | public static final int day_label_text_color=0x7f040005; 186 | public static final int day_label_text_today_color=0x7f040006; 187 | public static final int divider_color=0x7f040001; 188 | public static final int month_labe_text_color=0x7f040004; 189 | public static final int year_header_dash_color=0x7f040003; 190 | public static final int year_header_lunar_text_color=0x7f040002; 191 | public static final int year_header_text_color=0x7f040000; 192 | } 193 | public static final class dimen { 194 | /** Default screen margins, per the Android Design guidelines. 195 | 196 | Example customization of dimensions originally defined in res/values/dimens.xml 197 | (such as screen margins) for screens with more than 820dp of available width. This 198 | would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). 199 | 200 | */ 201 | public static final int activity_horizontal_margin=0x7f050000; 202 | public static final int activity_vertical_margin=0x7f050001; 203 | public static final int day_label_circle_radius=0x7f050008; 204 | public static final int day_label_text_size=0x7f050007; 205 | public static final int month_day_row_height=0x7f050009; 206 | public static final int month_label_text_height=0x7f050006; 207 | public static final int month_label_text_size=0x7f050005; 208 | public static final int padding_between_day_and_day=0x7f05000a; 209 | public static final int year_header_lunar_text_size=0x7f050004; 210 | public static final int year_header_text_height=0x7f050002; 211 | public static final int year_header_text_size=0x7f050003; 212 | } 213 | public static final class drawable { 214 | public static final int ic_launcher=0x7f020000; 215 | } 216 | public static final class id { 217 | public static final int action_settings=0x7f090001; 218 | public static final int pickerView=0x7f090000; 219 | } 220 | public static final class layout { 221 | public static final int activity_main=0x7f030000; 222 | } 223 | public static final class menu { 224 | public static final int main=0x7f080000; 225 | } 226 | public static final class string { 227 | public static final int action_settings=0x7f060002; 228 | public static final int app_name=0x7f060000; 229 | public static final int hello_world=0x7f060001; 230 | } 231 | public static final class style { 232 | /** 233 | Base application theme, dependent on API level. This theme is replaced 234 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 235 | 236 | 237 | Theme customizations available in newer API levels can go in 238 | res/values-vXX/styles.xml, while customizations related to 239 | backward-compatibility can go here. 240 | 241 | 242 | Base application theme for API 11+. This theme completely replaces 243 | AppBaseTheme from res/values/styles.xml on API 11+ devices. 244 | 245 | API 11 theme customizations can go here. 246 | 247 | Base application theme for API 14+. This theme completely replaces 248 | AppBaseTheme from BOTH res/values/styles.xml and 249 | res/values-v11/styles.xml on API 14+ devices. 250 | 251 | API 14 theme customizations can go here. 252 | */ 253 | public static final int AppBaseTheme=0x7f070000; 254 | /** Application theme. 255 | All customizations that are NOT specific to a particular API-level can go here. 256 | */ 257 | public static final int AppTheme=0x7f070001; 258 | } 259 | public static final class styleable { 260 | /** Attributes that can be used with a ScrollerCalendar. 261 |

Includes the following attributes:

262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 |
AttributeDescription
{@link #ScrollerCalendar_dayLabelCircleBgColor wgc.shuwoom.scrollercalendar:dayLabelCircleBgColor}
{@link #ScrollerCalendar_dayLabelCircleRadius wgc.shuwoom.scrollercalendar:dayLabelCircleRadius}
{@link #ScrollerCalendar_dayLabelTextColor wgc.shuwoom.scrollercalendar:dayLabelTextColor}
{@link #ScrollerCalendar_dayLabelTextSize wgc.shuwoom.scrollercalendar:dayLabelTextSize}
{@link #ScrollerCalendar_dayLabelTextTodayColor wgc.shuwoom.scrollercalendar:dayLabelTextTodayColor}
{@link #ScrollerCalendar_dividerColor wgc.shuwoom.scrollercalendar:dividerColor}
{@link #ScrollerCalendar_monthDayRowHeight wgc.shuwoom.scrollercalendar:monthDayRowHeight}
{@link #ScrollerCalendar_monthLabelTextColor wgc.shuwoom.scrollercalendar:monthLabelTextColor}
{@link #ScrollerCalendar_monthLabelTextHeight wgc.shuwoom.scrollercalendar:monthLabelTextHeight}
{@link #ScrollerCalendar_monthLabelTextSize wgc.shuwoom.scrollercalendar:monthLabelTextSize}
{@link #ScrollerCalendar_showYearLunarLabel wgc.shuwoom.scrollercalendar:showYearLunarLabel}
{@link #ScrollerCalendar_yearHeaderDashColor wgc.shuwoom.scrollercalendar:yearHeaderDashColor}
{@link #ScrollerCalendar_yearHeaderLunarTextColor wgc.shuwoom.scrollercalendar:yearHeaderLunarTextColor}
{@link #ScrollerCalendar_yearHeaderLunarTextHeight wgc.shuwoom.scrollercalendar:yearHeaderLunarTextHeight}
{@link #ScrollerCalendar_yearHeaderLunarTextSize wgc.shuwoom.scrollercalendar:yearHeaderLunarTextSize}
{@link #ScrollerCalendar_yearHeaderTextColor wgc.shuwoom.scrollercalendar:yearHeaderTextColor}
{@link #ScrollerCalendar_yearHeaderTextHeight wgc.shuwoom.scrollercalendar:yearHeaderTextHeight}
{@link #ScrollerCalendar_yearHeaderTextSize wgc.shuwoom.scrollercalendar:yearHeaderTextSize}
285 | @see #ScrollerCalendar_dayLabelCircleBgColor 286 | @see #ScrollerCalendar_dayLabelCircleRadius 287 | @see #ScrollerCalendar_dayLabelTextColor 288 | @see #ScrollerCalendar_dayLabelTextSize 289 | @see #ScrollerCalendar_dayLabelTextTodayColor 290 | @see #ScrollerCalendar_dividerColor 291 | @see #ScrollerCalendar_monthDayRowHeight 292 | @see #ScrollerCalendar_monthLabelTextColor 293 | @see #ScrollerCalendar_monthLabelTextHeight 294 | @see #ScrollerCalendar_monthLabelTextSize 295 | @see #ScrollerCalendar_showYearLunarLabel 296 | @see #ScrollerCalendar_yearHeaderDashColor 297 | @see #ScrollerCalendar_yearHeaderLunarTextColor 298 | @see #ScrollerCalendar_yearHeaderLunarTextHeight 299 | @see #ScrollerCalendar_yearHeaderLunarTextSize 300 | @see #ScrollerCalendar_yearHeaderTextColor 301 | @see #ScrollerCalendar_yearHeaderTextHeight 302 | @see #ScrollerCalendar_yearHeaderTextSize 303 | */ 304 | public static final int[] ScrollerCalendar = { 305 | 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 306 | 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 307 | 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 308 | 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 309 | 0x7f010010, 0x7f010011 310 | }; 311 | /** 312 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dayLabelCircleBgColor} 313 | attribute's value can be found in the {@link #ScrollerCalendar} array. 314 | 315 | 316 |

Must be a color value, in the form of "#rgb", "#argb", 317 | "#rrggbb", or "#aarrggbb". 318 |

This may also be a reference to a resource (in the form 319 | "@[package:]type:name") or 320 | theme attribute (in the form 321 | "?[package:][type:]name") 322 | containing a value of this type. 323 | @attr name wgc.shuwoom.scrollercalendar:dayLabelCircleBgColor 324 | */ 325 | public static final int ScrollerCalendar_dayLabelCircleBgColor = 14; 326 | /** 327 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dayLabelCircleRadius} 328 | attribute's value can be found in the {@link #ScrollerCalendar} array. 329 | 330 | 331 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 332 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 333 | in (inches), mm (millimeters). 334 |

This may also be a reference to a resource (in the form 335 | "@[package:]type:name") or 336 | theme attribute (in the form 337 | "?[package:][type:]name") 338 | containing a value of this type. 339 | @attr name wgc.shuwoom.scrollercalendar:dayLabelCircleRadius 340 | */ 341 | public static final int ScrollerCalendar_dayLabelCircleRadius = 15; 342 | /** 343 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dayLabelTextColor} 344 | attribute's value can be found in the {@link #ScrollerCalendar} array. 345 | 346 | 347 |

Must be a color value, in the form of "#rgb", "#argb", 348 | "#rrggbb", or "#aarrggbb". 349 |

This may also be a reference to a resource (in the form 350 | "@[package:]type:name") or 351 | theme attribute (in the form 352 | "?[package:][type:]name") 353 | containing a value of this type. 354 | @attr name wgc.shuwoom.scrollercalendar:dayLabelTextColor 355 | */ 356 | public static final int ScrollerCalendar_dayLabelTextColor = 11; 357 | /** 358 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dayLabelTextSize} 359 | attribute's value can be found in the {@link #ScrollerCalendar} array. 360 | 361 | 362 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 363 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 364 | in (inches), mm (millimeters). 365 |

This may also be a reference to a resource (in the form 366 | "@[package:]type:name") or 367 | theme attribute (in the form 368 | "?[package:][type:]name") 369 | containing a value of this type. 370 | @attr name wgc.shuwoom.scrollercalendar:dayLabelTextSize 371 | */ 372 | public static final int ScrollerCalendar_dayLabelTextSize = 13; 373 | /** 374 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dayLabelTextTodayColor} 375 | attribute's value can be found in the {@link #ScrollerCalendar} array. 376 | 377 | 378 |

Must be a color value, in the form of "#rgb", "#argb", 379 | "#rrggbb", or "#aarrggbb". 380 |

This may also be a reference to a resource (in the form 381 | "@[package:]type:name") or 382 | theme attribute (in the form 383 | "?[package:][type:]name") 384 | containing a value of this type. 385 | @attr name wgc.shuwoom.scrollercalendar:dayLabelTextTodayColor 386 | */ 387 | public static final int ScrollerCalendar_dayLabelTextTodayColor = 12; 388 | /** 389 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dividerColor} 390 | attribute's value can be found in the {@link #ScrollerCalendar} array. 391 | 392 | 393 |

Must be a color value, in the form of "#rgb", "#argb", 394 | "#rrggbb", or "#aarrggbb". 395 |

This may also be a reference to a resource (in the form 396 | "@[package:]type:name") or 397 | theme attribute (in the form 398 | "?[package:][type:]name") 399 | containing a value of this type. 400 | @attr name wgc.shuwoom.scrollercalendar:dividerColor 401 | */ 402 | public static final int ScrollerCalendar_dividerColor = 0; 403 | /** 404 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#monthDayRowHeight} 405 | attribute's value can be found in the {@link #ScrollerCalendar} array. 406 | 407 | 408 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 409 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 410 | in (inches), mm (millimeters). 411 |

This may also be a reference to a resource (in the form 412 | "@[package:]type:name") or 413 | theme attribute (in the form 414 | "?[package:][type:]name") 415 | containing a value of this type. 416 | @attr name wgc.shuwoom.scrollercalendar:monthDayRowHeight 417 | */ 418 | public static final int ScrollerCalendar_monthDayRowHeight = 16; 419 | /** 420 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#monthLabelTextColor} 421 | attribute's value can be found in the {@link #ScrollerCalendar} array. 422 | 423 | 424 |

Must be a color value, in the form of "#rgb", "#argb", 425 | "#rrggbb", or "#aarrggbb". 426 |

This may also be a reference to a resource (in the form 427 | "@[package:]type:name") or 428 | theme attribute (in the form 429 | "?[package:][type:]name") 430 | containing a value of this type. 431 | @attr name wgc.shuwoom.scrollercalendar:monthLabelTextColor 432 | */ 433 | public static final int ScrollerCalendar_monthLabelTextColor = 8; 434 | /** 435 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#monthLabelTextHeight} 436 | attribute's value can be found in the {@link #ScrollerCalendar} array. 437 | 438 | 439 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 440 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 441 | in (inches), mm (millimeters). 442 |

This may also be a reference to a resource (in the form 443 | "@[package:]type:name") or 444 | theme attribute (in the form 445 | "?[package:][type:]name") 446 | containing a value of this type. 447 | @attr name wgc.shuwoom.scrollercalendar:monthLabelTextHeight 448 | */ 449 | public static final int ScrollerCalendar_monthLabelTextHeight = 10; 450 | /** 451 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#monthLabelTextSize} 452 | attribute's value can be found in the {@link #ScrollerCalendar} array. 453 | 454 | 455 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 456 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 457 | in (inches), mm (millimeters). 458 |

This may also be a reference to a resource (in the form 459 | "@[package:]type:name") or 460 | theme attribute (in the form 461 | "?[package:][type:]name") 462 | containing a value of this type. 463 | @attr name wgc.shuwoom.scrollercalendar:monthLabelTextSize 464 | */ 465 | public static final int ScrollerCalendar_monthLabelTextSize = 9; 466 | /** 467 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#showYearLunarLabel} 468 | attribute's value can be found in the {@link #ScrollerCalendar} array. 469 | 470 | 471 |

Must be a boolean value, either "true" or "false". 472 |

This may also be a reference to a resource (in the form 473 | "@[package:]type:name") or 474 | theme attribute (in the form 475 | "?[package:][type:]name") 476 | containing a value of this type. 477 | @attr name wgc.shuwoom.scrollercalendar:showYearLunarLabel 478 | */ 479 | public static final int ScrollerCalendar_showYearLunarLabel = 17; 480 | /** 481 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderDashColor} 482 | attribute's value can be found in the {@link #ScrollerCalendar} array. 483 | 484 | 485 |

Must be a color value, in the form of "#rgb", "#argb", 486 | "#rrggbb", or "#aarrggbb". 487 |

This may also be a reference to a resource (in the form 488 | "@[package:]type:name") or 489 | theme attribute (in the form 490 | "?[package:][type:]name") 491 | containing a value of this type. 492 | @attr name wgc.shuwoom.scrollercalendar:yearHeaderDashColor 493 | */ 494 | public static final int ScrollerCalendar_yearHeaderDashColor = 7; 495 | /** 496 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderLunarTextColor} 497 | attribute's value can be found in the {@link #ScrollerCalendar} array. 498 | 499 | 500 |

Must be a color value, in the form of "#rgb", "#argb", 501 | "#rrggbb", or "#aarrggbb". 502 |

This may also be a reference to a resource (in the form 503 | "@[package:]type:name") or 504 | theme attribute (in the form 505 | "?[package:][type:]name") 506 | containing a value of this type. 507 | @attr name wgc.shuwoom.scrollercalendar:yearHeaderLunarTextColor 508 | */ 509 | public static final int ScrollerCalendar_yearHeaderLunarTextColor = 4; 510 | /** 511 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderLunarTextHeight} 512 | attribute's value can be found in the {@link #ScrollerCalendar} array. 513 | 514 | 515 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 516 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 517 | in (inches), mm (millimeters). 518 |

This may also be a reference to a resource (in the form 519 | "@[package:]type:name") or 520 | theme attribute (in the form 521 | "?[package:][type:]name") 522 | containing a value of this type. 523 | @attr name wgc.shuwoom.scrollercalendar:yearHeaderLunarTextHeight 524 | */ 525 | public static final int ScrollerCalendar_yearHeaderLunarTextHeight = 5; 526 | /** 527 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderLunarTextSize} 528 | attribute's value can be found in the {@link #ScrollerCalendar} array. 529 | 530 | 531 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 532 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 533 | in (inches), mm (millimeters). 534 |

This may also be a reference to a resource (in the form 535 | "@[package:]type:name") or 536 | theme attribute (in the form 537 | "?[package:][type:]name") 538 | containing a value of this type. 539 | @attr name wgc.shuwoom.scrollercalendar:yearHeaderLunarTextSize 540 | */ 541 | public static final int ScrollerCalendar_yearHeaderLunarTextSize = 6; 542 | /** 543 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderTextColor} 544 | attribute's value can be found in the {@link #ScrollerCalendar} array. 545 | 546 | 547 |

Must be a color value, in the form of "#rgb", "#argb", 548 | "#rrggbb", or "#aarrggbb". 549 |

This may also be a reference to a resource (in the form 550 | "@[package:]type:name") or 551 | theme attribute (in the form 552 | "?[package:][type:]name") 553 | containing a value of this type. 554 | @attr name wgc.shuwoom.scrollercalendar:yearHeaderTextColor 555 | */ 556 | public static final int ScrollerCalendar_yearHeaderTextColor = 1; 557 | /** 558 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderTextHeight} 559 | attribute's value can be found in the {@link #ScrollerCalendar} array. 560 | 561 | 562 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 563 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 564 | in (inches), mm (millimeters). 565 |

This may also be a reference to a resource (in the form 566 | "@[package:]type:name") or 567 | theme attribute (in the form 568 | "?[package:][type:]name") 569 | containing a value of this type. 570 | @attr name wgc.shuwoom.scrollercalendar:yearHeaderTextHeight 571 | */ 572 | public static final int ScrollerCalendar_yearHeaderTextHeight = 2; 573 | /** 574 |

This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderTextSize} 575 | attribute's value can be found in the {@link #ScrollerCalendar} array. 576 | 577 | 578 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 579 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 580 | in (inches), mm (millimeters). 581 |

This may also be a reference to a resource (in the form 582 | "@[package:]type:name") or 583 | theme attribute (in the form 584 | "?[package:][type:]name") 585 | containing a value of this type. 586 | @attr name wgc.shuwoom.scrollercalendar:yearHeaderTextSize 587 | */ 588 | public static final int ScrollerCalendar_yearHeaderTextSize = 3; 589 | }; 590 | } 591 | -------------------------------------------------------------------------------- /library/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/ic_launcher-web.png -------------------------------------------------------------------------------- /library/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/libs/android-support-v4.jar -------------------------------------------------------------------------------- /library/libs/android-support-v7-recyclerview.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/libs/android-support-v7-recyclerview.jar -------------------------------------------------------------------------------- /library/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /library/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-21 15 | -------------------------------------------------------------------------------- /library/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/ScrollerCalendar/5dbc1ced82202330bc6f428d41e7a6cce93109be/library/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /library/res/menu/main.xml: -------------------------------------------------------------------------------- 1 |

4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /library/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /library/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /library/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | #FF000000 6 | #FFDDDDDD 7 | #FFCCCCCC 8 | #FFFF0000 9 | #FFFF0000 10 | 11 | #FF000000 12 | #FFFFFFFF 13 | 14 | #FFFF0000 15 | -------------------------------------------------------------------------------- /library/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 40dp 8 | 34sp 9 | 12sp 10 | 16sp 11 | 35dp 12 | 10sp 13 | 8dp 14 | 145dp 15 | 20dp 16 | 17 | 18 | -------------------------------------------------------------------------------- /library/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ScrollerCalendar 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /library/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /library/src/wgc/shuwoom/scrollercalendar/CalendarUtils.java: -------------------------------------------------------------------------------- 1 | package wgc.shuwoom.scrollercalendar; 2 | 3 | import java.util.Calendar; 4 | 5 | 6 | public class CalendarUtils 7 | { 8 | public static int getDaysInMonth(int month, int year) { 9 | switch (month) { 10 | case Calendar.JANUARY: 11 | case Calendar.MARCH: 12 | case Calendar.MAY: 13 | case Calendar.JULY: 14 | case Calendar.AUGUST: 15 | case Calendar.OCTOBER: 16 | case Calendar.DECEMBER: 17 | return 31; 18 | case Calendar.APRIL: 19 | case Calendar.JUNE: 20 | case Calendar.SEPTEMBER: 21 | case Calendar.NOVEMBER: 22 | return 30; 23 | case Calendar.FEBRUARY: 24 | return (( (year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) ? 29 : 28; 25 | default: 26 | throw new IllegalArgumentException("Invalid Month"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /library/src/wgc/shuwoom/scrollercalendar/CommonUtils.java: -------------------------------------------------------------------------------- 1 | package wgc.shuwoom.scrollercalendar; 2 | 3 | import android.content.Context; 4 | 5 | public class CommonUtils { 6 | /** 7 | * Transform px value into dip or dp 8 | * 9 | * @param pxValue 10 | * @param scale 11 | * @return dip or dp value 12 | */ 13 | public static int px2dp(Context context, float pxValue) { 14 | final float scale = context.getResources().getDisplayMetrics().density; 15 | return (int) (pxValue / scale + 0.5f); 16 | } 17 | 18 | /** 19 | * Transform dip or dp value into px 20 | * 21 | * @param dipValue 22 | * @param scale 23 | * @return px value 24 | */ 25 | public static int dp2px(Context context, float dipValue) { 26 | final float scale = context.getResources().getDisplayMetrics().density; 27 | return (int) (dipValue * scale + 0.5f); 28 | } 29 | 30 | /** 31 | * Transform px value into sp value 32 | * 33 | * @param pxValue 34 | * @param fontScale 35 | * @return sp value 36 | */ 37 | public static int px2sp(Context context, float pxValue) { 38 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; 39 | return (int) (pxValue / fontScale + 0.5f); 40 | } 41 | 42 | /** 43 | * Transform sp value into px value 44 | * 45 | * @param spValue 46 | * @param fontScale 47 | * @return px value 48 | */ 49 | public static int sp2px(Context context, float spValue) { 50 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; 51 | return (int) (spValue * fontScale + 0.5f); 52 | } 53 | } -------------------------------------------------------------------------------- /library/src/wgc/shuwoom/scrollercalendar/LunarYear.java: -------------------------------------------------------------------------------- 1 | package wgc.shuwoom.scrollercalendar; 2 | 3 | 4 | public class LunarYear { 5 | private int year; 6 | public LunarYear(){ 7 | 8 | } 9 | 10 | public LunarYear(int year){ 11 | this.year = year; 12 | } 13 | 14 | 15 | final public String animalsYear() { 16 | final String[] Animals = new String[]{"鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"}; 17 | return Animals[(year - 4) % 12]; 18 | } 19 | 20 | 21 | final private static String cyclicalm(int num) { 22 | final String[] Gan = new String[]{"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"}; 23 | final String[] Zhi = new String[]{"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"}; 24 | return (Gan[num % 10] + Zhi[num % 12]); 25 | } 26 | 27 | final public String cyclical() { 28 | int num = year - 1900 + 36; 29 | return (cyclicalm(num)); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /library/src/wgc/shuwoom/scrollercalendar/ScrollerCalendar.java: -------------------------------------------------------------------------------- 1 | package wgc.shuwoom.scrollercalendar; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Context; 5 | import android.content.res.TypedArray; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.util.AttributeSet; 9 | 10 | import wgc.shuwoom.scrollercalendar.R; 11 | import wgc.shuwoom.scrollercalendar.YearAdapter.CalendarMonth; 12 | 13 | public class ScrollerCalendar extends RecyclerView 14 | { 15 | private YearAdapter yearAdapter; 16 | private TypedArray typedArray; 17 | private OnScrollListener onScrollListener; 18 | private ScrollerCalendarController scrollerCalendarController; 19 | 20 | public ScrollerCalendar(Context context) 21 | { 22 | this(context, null); 23 | } 24 | 25 | public ScrollerCalendar(Context context, AttributeSet attrs) 26 | { 27 | this(context, attrs, 0); 28 | } 29 | 30 | @SuppressLint("Recycle") 31 | public ScrollerCalendar(Context context, AttributeSet attrs, int defStyle) 32 | { 33 | super(context, attrs, defStyle); 34 | if (!isInEditMode()) 35 | { 36 | typedArray = context.obtainStyledAttributes(attrs, R.styleable.ScrollerCalendar); 37 | setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); 38 | init(context); 39 | } 40 | } 41 | 42 | public void init(Context paramContext) { 43 | setLayoutManager(new LinearLayoutManager(paramContext)); 44 | setUpListView(); 45 | 46 | onScrollListener = new RecyclerView.OnScrollListener() 47 | { 48 | @Override 49 | public void onScrolled(RecyclerView recyclerView, int dx, int dy) 50 | { 51 | 52 | super.onScrolled(recyclerView, dx, dy); 53 | final YearView child = (YearView) recyclerView.getChildAt(0); 54 | if (child == null) { 55 | return; 56 | } 57 | } 58 | }; 59 | 60 | } 61 | 62 | public void setController(ScrollerCalendarController scrollerCalendarController) 63 | { 64 | this.scrollerCalendarController = scrollerCalendarController; 65 | setUpAdapter(); 66 | setAdapter(yearAdapter); 67 | } 68 | 69 | public CalendarMonth getSelectedMonths() 70 | { 71 | return yearAdapter.getSelectedMonths(); 72 | } 73 | 74 | public ScrollerCalendarController getController() 75 | { 76 | return scrollerCalendarController; 77 | } 78 | 79 | public TypedArray getTypedArray() 80 | { 81 | return typedArray; 82 | } 83 | 84 | private void setUpAdapter() { 85 | if (yearAdapter == null) { 86 | yearAdapter = new YearAdapter(getContext(), scrollerCalendarController, typedArray); 87 | } 88 | scrollToPosition(yearAdapter.getYearRange() / 2); 89 | yearAdapter.notifyDataSetChanged(); 90 | } 91 | 92 | private void setUpListView() { 93 | setVerticalScrollBarEnabled(false); 94 | setOnScrollListener(onScrollListener); 95 | setFadingEdgeLength(0); 96 | } 97 | } -------------------------------------------------------------------------------- /library/src/wgc/shuwoom/scrollercalendar/ScrollerCalendarController.java: -------------------------------------------------------------------------------- 1 | package wgc.shuwoom.scrollercalendar; 2 | 3 | public interface ScrollerCalendarController { 4 | 5 | public abstract void onMonthOfYearSelected(int year, int month); 6 | 7 | } -------------------------------------------------------------------------------- /library/src/wgc/shuwoom/scrollercalendar/YearAdapter.java: -------------------------------------------------------------------------------- 1 | package wgc.shuwoom.scrollercalendar; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.MotionEvent; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.view.ViewGroup.LayoutParams; 10 | import android.widget.AbsListView; 11 | 12 | import java.io.Serializable; 13 | import java.util.Calendar; 14 | import java.util.Date; 15 | import java.util.HashMap; 16 | 17 | 18 | 19 | 20 | 21 | public class YearAdapter extends RecyclerView.Adapter implements YearView.OnMonthClickListener { 22 | protected static final int MONTHS_IN_YEAR = 12; 23 | private final TypedArray typedArray; 24 | private final Context context; 25 | private final ScrollerCalendarController scrollerCalendarController; 26 | private final Calendar calendar; 27 | private CalendarMonth selectedMonth; 28 | 29 | private YearView currentYearView; 30 | private final int yearRange; 31 | 32 | public YearAdapter(Context context, ScrollerCalendarController datePickerController, TypedArray typedArray) { 33 | yearRange = 200; 34 | this.typedArray = typedArray; 35 | this.context = context; 36 | calendar = Calendar.getInstance(); 37 | selectedMonth = new CalendarMonth(); 38 | scrollerCalendarController = datePickerController; 39 | } 40 | 41 | @Override 42 | public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) 43 | { 44 | final YearView yearView = new YearView(context, typedArray); 45 | return new ViewHolder(yearView, this); 46 | } 47 | 48 | @Override 49 | public void onBindViewHolder(ViewHolder viewHolder, int position) 50 | { 51 | final YearView yearView = viewHolder.yearView; 52 | final HashMap drawingParams = new HashMap(); 53 | int currentYear; 54 | currentYear = 2015 + (position - yearRange / 2); 55 | yearView.reuse(); 56 | drawingParams.put(YearView.VIEW_PARAMS_YEAR_CURRENT, currentYear); 57 | drawingParams.put(YearView.VIEW_PARAMS_WEEK_START, calendar.getFirstDayOfWeek()); 58 | yearView.setYearParams(drawingParams); 59 | yearView.invalidate(); 60 | 61 | currentYearView = yearView; 62 | } 63 | 64 | public long getItemId(int position) { 65 | return position; 66 | } 67 | 68 | public YearView getYearView(){ 69 | return currentYearView; 70 | } 71 | 72 | @Override 73 | public int getItemCount() 74 | { 75 | return yearRange; 76 | } 77 | 78 | public void onMonthClick(YearView yearView, CalendarMonth calendarMonth) { 79 | if (calendarMonth != null) { 80 | onMonthTapped(calendarMonth); 81 | } 82 | } 83 | 84 | protected void onMonthTapped(CalendarMonth calendarMonth) { 85 | scrollerCalendarController.onMonthOfYearSelected(calendarMonth.year, calendarMonth.month); 86 | setSelectedMonth(calendarMonth); 87 | notifyDataSetChanged(); 88 | } 89 | 90 | public void setSelectedMonth(CalendarMonth calendarMonth) { 91 | selectedMonth = calendarMonth; 92 | notifyDataSetChanged(); 93 | } 94 | 95 | public CalendarMonth getSelectedMonths() { 96 | return selectedMonth; 97 | } 98 | 99 | public int getYearRange(){ 100 | return yearRange; 101 | } 102 | 103 | public static class ViewHolder extends RecyclerView.ViewHolder 104 | { 105 | final YearView yearView; 106 | 107 | public ViewHolder(View itemView, YearView.OnMonthClickListener onMonthClickListener) 108 | { 109 | super(itemView); 110 | yearView = (YearView) itemView; 111 | yearView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); 112 | yearView.setClickable(true); 113 | yearView.setOnMonthClickListener(onMonthClickListener); 114 | } 115 | } 116 | 117 | 118 | 119 | 120 | public static class CalendarMonth implements Serializable 121 | { 122 | private static final long serialVersionUID = -5456695978688356202L; 123 | private Calendar calendar; 124 | 125 | int month; 126 | int year; 127 | 128 | 129 | public CalendarMonth() { 130 | setTime(System.currentTimeMillis()); 131 | } 132 | 133 | public CalendarMonth(int year, int month) { 134 | setDay(year, month); 135 | } 136 | 137 | public CalendarMonth(int year, int month,MotionEvent event) { 138 | setDay(year, month); 139 | } 140 | 141 | public CalendarMonth(long timeInMillis) { 142 | setTime(timeInMillis); 143 | } 144 | 145 | public CalendarMonth(Calendar calendar) { 146 | year = calendar.get(Calendar.YEAR); 147 | month = calendar.get(Calendar.MONTH); 148 | } 149 | 150 | private void setTime(long timeInMillis) { 151 | if (calendar == null) { 152 | calendar = Calendar.getInstance(); 153 | } 154 | calendar.setTimeInMillis(timeInMillis); 155 | month = this.calendar.get(Calendar.MONTH); 156 | year = this.calendar.get(Calendar.YEAR); 157 | } 158 | 159 | public void set(CalendarMonth calendarDay) { 160 | year = calendarDay.year; 161 | month = calendarDay.month; 162 | } 163 | 164 | public void setDay(int year, int month) { 165 | this.year = year; 166 | this.month = month; 167 | } 168 | 169 | public Date getDate() 170 | { 171 | if (calendar == null) { 172 | calendar = Calendar.getInstance(); 173 | } 174 | calendar.set(year, month); 175 | return calendar.getTime(); 176 | } 177 | 178 | 179 | @Override 180 | public String toString() 181 | { 182 | final StringBuilder stringBuilder = new StringBuilder(); 183 | stringBuilder.append("{ year: "); 184 | stringBuilder.append(year); 185 | stringBuilder.append(", month: "); 186 | stringBuilder.append(month); 187 | stringBuilder.append(" }"); 188 | 189 | return stringBuilder.toString(); 190 | } 191 | } 192 | 193 | 194 | 195 | } -------------------------------------------------------------------------------- /library/src/wgc/shuwoom/scrollercalendar/YearView.java: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * The MIT License (MIT) 3 | 4 | * Copyright (c) 2014 Robin Chutaux 5 | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | ***********************************************************************************/ 24 | package wgc.shuwoom.scrollercalendar; 25 | 26 | import java.security.InvalidParameterException; 27 | import java.util.Calendar; 28 | import java.util.HashMap; 29 | 30 | import android.annotation.SuppressLint; 31 | import android.app.Activity; 32 | import android.content.Context; 33 | import android.content.res.Resources; 34 | import android.content.res.TypedArray; 35 | import android.graphics.Canvas; 36 | import android.graphics.Paint; 37 | import android.graphics.Paint.Align; 38 | import android.graphics.Paint.Style; 39 | import android.graphics.Rect; 40 | import android.text.format.Time; 41 | import android.view.MotionEvent; 42 | import android.view.View; 43 | import android.view.Window; 44 | import android.view.WindowManager; 45 | 46 | import wgc.shuwoom.scrollercalendar.R; 47 | import wgc.shuwoom.scrollercalendar.CommonUtils; 48 | import wgc.shuwoom.scrollercalendar.LunarYear; 49 | 50 | 51 | public class YearView extends View { 52 | public static final String VIEW_PARAMS_YEAR_CURRENT = "current"; 53 | public static final String VIEW_PARAMS_WEEK_START = "week_start"; 54 | 55 | protected static int DAY_LABEL_CIRCLE_RADIUS; 56 | protected static int MONTH_HEADER_HEIGHT; 57 | protected static int YEAR_HEADER_TEXT_HEIGHT; 58 | 59 | 60 | protected static int YEAR_HEADER_TEXT_SIZE; 61 | protected static int YEAR_HEADER_LUNAR_TEXT_SIZE; 62 | protected static int MONTH_LABEL_TEXT_SIZE; 63 | protected static int DAY_LABEL_TEXT_SIZE; 64 | 65 | protected int padding = 0; 66 | protected int lineSpacingBetweenYearAndMonth = 0; 67 | protected int lineSpacingBetweenDayAndDay = 0; 68 | 69 | protected Paint yearHeaderTextPaint; 70 | protected Paint dividerPaint; 71 | protected Paint yearHeaderLunarTextPaint; 72 | protected Paint yearHeaderDashPaint; 73 | protected Paint monthLabelTextPaint; 74 | protected Paint dayLabelTextPaint; 75 | protected Paint dayLabelCircleBgPaint; 76 | 77 | protected int yearHeaderTextColor; 78 | protected int dividerColor; 79 | protected int yearHeaderLunarTextColor; 80 | protected int yearHeaderDashColor; 81 | protected int monthTextColor; 82 | protected int dayLabelTextColor; 83 | protected int dayLabelTextTodayColor; 84 | protected int dayLabelCircleBgColor; 85 | 86 | protected int today = -1; 87 | protected int weekStart = 1; 88 | protected int numDays = 7; 89 | protected int numCells = 0; 90 | private int dayOfWeekStart = 0; 91 | protected int month; 92 | protected int year; 93 | 94 | protected int rowMonthHeight; 95 | protected int mWidth; 96 | 97 | protected final Time currentTime; 98 | 99 | private int width; 100 | 101 | private Context mContext; 102 | private final Calendar calendar; 103 | private boolean showYearLunarLabel; 104 | 105 | private OnMonthClickListener mOnMonthClickListener; 106 | 107 | 108 | public YearView(Context context, TypedArray typedArray) { 109 | super(context); 110 | mContext = context; 111 | Resources resources = context.getResources(); 112 | calendar = Calendar.getInstance(); 113 | currentTime = new Time(Time.getCurrentTimezone()); 114 | currentTime.setToNow(); 115 | 116 | dividerColor = typedArray.getColor( 117 | R.styleable.ScrollerCalendar_dividerColor, 118 | resources.getColor(R.color.divider_color)); 119 | yearHeaderTextColor = typedArray.getColor( 120 | R.styleable.ScrollerCalendar_yearHeaderTextColor, 121 | resources.getColor(R.color.year_header_text_color)); 122 | yearHeaderLunarTextColor = typedArray.getColor( 123 | R.styleable.ScrollerCalendar_yearHeaderLunarTextColor, 124 | resources.getColor(R.color.year_header_lunar_text_color)); 125 | yearHeaderDashColor = typedArray.getColor( 126 | R.styleable.ScrollerCalendar_yearHeaderDashColor, 127 | resources.getColor(R.color.year_header_dash_color)); 128 | monthTextColor = typedArray.getColor( 129 | R.styleable.ScrollerCalendar_monthLabelTextColor, 130 | resources.getColor(R.color.month_labe_text_color)); 131 | dayLabelTextColor = typedArray.getColor( 132 | R.styleable.ScrollerCalendar_dayLabelTextColor, 133 | resources.getColor(R.color.day_label_text_color)); 134 | dayLabelTextTodayColor = typedArray.getColor( 135 | R.styleable.ScrollerCalendar_dayLabelTextTodayColor, 136 | resources.getColor(R.color.day_label_text_today_color)); 137 | dayLabelCircleBgColor = typedArray.getColor( 138 | R.styleable.ScrollerCalendar_dayLabelCircleBgColor, 139 | resources.getColor(R.color.day_label_circle_bg_color)); 140 | 141 | YEAR_HEADER_TEXT_SIZE = typedArray.getDimensionPixelSize( 142 | R.styleable.ScrollerCalendar_yearHeaderTextSize, 143 | resources.getDimensionPixelSize(R.dimen.year_header_text_size)); 144 | YEAR_HEADER_LUNAR_TEXT_SIZE = typedArray.getDimensionPixelSize( 145 | R.styleable.ScrollerCalendar_yearHeaderLunarTextSize, 146 | resources.getDimensionPixelSize(R.dimen.year_header_lunar_text_size)); 147 | DAY_LABEL_TEXT_SIZE = typedArray.getDimensionPixelSize( 148 | R.styleable.ScrollerCalendar_dayLabelTextSize, 149 | resources.getDimensionPixelSize(R.dimen.day_label_text_size)); 150 | MONTH_LABEL_TEXT_SIZE = typedArray.getDimensionPixelSize( 151 | R.styleable.ScrollerCalendar_monthLabelTextSize, 152 | resources.getDimensionPixelSize(R.dimen.month_label_text_size)); 153 | 154 | YEAR_HEADER_TEXT_HEIGHT = typedArray.getDimensionPixelSize( 155 | R.styleable.ScrollerCalendar_yearHeaderTextHeight, 156 | resources.getDimensionPixelOffset(R.dimen.year_header_text_height)); 157 | MONTH_HEADER_HEIGHT = typedArray.getDimensionPixelOffset( 158 | R.styleable.ScrollerCalendar_monthLabelTextHeight, 159 | resources.getDimensionPixelSize(R.dimen.month_label_text_height)); 160 | DAY_LABEL_CIRCLE_RADIUS = typedArray.getDimensionPixelSize( 161 | R.styleable.ScrollerCalendar_dayLabelCircleRadius, 162 | resources.getDimensionPixelSize(R.dimen.day_label_circle_radius)); 163 | 164 | rowMonthHeight = typedArray.getDimensionPixelSize( 165 | R.styleable.ScrollerCalendar_monthDayRowHeight, 166 | resources.getDimensionPixelSize(R.dimen.month_day_row_height)); 167 | lineSpacingBetweenDayAndDay = 168 | resources.getDimensionPixelSize(R.dimen.padding_between_day_and_day); 169 | showYearLunarLabel = typedArray.getBoolean( 170 | R.styleable.ScrollerCalendar_showYearLunarLabel,false); 171 | padding = CommonUtils.dp2px(mContext, 5); 172 | lineSpacingBetweenYearAndMonth = CommonUtils.dp2px(mContext, 10); 173 | initView(); 174 | 175 | } 176 | 177 | public int getMonth() { 178 | return month; 179 | } 180 | 181 | public int calculateNumRows() { 182 | int offset = findDayOffset(); 183 | int dividend = (offset + numCells) / numDays; 184 | int remainder = (offset + numCells) % numDays; 185 | return (dividend + (remainder > 0 ? 1 : 0)); 186 | } 187 | 188 | private void drawYearHeaderLabels(Canvas canvas) { 189 | int y = (4 * YEAR_HEADER_TEXT_HEIGHT) / 5; 190 | LunarYear lunar = new LunarYear(year); 191 | 192 | canvas.drawText(year + "年", 2 * padding, y, yearHeaderTextPaint); 193 | 194 | if(showYearLunarLabel){ 195 | yearHeaderDashPaint.setStrokeWidth((float) 4.0); 196 | canvas.drawLine(width - 5 * YEAR_HEADER_LUNAR_TEXT_SIZE - 2 197 | * padding, (3 * y) / 8, width - 5 198 | * YEAR_HEADER_LUNAR_TEXT_SIZE, (3 * y) / 8, yearHeaderDashPaint); 199 | canvas.drawText(lunar.cyclical() + lunar.animalsYear() + "年", width - 2 200 | * padding, y / 2, yearHeaderLunarTextPaint); 201 | 202 | yearHeaderDashPaint.setStrokeWidth((float) 2.0); 203 | canvas.drawLine(width - 5 * YEAR_HEADER_LUNAR_TEXT_SIZE - 2 204 | * padding, (7 * y) / 8, width - 5 205 | * YEAR_HEADER_LUNAR_TEXT_SIZE, (7 * y) / 8, yearHeaderDashPaint); 206 | canvas.drawText("农历初一", width - 2 * padding, y, 207 | yearHeaderLunarTextPaint); 208 | } 209 | 210 | canvas.drawLine(2 * padding, YEAR_HEADER_TEXT_HEIGHT, width, 211 | YEAR_HEADER_TEXT_HEIGHT, dividerPaint); 212 | } 213 | 214 | private void drawMonthTitle(Canvas canvas) { 215 | int paddingDay = (mWidth - 2 * padding) / (2 * numDays); 216 | 217 | int x = padding; 218 | int y = 0; 219 | 220 | for (int i = 1; i <= 12; i++) { 221 | 222 | switch (i) { 223 | case 1: 224 | case 2: 225 | case 3: 226 | x = paddingDay + (width / 3) * (i - 1); 227 | y = (MONTH_HEADER_HEIGHT) / 2 + YEAR_HEADER_TEXT_HEIGHT 228 | + lineSpacingBetweenYearAndMonth; 229 | break; 230 | case 4: 231 | case 5: 232 | case 6: 233 | x = paddingDay + (width / 3) * (i - 4); 234 | y = (MONTH_HEADER_HEIGHT) / 2 + YEAR_HEADER_TEXT_HEIGHT 235 | + lineSpacingBetweenYearAndMonth + rowMonthHeight * 1; 236 | break; 237 | case 7: 238 | case 8: 239 | case 9: 240 | x = paddingDay + (width / 3) * (i - 7); 241 | y = (MONTH_HEADER_HEIGHT) / 2 + YEAR_HEADER_TEXT_HEIGHT 242 | + lineSpacingBetweenYearAndMonth + rowMonthHeight * 2; 243 | break; 244 | case 10: 245 | case 11: 246 | case 12: 247 | x = paddingDay + (width / 3) * (i - 10); 248 | y = (MONTH_HEADER_HEIGHT) / 2 + YEAR_HEADER_TEXT_HEIGHT 249 | + lineSpacingBetweenYearAndMonth + rowMonthHeight * 3; 250 | break; 251 | } 252 | 253 | canvas.drawText(i + "月", x, y, monthLabelTextPaint); 254 | } 255 | } 256 | 257 | private void drawAllMonthNums(Canvas canvas) { 258 | int y = MONTH_HEADER_HEIGHT + YEAR_HEADER_TEXT_HEIGHT + lineSpacingBetweenYearAndMonth; 259 | int paddingDay = (mWidth / 3 - 2 * padding) / (2 * numDays); 260 | int day = 1; 261 | 262 | for (int i = 0; i < 12; i++) { 263 | 264 | switch (i) { 265 | case 0: 266 | case 1: 267 | case 2: 268 | y = MONTH_HEADER_HEIGHT + YEAR_HEADER_TEXT_HEIGHT 269 | + lineSpacingBetweenYearAndMonth; 270 | break; 271 | case 3: 272 | case 4: 273 | case 5: 274 | y = MONTH_HEADER_HEIGHT + YEAR_HEADER_TEXT_HEIGHT 275 | + lineSpacingBetweenYearAndMonth + rowMonthHeight * 1; 276 | break; 277 | case 6: 278 | case 7: 279 | case 8: 280 | y = MONTH_HEADER_HEIGHT + YEAR_HEADER_TEXT_HEIGHT 281 | + lineSpacingBetweenYearAndMonth + rowMonthHeight * 2; 282 | break; 283 | case 9: 284 | case 10: 285 | case 11: 286 | y = MONTH_HEADER_HEIGHT + YEAR_HEADER_TEXT_HEIGHT 287 | + lineSpacingBetweenYearAndMonth + rowMonthHeight * 3; 288 | break; 289 | } 290 | 291 | setYearParams(year, i); 292 | int dayOffset = findDayOffset(); 293 | day = 1; 294 | 295 | while (day <= numCells) { 296 | int column = 0; 297 | switch (i) { 298 | case 0: 299 | case 3: 300 | case 6: 301 | case 9: 302 | column = 0; 303 | break; 304 | case 1: 305 | case 4: 306 | case 7: 307 | case 10: 308 | column = 1; 309 | break; 310 | case 2: 311 | case 5: 312 | case 8: 313 | case 11: 314 | column = 2; 315 | break; 316 | } 317 | 318 | int x = paddingDay * (1 + dayOffset * 2) + (column * width) / 3 319 | + paddingDay; 320 | 321 | canvas.drawText(String.format("%d", day), x, y, dayLabelTextPaint); 322 | 323 | if ( today == day) { 324 | canvas.drawCircle(x+CommonUtils.dp2px(mContext, 1), y - CommonUtils.dp2px(mContext, 4), 325 | DAY_LABEL_CIRCLE_RADIUS, dayLabelCircleBgPaint); 326 | 327 | dayLabelTextPaint.setColor(dayLabelTextTodayColor); 328 | canvas.drawText(String.format("%d", day), x, y, 329 | dayLabelTextPaint); 330 | dayLabelTextPaint.setColor(dayLabelTextColor); 331 | } 332 | 333 | dayOffset++; 334 | 335 | if (dayOffset == numDays) { 336 | dayOffset = 0; 337 | y += lineSpacingBetweenDayAndDay; 338 | } 339 | day++; 340 | }// end of while 341 | 342 | }// end of for 343 | } 344 | 345 | private int findDayOffset() { 346 | return (dayOfWeekStart < weekStart ? (dayOfWeekStart + numDays) 347 | : dayOfWeekStart) - weekStart; 348 | } 349 | 350 | private void onDayClick(YearAdapter.CalendarMonth calendarMonth) { 351 | if (mOnMonthClickListener != null) { 352 | mOnMonthClickListener.onMonthClick(this, calendarMonth); 353 | } 354 | } 355 | 356 | private boolean isToday(int monthDay, Time time) { 357 | return (year == time.year) && (month == time.month) 358 | && (monthDay == time.monthDay); 359 | } 360 | 361 | 362 | 363 | 364 | 365 | public YearAdapter.CalendarMonth getMonthFromLocation( 366 | MotionEvent event) { 367 | float x = event.getX(); 368 | float y = event.getY(); 369 | int month = 0; 370 | int columnWidth = width / 3; 371 | 372 | if (y < YEAR_HEADER_TEXT_HEIGHT) { 373 | return null; 374 | } 375 | 376 | if ((y <= YEAR_HEADER_TEXT_HEIGHT + rowMonthHeight)) { 377 | if (x <= columnWidth) { 378 | month = 0; 379 | } 380 | if ((x < 2 * columnWidth) && (x > columnWidth)) { 381 | month = 1; 382 | } 383 | if ((x <= 3 * columnWidth) && (x >= 2 * columnWidth)) { 384 | month = 2; 385 | } 386 | } 387 | if ((y <= YEAR_HEADER_TEXT_HEIGHT + 2 * rowMonthHeight) 388 | && (y > YEAR_HEADER_TEXT_HEIGHT + rowMonthHeight)) { 389 | if (x <= columnWidth) { 390 | month = 3; 391 | } 392 | if ((x < 2 * columnWidth) && (x > columnWidth)) { 393 | month = 4; 394 | } 395 | if ((x <= 3 * columnWidth) && (x >= 2 * columnWidth)) { 396 | month = 5; 397 | } 398 | } 399 | 400 | if ((y <= YEAR_HEADER_TEXT_HEIGHT + 3 * rowMonthHeight) 401 | && (y > YEAR_HEADER_TEXT_HEIGHT + 2 * rowMonthHeight)) { 402 | if (x <= columnWidth) { 403 | month = 6; 404 | } 405 | if ((x < 2 * columnWidth) && (x > columnWidth)) { 406 | month = 7; 407 | } 408 | if ((x <= 3 * columnWidth) && (x >= 2 * columnWidth)) { 409 | month = 8; 410 | } 411 | } 412 | 413 | if ((y <= YEAR_HEADER_TEXT_HEIGHT + 4 * rowMonthHeight) 414 | && (y >= YEAR_HEADER_TEXT_HEIGHT + 3 * rowMonthHeight)) { 415 | if (x <= columnWidth) { 416 | month = 9; 417 | } 418 | if ((x < 2 * columnWidth) && (x > columnWidth)) { 419 | month = 10; 420 | } 421 | if ((x <= 3 * columnWidth) && (x >= 2 * columnWidth)) { 422 | month = 11; 423 | } 424 | } 425 | 426 | return new YearAdapter.CalendarMonth(year, month, event); 427 | } 428 | 429 | protected void initView() { 430 | monthLabelTextPaint = new Paint(); 431 | monthLabelTextPaint.setFakeBoldText(true); 432 | monthLabelTextPaint.setAntiAlias(true); 433 | monthLabelTextPaint.setTextSize(MONTH_LABEL_TEXT_SIZE); 434 | monthLabelTextPaint.setColor(monthTextColor); 435 | monthLabelTextPaint.setTextAlign(Align.CENTER); 436 | monthLabelTextPaint.setStyle(Style.FILL); 437 | 438 | dayLabelCircleBgPaint = new Paint(); 439 | dayLabelCircleBgPaint.setFakeBoldText(true); 440 | dayLabelCircleBgPaint.setAntiAlias(true); 441 | dayLabelCircleBgPaint.setColor(dayLabelCircleBgColor); 442 | dayLabelCircleBgPaint.setTextAlign(Align.CENTER); 443 | dayLabelCircleBgPaint.setStyle(Style.FILL); 444 | 445 | yearHeaderTextPaint = new Paint(); 446 | yearHeaderTextPaint.setAntiAlias(true); 447 | yearHeaderTextPaint.setTextAlign(Align.LEFT); 448 | yearHeaderTextPaint.setTextSize(YEAR_HEADER_TEXT_SIZE); 449 | yearHeaderTextPaint.setColor(yearHeaderTextColor); 450 | yearHeaderTextPaint.setStyle(Style.FILL); 451 | yearHeaderTextPaint.setFakeBoldText(false); 452 | 453 | yearHeaderLunarTextPaint = new Paint(); 454 | yearHeaderLunarTextPaint.setAntiAlias(true); 455 | yearHeaderLunarTextPaint.setTextAlign(Align.RIGHT); 456 | yearHeaderLunarTextPaint.setTextSize(YEAR_HEADER_LUNAR_TEXT_SIZE); 457 | yearHeaderLunarTextPaint.setColor(yearHeaderLunarTextColor); 458 | yearHeaderLunarTextPaint.setStyle(Style.FILL); 459 | yearHeaderLunarTextPaint.setFakeBoldText(false); 460 | 461 | dayLabelTextPaint = new Paint(); 462 | dayLabelTextPaint.setAntiAlias(true); 463 | dayLabelTextPaint.setTextSize(DAY_LABEL_TEXT_SIZE); 464 | dayLabelTextPaint.setColor(dayLabelTextColor); 465 | dayLabelTextPaint.setStyle(Style.FILL); 466 | dayLabelTextPaint.setTextAlign(Align.CENTER); 467 | dayLabelTextPaint.setFakeBoldText(false); 468 | 469 | dayLabelCircleBgPaint = new Paint(); 470 | dayLabelCircleBgPaint.setAntiAlias(true); 471 | dayLabelCircleBgPaint.setTextSize(DAY_LABEL_TEXT_SIZE); 472 | dayLabelCircleBgPaint.setColor(dayLabelCircleBgColor); 473 | dayLabelCircleBgPaint.setStyle(Style.FILL); 474 | dayLabelCircleBgPaint.setTextAlign(Align.CENTER); 475 | dayLabelCircleBgPaint.setFakeBoldText(false); 476 | 477 | dividerPaint = new Paint(); 478 | dividerPaint.setAntiAlias(true); 479 | dividerPaint.setColor(dividerColor); 480 | dividerPaint.setStyle(Style.FILL); 481 | dividerPaint.setTextAlign(Align.CENTER); 482 | dividerPaint.setFakeBoldText(false); 483 | 484 | yearHeaderDashPaint = new Paint(); 485 | yearHeaderDashPaint.setAntiAlias(true); 486 | yearHeaderDashPaint.setColor(yearHeaderDashColor); 487 | } 488 | 489 | protected void onDraw(Canvas canvas) { 490 | 491 | drawYearHeaderLabels(canvas); 492 | drawMonthTitle(canvas); 493 | drawAllMonthNums(canvas); 494 | 495 | } 496 | 497 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 498 | 499 | setMeasuredDimension(width, rowMonthHeight* 4 + YEAR_HEADER_TEXT_HEIGHT 500 | +lineSpacingBetweenYearAndMonth); 501 | } 502 | 503 | protected void onSizeChanged(int w, int h, int oldw, int oldh) { 504 | mWidth = w; 505 | } 506 | 507 | @SuppressLint("ClickableViewAccessibility") 508 | public boolean onTouchEvent(MotionEvent event) { 509 | if (event.getAction() == MotionEvent.ACTION_UP) { 510 | YearAdapter.CalendarMonth calendarDay = getMonthFromLocation(event); 511 | if (calendarDay != null) { 512 | onDayClick(calendarDay); 513 | } 514 | } 515 | 516 | return true; 517 | } 518 | 519 | public void reuse() { 520 | requestLayout(); 521 | } 522 | 523 | public void setYearParams(int year, int month) { 524 | this.month = month; 525 | this.year = year; 526 | 527 | today = -1; 528 | 529 | calendar.set(Calendar.MONTH, month); 530 | calendar.set(Calendar.YEAR, year); 531 | calendar.set(Calendar.DAY_OF_MONTH, 1); 532 | dayOfWeekStart = calendar.get(Calendar.DAY_OF_WEEK); 533 | 534 | weekStart = calendar.getFirstDayOfWeek(); 535 | numCells = CalendarUtils.getDaysInMonth(month, year); 536 | 537 | for (int i = 0; i < numCells; i++) { 538 | final int day = i + 1; 539 | if (isToday(day, currentTime)) { 540 | today = day; 541 | } 542 | } 543 | } 544 | 545 | 546 | 547 | @SuppressWarnings("deprecation") 548 | public void setYearParams(HashMap params) { 549 | if (!params.containsKey(VIEW_PARAMS_YEAR_CURRENT)) { 550 | throw new InvalidParameterException( 551 | "You must specify current_year for this view"); 552 | } 553 | setTag(params); 554 | 555 | year = params.get(VIEW_PARAMS_YEAR_CURRENT); 556 | 557 | today = -1; 558 | 559 | calendar.set(Calendar.YEAR, year); 560 | calendar.set(Calendar.DAY_OF_MONTH, 1); 561 | dayOfWeekStart = calendar.get(Calendar.DAY_OF_WEEK); 562 | 563 | if (params.containsKey(VIEW_PARAMS_WEEK_START)) { 564 | weekStart = params.get(VIEW_PARAMS_WEEK_START); 565 | } else { 566 | weekStart = calendar.getFirstDayOfWeek(); 567 | } 568 | 569 | numCells = CalendarUtils.getDaysInMonth(month, year); 570 | 571 | for (int i = 0; i < numCells; i++) { 572 | final int day = i + 1; 573 | if (isToday(day, currentTime)) { 574 | today = day; 575 | } 576 | 577 | } 578 | 579 | WindowManager wm = (WindowManager) getContext().getSystemService( 580 | Context.WINDOW_SERVICE); 581 | width = wm.getDefaultDisplay().getWidth(); 582 | 583 | } 584 | 585 | public void setOnMonthClickListener( 586 | OnMonthClickListener onMonthClickListener) { 587 | mOnMonthClickListener = onMonthClickListener; 588 | } 589 | 590 | public static abstract interface OnMonthClickListener { 591 | public abstract void onMonthClick(YearView simpleMonthView, 592 | YearAdapter.CalendarMonth calendarDay); 593 | } 594 | } -------------------------------------------------------------------------------- /library/src/wgc/shuwoom/scrollercalendar/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package wgc.shuwoom.scrollercalendar.demo; 2 | 3 | 4 | import wgc.shuwoom.scrollercalendar.ScrollerCalendar; 5 | import wgc.shuwoom.scrollercalendar.R; 6 | import android.app.Activity; 7 | import android.os.Bundle; 8 | import android.widget.Toast; 9 | 10 | public class MainActivity extends Activity implements 11 | wgc.shuwoom.scrollercalendar.ScrollerCalendarController{ 12 | 13 | private ScrollerCalendar monthPickerView; 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.activity_main); 19 | 20 | monthPickerView = (ScrollerCalendar) findViewById(R.id.pickerView); 21 | monthPickerView.setController(this); 22 | 23 | } 24 | 25 | @Override 26 | public void onMonthOfYearSelected(int year, int month) { 27 | Toast.makeText(getApplicationContext(), year+"-"+month, Toast.LENGTH_SHORT).show(); 28 | 29 | } 30 | 31 | 32 | 33 | } 34 | --------------------------------------------------------------------------------