Repository: guanchao/ScrollerCalendar
Branch: master
Commit: 5dbc1ced8220
Files: 38
Total size: 75.5 KB
Directory structure:
gitextract_p1kafuo0/
├── README.md
└── library/
├── .classpath
├── .project
├── .settings/
│ └── org.eclipse.core.resources.prefs
├── AndroidManifest.xml
├── bin/
│ ├── AndroidManifest.xml
│ ├── ScrollerCalendar.apk
│ ├── classes.dex
│ ├── 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
│ └── resources.ap_
├── gen/
│ └── wgc/
│ └── shuwoom/
│ └── scrollercalendar/
│ ├── BuildConfig.java
│ └── R.java
├── libs/
│ ├── android-support-v4.jar
│ └── android-support-v7-recyclerview.jar
├── proguard-project.txt
├── project.properties
├── res/
│ ├── layout/
│ │ └── activity_main.xml
│ ├── menu/
│ │ └── main.xml
│ ├── values/
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-v11/
│ │ └── styles.xml
│ ├── values-v14/
│ │ └── styles.xml
│ └── values-w820dp/
│ └── dimens.xml
└── src/
└── wgc/
└── shuwoom/
└── scrollercalendar/
├── CalendarUtils.java
├── CommonUtils.java
├── LunarYear.java
├── ScrollerCalendar.java
├── ScrollerCalendarController.java
├── YearAdapter.java
├── YearView.java
└── demo/
└── MainActivity.java
================================================
FILE CONTENTS
================================================
================================================
FILE: README.md
================================================
# ScrollerCalendar
ScrollerCalendar provides straightforward wayt to see calendar for Android 4.0+.


## Usage
Declare a ScrollerCalendar inside your layout XML file:
```Java
<wgc.shuwoom.scrollercalendar.ScrollerCalendar
xmlns:calendar="http://schemas.android.com/apk/res-auto"
android:id="@+id/pickerView"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
calendar:showYearLunarLabel="true"/>
```
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.
```Java
@Override
public void onMonthOfYearSelected(int year, int month)
{
Log.e("Month Selected", year + "-" + month);
}
```
### Customization
ScrollerCalendar is fully customizable:
> * calendar:dividerColor [color #FFDDDDDD]===> The color of the line under the year header label.
> * calendar:yearHeaderTextColor [color #FF000000]===> The color of year header label.
> * calendar:yearHeaderTextHeight [dimension 40dp]===> The height of the year header label.
> * calendar:yearHeaderTextSize [dimension 34sp]===> The size of year header text.
> * calendar:yearHeaderLunarTextColor [color #FFCCCCCC]===> The color of the lunar label besides of the year header label.
> * calendar:yearHeaderLunarTextSize [dimension 12sp]===> The size of the lunar label besides of the year header label.
> * calendar:yearHeaderDashColor [color #FFFF0000]===> The color of the dash line on the left of the lunar label.
> * calendar:monthLabelTextColor [color #FFFF0000]===> The color of the month label.
> * calendar:monthLabelTextSize [dimension 16sp]===> The size of the month label.
> * calendar:monthLabelTextHeight [dimension 35dp]===> The height of the month label.
> * calendar:dayLabelTextColor [color #FF000000]===> The color of the day label.
> * calendar:dayLabelTextTodayColor [color #FFFFFFFF]===> The color of the current day label.
> * calendar:dayLabelTextSize [dimension 10sp]===> The size of the day label.
> * calendar:dayLabelCircleBgColor [color #FFFF0000]===> The background color of the current day label.
> * calendar:dayLabelCircleRadius [dimension 8dp]===> The radius of the circle.
> * calendar:monthDayRowHeight [dimension 145dp]===> The height of every detailed month.
> * calendar:showYearLunarLabel [boolean true]===> Whether to show lunar label.
### Acknowledgements
Thanks to RobinChutaux for his [CalendarListview](https://github.com/traex/CalendarListview)
### MIT License
The MIT License (MIT)
Copyright (c) 2015 guanchao wen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: library/.classpath
================================================
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="lib" path="libs/android-support-v7-recyclerview.jar"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
================================================
FILE: library/.project
================================================
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ScrollerCalendar</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
================================================
FILE: library/.settings/org.eclipse.core.resources.prefs
================================================
eclipse.preferences.version=1
encoding/<project>=UTF-8
================================================
FILE: library/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="wgc.shuwoom.scrollercalendar"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".demo.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
================================================
FILE: library/bin/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="wgc.shuwoom.scrollercalendar"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".demo.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
================================================
FILE: library/bin/jarlist.cache
================================================
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
================================================
FILE: library/gen/wgc/shuwoom/scrollercalendar/BuildConfig.java
================================================
/** Automatically generated file. DO NOT MODIFY */
package wgc.shuwoom.scrollercalendar;
public final class BuildConfig {
public final static boolean DEBUG = true;
}
================================================
FILE: library/gen/wgc/shuwoom/scrollercalendar/R.java
================================================
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package wgc.shuwoom.scrollercalendar;
public final class R {
public static final class attr {
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int dayLabelCircleBgColor=0x7f01000e;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int dayLabelCircleRadius=0x7f01000f;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int dayLabelTextColor=0x7f01000b;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int dayLabelTextSize=0x7f01000d;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int dayLabelTextTodayColor=0x7f01000c;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int dividerColor=0x7f010000;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int monthDayRowHeight=0x7f010010;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int monthLabelTextColor=0x7f010008;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int monthLabelTextHeight=0x7f01000a;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int monthLabelTextSize=0x7f010009;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int showYearLunarLabel=0x7f010011;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int yearHeaderDashColor=0x7f010007;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int yearHeaderLunarTextColor=0x7f010004;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int yearHeaderLunarTextHeight=0x7f010005;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int yearHeaderLunarTextSize=0x7f010006;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int yearHeaderTextColor=0x7f010001;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int yearHeaderTextHeight=0x7f010002;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int yearHeaderTextSize=0x7f010003;
}
public static final class color {
public static final int day_label_circle_bg_color=0x7f040007;
public static final int day_label_text_color=0x7f040005;
public static final int day_label_text_today_color=0x7f040006;
public static final int divider_color=0x7f040001;
public static final int month_labe_text_color=0x7f040004;
public static final int year_header_dash_color=0x7f040003;
public static final int year_header_lunar_text_color=0x7f040002;
public static final int year_header_text_color=0x7f040000;
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
*/
public static final int activity_horizontal_margin=0x7f050000;
public static final int activity_vertical_margin=0x7f050001;
public static final int day_label_circle_radius=0x7f050008;
public static final int day_label_text_size=0x7f050007;
public static final int month_day_row_height=0x7f050009;
public static final int month_label_text_height=0x7f050006;
public static final int month_label_text_size=0x7f050005;
public static final int padding_between_day_and_day=0x7f05000a;
public static final int year_header_lunar_text_size=0x7f050004;
public static final int year_header_text_height=0x7f050002;
public static final int year_header_text_size=0x7f050003;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int action_settings=0x7f090001;
public static final int pickerView=0x7f090000;
}
public static final class layout {
public static final int activity_main=0x7f030000;
}
public static final class menu {
public static final int main=0x7f080000;
}
public static final class string {
public static final int action_settings=0x7f060002;
public static final int app_name=0x7f060000;
public static final int hello_world=0x7f060001;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f070000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f070001;
}
public static final class styleable {
/** Attributes that can be used with a ScrollerCalendar.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #ScrollerCalendar_dayLabelCircleBgColor wgc.shuwoom.scrollercalendar:dayLabelCircleBgColor}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_dayLabelCircleRadius wgc.shuwoom.scrollercalendar:dayLabelCircleRadius}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_dayLabelTextColor wgc.shuwoom.scrollercalendar:dayLabelTextColor}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_dayLabelTextSize wgc.shuwoom.scrollercalendar:dayLabelTextSize}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_dayLabelTextTodayColor wgc.shuwoom.scrollercalendar:dayLabelTextTodayColor}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_dividerColor wgc.shuwoom.scrollercalendar:dividerColor}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_monthDayRowHeight wgc.shuwoom.scrollercalendar:monthDayRowHeight}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_monthLabelTextColor wgc.shuwoom.scrollercalendar:monthLabelTextColor}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_monthLabelTextHeight wgc.shuwoom.scrollercalendar:monthLabelTextHeight}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_monthLabelTextSize wgc.shuwoom.scrollercalendar:monthLabelTextSize}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_showYearLunarLabel wgc.shuwoom.scrollercalendar:showYearLunarLabel}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_yearHeaderDashColor wgc.shuwoom.scrollercalendar:yearHeaderDashColor}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_yearHeaderLunarTextColor wgc.shuwoom.scrollercalendar:yearHeaderLunarTextColor}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_yearHeaderLunarTextHeight wgc.shuwoom.scrollercalendar:yearHeaderLunarTextHeight}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_yearHeaderLunarTextSize wgc.shuwoom.scrollercalendar:yearHeaderLunarTextSize}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_yearHeaderTextColor wgc.shuwoom.scrollercalendar:yearHeaderTextColor}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_yearHeaderTextHeight wgc.shuwoom.scrollercalendar:yearHeaderTextHeight}</code></td><td></td></tr>
<tr><td><code>{@link #ScrollerCalendar_yearHeaderTextSize wgc.shuwoom.scrollercalendar:yearHeaderTextSize}</code></td><td></td></tr>
</table>
@see #ScrollerCalendar_dayLabelCircleBgColor
@see #ScrollerCalendar_dayLabelCircleRadius
@see #ScrollerCalendar_dayLabelTextColor
@see #ScrollerCalendar_dayLabelTextSize
@see #ScrollerCalendar_dayLabelTextTodayColor
@see #ScrollerCalendar_dividerColor
@see #ScrollerCalendar_monthDayRowHeight
@see #ScrollerCalendar_monthLabelTextColor
@see #ScrollerCalendar_monthLabelTextHeight
@see #ScrollerCalendar_monthLabelTextSize
@see #ScrollerCalendar_showYearLunarLabel
@see #ScrollerCalendar_yearHeaderDashColor
@see #ScrollerCalendar_yearHeaderLunarTextColor
@see #ScrollerCalendar_yearHeaderLunarTextHeight
@see #ScrollerCalendar_yearHeaderLunarTextSize
@see #ScrollerCalendar_yearHeaderTextColor
@see #ScrollerCalendar_yearHeaderTextHeight
@see #ScrollerCalendar_yearHeaderTextSize
*/
public static final int[] ScrollerCalendar = {
0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007,
0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b,
0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f,
0x7f010010, 0x7f010011
};
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dayLabelCircleBgColor}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dayLabelCircleBgColor
*/
public static final int ScrollerCalendar_dayLabelCircleBgColor = 14;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dayLabelCircleRadius}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dayLabelCircleRadius
*/
public static final int ScrollerCalendar_dayLabelCircleRadius = 15;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dayLabelTextColor}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dayLabelTextColor
*/
public static final int ScrollerCalendar_dayLabelTextColor = 11;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dayLabelTextSize}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dayLabelTextSize
*/
public static final int ScrollerCalendar_dayLabelTextSize = 13;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dayLabelTextTodayColor}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dayLabelTextTodayColor
*/
public static final int ScrollerCalendar_dayLabelTextTodayColor = 12;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#dividerColor}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dividerColor
*/
public static final int ScrollerCalendar_dividerColor = 0;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#monthDayRowHeight}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:monthDayRowHeight
*/
public static final int ScrollerCalendar_monthDayRowHeight = 16;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#monthLabelTextColor}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:monthLabelTextColor
*/
public static final int ScrollerCalendar_monthLabelTextColor = 8;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#monthLabelTextHeight}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:monthLabelTextHeight
*/
public static final int ScrollerCalendar_monthLabelTextHeight = 10;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#monthLabelTextSize}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:monthLabelTextSize
*/
public static final int ScrollerCalendar_monthLabelTextSize = 9;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#showYearLunarLabel}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:showYearLunarLabel
*/
public static final int ScrollerCalendar_showYearLunarLabel = 17;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderDashColor}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderDashColor
*/
public static final int ScrollerCalendar_yearHeaderDashColor = 7;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderLunarTextColor}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderLunarTextColor
*/
public static final int ScrollerCalendar_yearHeaderLunarTextColor = 4;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderLunarTextHeight}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderLunarTextHeight
*/
public static final int ScrollerCalendar_yearHeaderLunarTextHeight = 5;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderLunarTextSize}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderLunarTextSize
*/
public static final int ScrollerCalendar_yearHeaderLunarTextSize = 6;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderTextColor}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderTextColor
*/
public static final int ScrollerCalendar_yearHeaderTextColor = 1;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderTextHeight}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderTextHeight
*/
public static final int ScrollerCalendar_yearHeaderTextHeight = 2;
/**
<p>This symbol is the offset where the {@link wgc.shuwoom.scrollercalendar.R.attr#yearHeaderTextSize}
attribute's value can be found in the {@link #ScrollerCalendar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderTextSize
*/
public static final int ScrollerCalendar_yearHeaderTextSize = 3;
};
}
================================================
FILE: library/proguard-project.txt
================================================
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: library/project.properties
================================================
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-21
================================================
FILE: library/res/layout/activity_main.xml
================================================
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="wgc.shuwoom.scrollercalendar.demo.MainActivity" >
<wgc.shuwoom.scrollercalendar.ScrollerCalendar
xmlns:calendar="http://schemas.android.com/apk/res-auto"
android:id="@+id/pickerView"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
calendar:showYearLunarLabel="true"/>
</RelativeLayout>
================================================
FILE: library/res/menu/main.xml
================================================
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="wgc.shuwoom.scrollercalendar.MainActivity" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/action_settings"/>
</menu>
================================================
FILE: library/res/values/attrs.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ScrollerCalendar">
<attr name="dividerColor" format="color"/>
<attr name="yearHeaderTextColor" format="color" />
<attr name="yearHeaderTextHeight" format="dimension"/>
<attr name="yearHeaderTextSize" format="dimension"/>
<attr name="yearHeaderLunarTextColor" format="color"/>
<attr name="yearHeaderLunarTextHeight" format="dimension"/>
<attr name="yearHeaderLunarTextSize" format="dimension"/>
<attr name="yearHeaderDashColor" format="color"/>
<attr name="monthLabelTextColor" format="color"/>
<attr name="monthLabelTextSize" format="dimension"/>
<attr name="monthLabelTextHeight" format="dimension"/>
<attr name="dayLabelTextColor" format="color"/>
<attr name="dayLabelTextTodayColor" format="color"/>
<attr name="dayLabelTextSize" format="dimension"/>
<attr name="dayLabelCircleBgColor" format="color"/>
<attr name="dayLabelCircleRadius" format="dimension"/>
<attr name="monthDayRowHeight" format="dimension"/>
<attr name="showYearLunarLabel" format="boolean"/>
</declare-styleable>
</resources>
================================================
FILE: library/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="year_header_text_color">#FF000000</color>
<color name="divider_color">#FFDDDDDD</color>
<color name="year_header_lunar_text_color">#FFCCCCCC</color>
<color name="year_header_dash_color">#FFFF0000</color>
<color name="month_labe_text_color">#FFFF0000</color>
<color name="day_label_text_color">#FF000000</color>
<color name="day_label_text_today_color">#FFFFFFFF</color>
<color name="day_label_circle_bg_color">#FFFF0000</color>
</resources>
================================================
FILE: library/res/values/dimens.xml
================================================
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="year_header_text_height">40dp</dimen>
<dimen name="year_header_text_size">34sp</dimen>
<dimen name="year_header_lunar_text_size">12sp</dimen>
<dimen name="month_label_text_size">16sp</dimen>
<dimen name="month_label_text_height">35dp</dimen>
<dimen name="day_label_text_size">10sp</dimen>
<dimen name="day_label_circle_radius">8dp</dimen>
<dimen name="month_day_row_height">145dp</dimen>
<dimen name="padding_between_day_and_day">20dp</dimen>
</resources>
================================================
FILE: library/res/values/strings.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">ScrollerCalendar</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
</resources>
================================================
FILE: library/res/values/styles.xml
================================================
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
================================================
FILE: library/res/values-v11/styles.xml
================================================
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
================================================
FILE: library/res/values-v14/styles.xml
================================================
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>
================================================
FILE: library/res/values-w820dp/dimens.xml
================================================
<resources>
<!--
Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
-->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
================================================
FILE: library/src/wgc/shuwoom/scrollercalendar/CalendarUtils.java
================================================
package wgc.shuwoom.scrollercalendar;
import java.util.Calendar;
public class CalendarUtils
{
public static int getDaysInMonth(int month, int year) {
switch (month) {
case Calendar.JANUARY:
case Calendar.MARCH:
case Calendar.MAY:
case Calendar.JULY:
case Calendar.AUGUST:
case Calendar.OCTOBER:
case Calendar.DECEMBER:
return 31;
case Calendar.APRIL:
case Calendar.JUNE:
case Calendar.SEPTEMBER:
case Calendar.NOVEMBER:
return 30;
case Calendar.FEBRUARY:
return (( (year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) ? 29 : 28;
default:
throw new IllegalArgumentException("Invalid Month");
}
}
}
================================================
FILE: library/src/wgc/shuwoom/scrollercalendar/CommonUtils.java
================================================
package wgc.shuwoom.scrollercalendar;
import android.content.Context;
public class CommonUtils {
/**
* Transform px value into dip or dp
*
* @param pxValue
* @param scale
* @return dip or dp value
*/
public static int px2dp(Context context, float pxValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
/**
* Transform dip or dp value into px
*
* @param dipValue
* @param scale
* @return px value
*/
public static int dp2px(Context context, float dipValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dipValue * scale + 0.5f);
}
/**
* Transform px value into sp value
*
* @param pxValue
* @param fontScale
* @return sp value
*/
public static int px2sp(Context context, float pxValue) {
final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
return (int) (pxValue / fontScale + 0.5f);
}
/**
* Transform sp value into px value
*
* @param spValue
* @param fontScale
* @return px value
*/
public static int sp2px(Context context, float spValue) {
final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
return (int) (spValue * fontScale + 0.5f);
}
}
================================================
FILE: library/src/wgc/shuwoom/scrollercalendar/LunarYear.java
================================================
package wgc.shuwoom.scrollercalendar;
public class LunarYear {
private int year;
public LunarYear(){
}
public LunarYear(int year){
this.year = year;
}
final public String animalsYear() {
final String[] Animals = new String[]{"鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"};
return Animals[(year - 4) % 12];
}
final private static String cyclicalm(int num) {
final String[] Gan = new String[]{"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"};
final String[] Zhi = new String[]{"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"};
return (Gan[num % 10] + Zhi[num % 12]);
}
final public String cyclical() {
int num = year - 1900 + 36;
return (cyclicalm(num));
}
}
================================================
FILE: library/src/wgc/shuwoom/scrollercalendar/ScrollerCalendar.java
================================================
package wgc.shuwoom.scrollercalendar;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import wgc.shuwoom.scrollercalendar.R;
import wgc.shuwoom.scrollercalendar.YearAdapter.CalendarMonth;
public class ScrollerCalendar extends RecyclerView
{
private YearAdapter yearAdapter;
private TypedArray typedArray;
private OnScrollListener onScrollListener;
private ScrollerCalendarController scrollerCalendarController;
public ScrollerCalendar(Context context)
{
this(context, null);
}
public ScrollerCalendar(Context context, AttributeSet attrs)
{
this(context, attrs, 0);
}
@SuppressLint("Recycle")
public ScrollerCalendar(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
if (!isInEditMode())
{
typedArray = context.obtainStyledAttributes(attrs, R.styleable.ScrollerCalendar);
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
init(context);
}
}
public void init(Context paramContext) {
setLayoutManager(new LinearLayoutManager(paramContext));
setUpListView();
onScrollListener = new RecyclerView.OnScrollListener()
{
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy)
{
super.onScrolled(recyclerView, dx, dy);
final YearView child = (YearView) recyclerView.getChildAt(0);
if (child == null) {
return;
}
}
};
}
public void setController(ScrollerCalendarController scrollerCalendarController)
{
this.scrollerCalendarController = scrollerCalendarController;
setUpAdapter();
setAdapter(yearAdapter);
}
public CalendarMonth getSelectedMonths()
{
return yearAdapter.getSelectedMonths();
}
public ScrollerCalendarController getController()
{
return scrollerCalendarController;
}
public TypedArray getTypedArray()
{
return typedArray;
}
private void setUpAdapter() {
if (yearAdapter == null) {
yearAdapter = new YearAdapter(getContext(), scrollerCalendarController, typedArray);
}
scrollToPosition(yearAdapter.getYearRange() / 2);
yearAdapter.notifyDataSetChanged();
}
private void setUpListView() {
setVerticalScrollBarEnabled(false);
setOnScrollListener(onScrollListener);
setFadingEdgeLength(0);
}
}
================================================
FILE: library/src/wgc/shuwoom/scrollercalendar/ScrollerCalendarController.java
================================================
package wgc.shuwoom.scrollercalendar;
public interface ScrollerCalendarController {
public abstract void onMonthOfYearSelected(int year, int month);
}
================================================
FILE: library/src/wgc/shuwoom/scrollercalendar/YearAdapter.java
================================================
package wgc.shuwoom.scrollercalendar;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.widget.RecyclerView;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.AbsListView;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
public class YearAdapter extends RecyclerView.Adapter<YearAdapter.ViewHolder> implements YearView.OnMonthClickListener {
protected static final int MONTHS_IN_YEAR = 12;
private final TypedArray typedArray;
private final Context context;
private final ScrollerCalendarController scrollerCalendarController;
private final Calendar calendar;
private CalendarMonth selectedMonth;
private YearView currentYearView;
private final int yearRange;
public YearAdapter(Context context, ScrollerCalendarController datePickerController, TypedArray typedArray) {
yearRange = 200;
this.typedArray = typedArray;
this.context = context;
calendar = Calendar.getInstance();
selectedMonth = new CalendarMonth();
scrollerCalendarController = datePickerController;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i)
{
final YearView yearView = new YearView(context, typedArray);
return new ViewHolder(yearView, this);
}
@Override
public void onBindViewHolder(ViewHolder viewHolder, int position)
{
final YearView yearView = viewHolder.yearView;
final HashMap<String, Integer> drawingParams = new HashMap<String, Integer>();
int currentYear;
currentYear = 2015 + (position - yearRange / 2);
yearView.reuse();
drawingParams.put(YearView.VIEW_PARAMS_YEAR_CURRENT, currentYear);
drawingParams.put(YearView.VIEW_PARAMS_WEEK_START, calendar.getFirstDayOfWeek());
yearView.setYearParams(drawingParams);
yearView.invalidate();
currentYearView = yearView;
}
public long getItemId(int position) {
return position;
}
public YearView getYearView(){
return currentYearView;
}
@Override
public int getItemCount()
{
return yearRange;
}
public void onMonthClick(YearView yearView, CalendarMonth calendarMonth) {
if (calendarMonth != null) {
onMonthTapped(calendarMonth);
}
}
protected void onMonthTapped(CalendarMonth calendarMonth) {
scrollerCalendarController.onMonthOfYearSelected(calendarMonth.year, calendarMonth.month);
setSelectedMonth(calendarMonth);
notifyDataSetChanged();
}
public void setSelectedMonth(CalendarMonth calendarMonth) {
selectedMonth = calendarMonth;
notifyDataSetChanged();
}
public CalendarMonth getSelectedMonths() {
return selectedMonth;
}
public int getYearRange(){
return yearRange;
}
public static class ViewHolder extends RecyclerView.ViewHolder
{
final YearView yearView;
public ViewHolder(View itemView, YearView.OnMonthClickListener onMonthClickListener)
{
super(itemView);
yearView = (YearView) itemView;
yearView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
yearView.setClickable(true);
yearView.setOnMonthClickListener(onMonthClickListener);
}
}
public static class CalendarMonth implements Serializable
{
private static final long serialVersionUID = -5456695978688356202L;
private Calendar calendar;
int month;
int year;
public CalendarMonth() {
setTime(System.currentTimeMillis());
}
public CalendarMonth(int year, int month) {
setDay(year, month);
}
public CalendarMonth(int year, int month,MotionEvent event) {
setDay(year, month);
}
public CalendarMonth(long timeInMillis) {
setTime(timeInMillis);
}
public CalendarMonth(Calendar calendar) {
year = calendar.get(Calendar.YEAR);
month = calendar.get(Calendar.MONTH);
}
private void setTime(long timeInMillis) {
if (calendar == null) {
calendar = Calendar.getInstance();
}
calendar.setTimeInMillis(timeInMillis);
month = this.calendar.get(Calendar.MONTH);
year = this.calendar.get(Calendar.YEAR);
}
public void set(CalendarMonth calendarDay) {
year = calendarDay.year;
month = calendarDay.month;
}
public void setDay(int year, int month) {
this.year = year;
this.month = month;
}
public Date getDate()
{
if (calendar == null) {
calendar = Calendar.getInstance();
}
calendar.set(year, month);
return calendar.getTime();
}
@Override
public String toString()
{
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("{ year: ");
stringBuilder.append(year);
stringBuilder.append(", month: ");
stringBuilder.append(month);
stringBuilder.append(" }");
return stringBuilder.toString();
}
}
}
================================================
FILE: library/src/wgc/shuwoom/scrollercalendar/YearView.java
================================================
/***********************************************************************************
* The MIT License (MIT)
* Copyright (c) 2014 Robin Chutaux
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
***********************************************************************************/
package wgc.shuwoom.scrollercalendar;
import java.security.InvalidParameterException;
import java.util.Calendar;
import java.util.HashMap;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.text.format.Time;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import wgc.shuwoom.scrollercalendar.R;
import wgc.shuwoom.scrollercalendar.CommonUtils;
import wgc.shuwoom.scrollercalendar.LunarYear;
public class YearView extends View {
public static final String VIEW_PARAMS_YEAR_CURRENT = "current";
public static final String VIEW_PARAMS_WEEK_START = "week_start";
protected static int DAY_LABEL_CIRCLE_RADIUS;
protected static int MONTH_HEADER_HEIGHT;
protected static int YEAR_HEADER_TEXT_HEIGHT;
protected static int YEAR_HEADER_TEXT_SIZE;
protected static int YEAR_HEADER_LUNAR_TEXT_SIZE;
protected static int MONTH_LABEL_TEXT_SIZE;
protected static int DAY_LABEL_TEXT_SIZE;
protected int padding = 0;
protected int lineSpacingBetweenYearAndMonth = 0;
protected int lineSpacingBetweenDayAndDay = 0;
protected Paint yearHeaderTextPaint;
protected Paint dividerPaint;
protected Paint yearHeaderLunarTextPaint;
protected Paint yearHeaderDashPaint;
protected Paint monthLabelTextPaint;
protected Paint dayLabelTextPaint;
protected Paint dayLabelCircleBgPaint;
protected int yearHeaderTextColor;
protected int dividerColor;
protected int yearHeaderLunarTextColor;
protected int yearHeaderDashColor;
protected int monthTextColor;
protected int dayLabelTextColor;
protected int dayLabelTextTodayColor;
protected int dayLabelCircleBgColor;
protected int today = -1;
protected int weekStart = 1;
protected int numDays = 7;
protected int numCells = 0;
private int dayOfWeekStart = 0;
protected int month;
protected int year;
protected int rowMonthHeight;
protected int mWidth;
protected final Time currentTime;
private int width;
private Context mContext;
private final Calendar calendar;
private boolean showYearLunarLabel;
private OnMonthClickListener mOnMonthClickListener;
public YearView(Context context, TypedArray typedArray) {
super(context);
mContext = context;
Resources resources = context.getResources();
calendar = Calendar.getInstance();
currentTime = new Time(Time.getCurrentTimezone());
currentTime.setToNow();
dividerColor = typedArray.getColor(
R.styleable.ScrollerCalendar_dividerColor,
resources.getColor(R.color.divider_color));
yearHeaderTextColor = typedArray.getColor(
R.styleable.ScrollerCalendar_yearHeaderTextColor,
resources.getColor(R.color.year_header_text_color));
yearHeaderLunarTextColor = typedArray.getColor(
R.styleable.ScrollerCalendar_yearHeaderLunarTextColor,
resources.getColor(R.color.year_header_lunar_text_color));
yearHeaderDashColor = typedArray.getColor(
R.styleable.ScrollerCalendar_yearHeaderDashColor,
resources.getColor(R.color.year_header_dash_color));
monthTextColor = typedArray.getColor(
R.styleable.ScrollerCalendar_monthLabelTextColor,
resources.getColor(R.color.month_labe_text_color));
dayLabelTextColor = typedArray.getColor(
R.styleable.ScrollerCalendar_dayLabelTextColor,
resources.getColor(R.color.day_label_text_color));
dayLabelTextTodayColor = typedArray.getColor(
R.styleable.ScrollerCalendar_dayLabelTextTodayColor,
resources.getColor(R.color.day_label_text_today_color));
dayLabelCircleBgColor = typedArray.getColor(
R.styleable.ScrollerCalendar_dayLabelCircleBgColor,
resources.getColor(R.color.day_label_circle_bg_color));
YEAR_HEADER_TEXT_SIZE = typedArray.getDimensionPixelSize(
R.styleable.ScrollerCalendar_yearHeaderTextSize,
resources.getDimensionPixelSize(R.dimen.year_header_text_size));
YEAR_HEADER_LUNAR_TEXT_SIZE = typedArray.getDimensionPixelSize(
R.styleable.ScrollerCalendar_yearHeaderLunarTextSize,
resources.getDimensionPixelSize(R.dimen.year_header_lunar_text_size));
DAY_LABEL_TEXT_SIZE = typedArray.getDimensionPixelSize(
R.styleable.ScrollerCalendar_dayLabelTextSize,
resources.getDimensionPixelSize(R.dimen.day_label_text_size));
MONTH_LABEL_TEXT_SIZE = typedArray.getDimensionPixelSize(
R.styleable.ScrollerCalendar_monthLabelTextSize,
resources.getDimensionPixelSize(R.dimen.month_label_text_size));
YEAR_HEADER_TEXT_HEIGHT = typedArray.getDimensionPixelSize(
R.styleable.ScrollerCalendar_yearHeaderTextHeight,
resources.getDimensionPixelOffset(R.dimen.year_header_text_height));
MONTH_HEADER_HEIGHT = typedArray.getDimensionPixelOffset(
R.styleable.ScrollerCalendar_monthLabelTextHeight,
resources.getDimensionPixelSize(R.dimen.month_label_text_height));
DAY_LABEL_CIRCLE_RADIUS = typedArray.getDimensionPixelSize(
R.styleable.ScrollerCalendar_dayLabelCircleRadius,
resources.getDimensionPixelSize(R.dimen.day_label_circle_radius));
rowMonthHeight = typedArray.getDimensionPixelSize(
R.styleable.ScrollerCalendar_monthDayRowHeight,
resources.getDimensionPixelSize(R.dimen.month_day_row_height));
lineSpacingBetweenDayAndDay =
resources.getDimensionPixelSize(R.dimen.padding_between_day_and_day);
showYearLunarLabel = typedArray.getBoolean(
R.styleable.ScrollerCalendar_showYearLunarLabel,false);
padding = CommonUtils.dp2px(mContext, 5);
lineSpacingBetweenYearAndMonth = CommonUtils.dp2px(mContext, 10);
initView();
}
public int getMonth() {
return month;
}
public int calculateNumRows() {
int offset = findDayOffset();
int dividend = (offset + numCells) / numDays;
int remainder = (offset + numCells) % numDays;
return (dividend + (remainder > 0 ? 1 : 0));
}
private void drawYearHeaderLabels(Canvas canvas) {
int y = (4 * YEAR_HEADER_TEXT_HEIGHT) / 5;
LunarYear lunar = new LunarYear(year);
canvas.drawText(year + "年", 2 * padding, y, yearHeaderTextPaint);
if(showYearLunarLabel){
yearHeaderDashPaint.setStrokeWidth((float) 4.0);
canvas.drawLine(width - 5 * YEAR_HEADER_LUNAR_TEXT_SIZE - 2
* padding, (3 * y) / 8, width - 5
* YEAR_HEADER_LUNAR_TEXT_SIZE, (3 * y) / 8, yearHeaderDashPaint);
canvas.drawText(lunar.cyclical() + lunar.animalsYear() + "年", width - 2
* padding, y / 2, yearHeaderLunarTextPaint);
yearHeaderDashPaint.setStrokeWidth((float) 2.0);
canvas.drawLine(width - 5 * YEAR_HEADER_LUNAR_TEXT_SIZE - 2
* padding, (7 * y) / 8, width - 5
* YEAR_HEADER_LUNAR_TEXT_SIZE, (7 * y) / 8, yearHeaderDashPaint);
canvas.drawText("农历初一", width - 2 * padding, y,
yearHeaderLunarTextPaint);
}
canvas.drawLine(2 * padding, YEAR_HEADER_TEXT_HEIGHT, width,
YEAR_HEADER_TEXT_HEIGHT, dividerPaint);
}
private void drawMonthTitle(Canvas canvas) {
int paddingDay = (mWidth - 2 * padding) / (2 * numDays);
int x = padding;
int y = 0;
for (int i = 1; i <= 12; i++) {
switch (i) {
case 1:
case 2:
case 3:
x = paddingDay + (width / 3) * (i - 1);
y = (MONTH_HEADER_HEIGHT) / 2 + YEAR_HEADER_TEXT_HEIGHT
+ lineSpacingBetweenYearAndMonth;
break;
case 4:
case 5:
case 6:
x = paddingDay + (width / 3) * (i - 4);
y = (MONTH_HEADER_HEIGHT) / 2 + YEAR_HEADER_TEXT_HEIGHT
+ lineSpacingBetweenYearAndMonth + rowMonthHeight * 1;
break;
case 7:
case 8:
case 9:
x = paddingDay + (width / 3) * (i - 7);
y = (MONTH_HEADER_HEIGHT) / 2 + YEAR_HEADER_TEXT_HEIGHT
+ lineSpacingBetweenYearAndMonth + rowMonthHeight * 2;
break;
case 10:
case 11:
case 12:
x = paddingDay + (width / 3) * (i - 10);
y = (MONTH_HEADER_HEIGHT) / 2 + YEAR_HEADER_TEXT_HEIGHT
+ lineSpacingBetweenYearAndMonth + rowMonthHeight * 3;
break;
}
canvas.drawText(i + "月", x, y, monthLabelTextPaint);
}
}
private void drawAllMonthNums(Canvas canvas) {
int y = MONTH_HEADER_HEIGHT + YEAR_HEADER_TEXT_HEIGHT + lineSpacingBetweenYearAndMonth;
int paddingDay = (mWidth / 3 - 2 * padding) / (2 * numDays);
int day = 1;
for (int i = 0; i < 12; i++) {
switch (i) {
case 0:
case 1:
case 2:
y = MONTH_HEADER_HEIGHT + YEAR_HEADER_TEXT_HEIGHT
+ lineSpacingBetweenYearAndMonth;
break;
case 3:
case 4:
case 5:
y = MONTH_HEADER_HEIGHT + YEAR_HEADER_TEXT_HEIGHT
+ lineSpacingBetweenYearAndMonth + rowMonthHeight * 1;
break;
case 6:
case 7:
case 8:
y = MONTH_HEADER_HEIGHT + YEAR_HEADER_TEXT_HEIGHT
+ lineSpacingBetweenYearAndMonth + rowMonthHeight * 2;
break;
case 9:
case 10:
case 11:
y = MONTH_HEADER_HEIGHT + YEAR_HEADER_TEXT_HEIGHT
+ lineSpacingBetweenYearAndMonth + rowMonthHeight * 3;
break;
}
setYearParams(year, i);
int dayOffset = findDayOffset();
day = 1;
while (day <= numCells) {
int column = 0;
switch (i) {
case 0:
case 3:
case 6:
case 9:
column = 0;
break;
case 1:
case 4:
case 7:
case 10:
column = 1;
break;
case 2:
case 5:
case 8:
case 11:
column = 2;
break;
}
int x = paddingDay * (1 + dayOffset * 2) + (column * width) / 3
+ paddingDay;
canvas.drawText(String.format("%d", day), x, y, dayLabelTextPaint);
if ( today == day) {
canvas.drawCircle(x+CommonUtils.dp2px(mContext, 1), y - CommonUtils.dp2px(mContext, 4),
DAY_LABEL_CIRCLE_RADIUS, dayLabelCircleBgPaint);
dayLabelTextPaint.setColor(dayLabelTextTodayColor);
canvas.drawText(String.format("%d", day), x, y,
dayLabelTextPaint);
dayLabelTextPaint.setColor(dayLabelTextColor);
}
dayOffset++;
if (dayOffset == numDays) {
dayOffset = 0;
y += lineSpacingBetweenDayAndDay;
}
day++;
}// end of while
}// end of for
}
private int findDayOffset() {
return (dayOfWeekStart < weekStart ? (dayOfWeekStart + numDays)
: dayOfWeekStart) - weekStart;
}
private void onDayClick(YearAdapter.CalendarMonth calendarMonth) {
if (mOnMonthClickListener != null) {
mOnMonthClickListener.onMonthClick(this, calendarMonth);
}
}
private boolean isToday(int monthDay, Time time) {
return (year == time.year) && (month == time.month)
&& (monthDay == time.monthDay);
}
public YearAdapter.CalendarMonth getMonthFromLocation(
MotionEvent event) {
float x = event.getX();
float y = event.getY();
int month = 0;
int columnWidth = width / 3;
if (y < YEAR_HEADER_TEXT_HEIGHT) {
return null;
}
if ((y <= YEAR_HEADER_TEXT_HEIGHT + rowMonthHeight)) {
if (x <= columnWidth) {
month = 0;
}
if ((x < 2 * columnWidth) && (x > columnWidth)) {
month = 1;
}
if ((x <= 3 * columnWidth) && (x >= 2 * columnWidth)) {
month = 2;
}
}
if ((y <= YEAR_HEADER_TEXT_HEIGHT + 2 * rowMonthHeight)
&& (y > YEAR_HEADER_TEXT_HEIGHT + rowMonthHeight)) {
if (x <= columnWidth) {
month = 3;
}
if ((x < 2 * columnWidth) && (x > columnWidth)) {
month = 4;
}
if ((x <= 3 * columnWidth) && (x >= 2 * columnWidth)) {
month = 5;
}
}
if ((y <= YEAR_HEADER_TEXT_HEIGHT + 3 * rowMonthHeight)
&& (y > YEAR_HEADER_TEXT_HEIGHT + 2 * rowMonthHeight)) {
if (x <= columnWidth) {
month = 6;
}
if ((x < 2 * columnWidth) && (x > columnWidth)) {
month = 7;
}
if ((x <= 3 * columnWidth) && (x >= 2 * columnWidth)) {
month = 8;
}
}
if ((y <= YEAR_HEADER_TEXT_HEIGHT + 4 * rowMonthHeight)
&& (y >= YEAR_HEADER_TEXT_HEIGHT + 3 * rowMonthHeight)) {
if (x <= columnWidth) {
month = 9;
}
if ((x < 2 * columnWidth) && (x > columnWidth)) {
month = 10;
}
if ((x <= 3 * columnWidth) && (x >= 2 * columnWidth)) {
month = 11;
}
}
return new YearAdapter.CalendarMonth(year, month, event);
}
protected void initView() {
monthLabelTextPaint = new Paint();
monthLabelTextPaint.setFakeBoldText(true);
monthLabelTextPaint.setAntiAlias(true);
monthLabelTextPaint.setTextSize(MONTH_LABEL_TEXT_SIZE);
monthLabelTextPaint.setColor(monthTextColor);
monthLabelTextPaint.setTextAlign(Align.CENTER);
monthLabelTextPaint.setStyle(Style.FILL);
dayLabelCircleBgPaint = new Paint();
dayLabelCircleBgPaint.setFakeBoldText(true);
dayLabelCircleBgPaint.setAntiAlias(true);
dayLabelCircleBgPaint.setColor(dayLabelCircleBgColor);
dayLabelCircleBgPaint.setTextAlign(Align.CENTER);
dayLabelCircleBgPaint.setStyle(Style.FILL);
yearHeaderTextPaint = new Paint();
yearHeaderTextPaint.setAntiAlias(true);
yearHeaderTextPaint.setTextAlign(Align.LEFT);
yearHeaderTextPaint.setTextSize(YEAR_HEADER_TEXT_SIZE);
yearHeaderTextPaint.setColor(yearHeaderTextColor);
yearHeaderTextPaint.setStyle(Style.FILL);
yearHeaderTextPaint.setFakeBoldText(false);
yearHeaderLunarTextPaint = new Paint();
yearHeaderLunarTextPaint.setAntiAlias(true);
yearHeaderLunarTextPaint.setTextAlign(Align.RIGHT);
yearHeaderLunarTextPaint.setTextSize(YEAR_HEADER_LUNAR_TEXT_SIZE);
yearHeaderLunarTextPaint.setColor(yearHeaderLunarTextColor);
yearHeaderLunarTextPaint.setStyle(Style.FILL);
yearHeaderLunarTextPaint.setFakeBoldText(false);
dayLabelTextPaint = new Paint();
dayLabelTextPaint.setAntiAlias(true);
dayLabelTextPaint.setTextSize(DAY_LABEL_TEXT_SIZE);
dayLabelTextPaint.setColor(dayLabelTextColor);
dayLabelTextPaint.setStyle(Style.FILL);
dayLabelTextPaint.setTextAlign(Align.CENTER);
dayLabelTextPaint.setFakeBoldText(false);
dayLabelCircleBgPaint = new Paint();
dayLabelCircleBgPaint.setAntiAlias(true);
dayLabelCircleBgPaint.setTextSize(DAY_LABEL_TEXT_SIZE);
dayLabelCircleBgPaint.setColor(dayLabelCircleBgColor);
dayLabelCircleBgPaint.setStyle(Style.FILL);
dayLabelCircleBgPaint.setTextAlign(Align.CENTER);
dayLabelCircleBgPaint.setFakeBoldText(false);
dividerPaint = new Paint();
dividerPaint.setAntiAlias(true);
dividerPaint.setColor(dividerColor);
dividerPaint.setStyle(Style.FILL);
dividerPaint.setTextAlign(Align.CENTER);
dividerPaint.setFakeBoldText(false);
yearHeaderDashPaint = new Paint();
yearHeaderDashPaint.setAntiAlias(true);
yearHeaderDashPaint.setColor(yearHeaderDashColor);
}
protected void onDraw(Canvas canvas) {
drawYearHeaderLabels(canvas);
drawMonthTitle(canvas);
drawAllMonthNums(canvas);
}
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(width, rowMonthHeight* 4 + YEAR_HEADER_TEXT_HEIGHT
+lineSpacingBetweenYearAndMonth);
}
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
mWidth = w;
}
@SuppressLint("ClickableViewAccessibility")
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
YearAdapter.CalendarMonth calendarDay = getMonthFromLocation(event);
if (calendarDay != null) {
onDayClick(calendarDay);
}
}
return true;
}
public void reuse() {
requestLayout();
}
public void setYearParams(int year, int month) {
this.month = month;
this.year = year;
today = -1;
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.DAY_OF_MONTH, 1);
dayOfWeekStart = calendar.get(Calendar.DAY_OF_WEEK);
weekStart = calendar.getFirstDayOfWeek();
numCells = CalendarUtils.getDaysInMonth(month, year);
for (int i = 0; i < numCells; i++) {
final int day = i + 1;
if (isToday(day, currentTime)) {
today = day;
}
}
}
@SuppressWarnings("deprecation")
public void setYearParams(HashMap<String, Integer> params) {
if (!params.containsKey(VIEW_PARAMS_YEAR_CURRENT)) {
throw new InvalidParameterException(
"You must specify current_year for this view");
}
setTag(params);
year = params.get(VIEW_PARAMS_YEAR_CURRENT);
today = -1;
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.DAY_OF_MONTH, 1);
dayOfWeekStart = calendar.get(Calendar.DAY_OF_WEEK);
if (params.containsKey(VIEW_PARAMS_WEEK_START)) {
weekStart = params.get(VIEW_PARAMS_WEEK_START);
} else {
weekStart = calendar.getFirstDayOfWeek();
}
numCells = CalendarUtils.getDaysInMonth(month, year);
for (int i = 0; i < numCells; i++) {
final int day = i + 1;
if (isToday(day, currentTime)) {
today = day;
}
}
WindowManager wm = (WindowManager) getContext().getSystemService(
Context.WINDOW_SERVICE);
width = wm.getDefaultDisplay().getWidth();
}
public void setOnMonthClickListener(
OnMonthClickListener onMonthClickListener) {
mOnMonthClickListener = onMonthClickListener;
}
public static abstract interface OnMonthClickListener {
public abstract void onMonthClick(YearView simpleMonthView,
YearAdapter.CalendarMonth calendarDay);
}
}
================================================
FILE: library/src/wgc/shuwoom/scrollercalendar/demo/MainActivity.java
================================================
package wgc.shuwoom.scrollercalendar.demo;
import wgc.shuwoom.scrollercalendar.ScrollerCalendar;
import wgc.shuwoom.scrollercalendar.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends Activity implements
wgc.shuwoom.scrollercalendar.ScrollerCalendarController{
private ScrollerCalendar monthPickerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
monthPickerView = (ScrollerCalendar) findViewById(R.id.pickerView);
monthPickerView.setController(this);
}
@Override
public void onMonthOfYearSelected(int year, int month) {
Toast.makeText(getApplicationContext(), year+"-"+month, Toast.LENGTH_SHORT).show();
}
}
gitextract_p1kafuo0/
├── README.md
└── library/
├── .classpath
├── .project
├── .settings/
│ └── org.eclipse.core.resources.prefs
├── AndroidManifest.xml
├── bin/
│ ├── AndroidManifest.xml
│ ├── ScrollerCalendar.apk
│ ├── classes.dex
│ ├── 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
│ └── resources.ap_
├── gen/
│ └── wgc/
│ └── shuwoom/
│ └── scrollercalendar/
│ ├── BuildConfig.java
│ └── R.java
├── libs/
│ ├── android-support-v4.jar
│ └── android-support-v7-recyclerview.jar
├── proguard-project.txt
├── project.properties
├── res/
│ ├── layout/
│ │ └── activity_main.xml
│ ├── menu/
│ │ └── main.xml
│ ├── values/
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── values-v11/
│ │ └── styles.xml
│ ├── values-v14/
│ │ └── styles.xml
│ └── values-w820dp/
│ └── dimens.xml
└── src/
└── wgc/
└── shuwoom/
└── scrollercalendar/
├── CalendarUtils.java
├── CommonUtils.java
├── LunarYear.java
├── ScrollerCalendar.java
├── ScrollerCalendarController.java
├── YearAdapter.java
├── YearView.java
└── demo/
└── MainActivity.java
SYMBOL INDEX (88 symbols across 10 files)
FILE: library/gen/wgc/shuwoom/scrollercalendar/BuildConfig.java
class BuildConfig (line 4) | public final class BuildConfig {
FILE: library/gen/wgc/shuwoom/scrollercalendar/R.java
class R (line 10) | public final class R {
class attr (line 11) | public static final class attr {
class color (line 183) | public static final class color {
class dimen (line 193) | public static final class dimen {
class drawable (line 213) | public static final class drawable {
class id (line 216) | public static final class id {
class layout (line 220) | public static final class layout {
class menu (line 223) | public static final class menu {
class string (line 226) | public static final class string {
class style (line 231) | public static final class style {
class styleable (line 259) | public static final class styleable {
FILE: library/src/wgc/shuwoom/scrollercalendar/CalendarUtils.java
class CalendarUtils (line 6) | public class CalendarUtils
method getDaysInMonth (line 8) | public static int getDaysInMonth(int month, int year) {
FILE: library/src/wgc/shuwoom/scrollercalendar/CommonUtils.java
class CommonUtils (line 5) | public class CommonUtils {
method px2dp (line 13) | public static int px2dp(Context context, float pxValue) {
method dp2px (line 25) | public static int dp2px(Context context, float dipValue) {
method px2sp (line 37) | public static int px2sp(Context context, float pxValue) {
method sp2px (line 49) | public static int sp2px(Context context, float spValue) {
FILE: library/src/wgc/shuwoom/scrollercalendar/LunarYear.java
class LunarYear (line 4) | public class LunarYear {
method LunarYear (line 6) | public LunarYear(){
method LunarYear (line 10) | public LunarYear(int year){
method animalsYear (line 15) | final public String animalsYear() {
method cyclicalm (line 21) | final private static String cyclicalm(int num) {
method cyclical (line 27) | final public String cyclical() {
FILE: library/src/wgc/shuwoom/scrollercalendar/ScrollerCalendar.java
class ScrollerCalendar (line 13) | public class ScrollerCalendar extends RecyclerView
method ScrollerCalendar (line 20) | public ScrollerCalendar(Context context)
method ScrollerCalendar (line 25) | public ScrollerCalendar(Context context, AttributeSet attrs)
method ScrollerCalendar (line 30) | @SuppressLint("Recycle")
method init (line 42) | public void init(Context paramContext) {
method setController (line 62) | public void setController(ScrollerCalendarController scrollerCalendarC...
method getSelectedMonths (line 69) | public CalendarMonth getSelectedMonths()
method getController (line 74) | public ScrollerCalendarController getController()
method getTypedArray (line 79) | public TypedArray getTypedArray()
method setUpAdapter (line 84) | private void setUpAdapter() {
method setUpListView (line 92) | private void setUpListView() {
FILE: library/src/wgc/shuwoom/scrollercalendar/ScrollerCalendarController.java
type ScrollerCalendarController (line 3) | public interface ScrollerCalendarController {
method onMonthOfYearSelected (line 5) | public abstract void onMonthOfYearSelected(int year, int month);
FILE: library/src/wgc/shuwoom/scrollercalendar/YearAdapter.java
class YearAdapter (line 21) | public class YearAdapter extends RecyclerView.Adapter<YearAdapter.ViewHo...
method YearAdapter (line 32) | public YearAdapter(Context context, ScrollerCalendarController datePic...
method onCreateViewHolder (line 41) | @Override
method onBindViewHolder (line 48) | @Override
method getItemId (line 64) | public long getItemId(int position) {
method getYearView (line 68) | public YearView getYearView(){
method getItemCount (line 72) | @Override
method onMonthClick (line 78) | public void onMonthClick(YearView yearView, CalendarMonth calendarMont...
method onMonthTapped (line 84) | protected void onMonthTapped(CalendarMonth calendarMonth) {
method setSelectedMonth (line 90) | public void setSelectedMonth(CalendarMonth calendarMonth) {
method getSelectedMonths (line 95) | public CalendarMonth getSelectedMonths() {
method getYearRange (line 99) | public int getYearRange(){
class ViewHolder (line 103) | public static class ViewHolder extends RecyclerView.ViewHolder
method ViewHolder (line 107) | public ViewHolder(View itemView, YearView.OnMonthClickListener onMon...
class CalendarMonth (line 120) | public static class CalendarMonth implements Serializable
method CalendarMonth (line 129) | public CalendarMonth() {
method CalendarMonth (line 133) | public CalendarMonth(int year, int month) {
method CalendarMonth (line 137) | public CalendarMonth(int year, int month,MotionEvent event) {
method CalendarMonth (line 141) | public CalendarMonth(long timeInMillis) {
method CalendarMonth (line 145) | public CalendarMonth(Calendar calendar) {
method setTime (line 150) | private void setTime(long timeInMillis) {
method set (line 159) | public void set(CalendarMonth calendarDay) {
method setDay (line 164) | public void setDay(int year, int month) {
method getDate (line 169) | public Date getDate()
method toString (line 179) | @Override
FILE: library/src/wgc/shuwoom/scrollercalendar/YearView.java
class YearView (line 51) | public class YearView extends View {
method YearView (line 108) | public YearView(Context context, TypedArray typedArray) {
method getMonth (line 177) | public int getMonth() {
method calculateNumRows (line 181) | public int calculateNumRows() {
method drawYearHeaderLabels (line 188) | private void drawYearHeaderLabels(Canvas canvas) {
method drawMonthTitle (line 214) | private void drawMonthTitle(Canvas canvas) {
method drawAllMonthNums (line 257) | private void drawAllMonthNums(Canvas canvas) {
method findDayOffset (line 345) | private int findDayOffset() {
method onDayClick (line 350) | private void onDayClick(YearAdapter.CalendarMonth calendarMonth) {
method isToday (line 356) | private boolean isToday(int monthDay, Time time) {
method getMonthFromLocation (line 365) | public YearAdapter.CalendarMonth getMonthFromLocation(
method initView (line 429) | protected void initView() {
method onDraw (line 489) | protected void onDraw(Canvas canvas) {
method onMeasure (line 497) | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
method onSizeChanged (line 503) | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
method onTouchEvent (line 507) | @SuppressLint("ClickableViewAccessibility")
method reuse (line 519) | public void reuse() {
method setYearParams (line 523) | public void setYearParams(int year, int month) {
method setYearParams (line 547) | @SuppressWarnings("deprecation")
method setOnMonthClickListener (line 585) | public void setOnMonthClickListener(
type OnMonthClickListener (line 590) | public static abstract interface OnMonthClickListener {
method onMonthClick (line 591) | public abstract void onMonthClick(YearView simpleMonthView,
FILE: library/src/wgc/shuwoom/scrollercalendar/demo/MainActivity.java
class MainActivity (line 10) | public class MainActivity extends Activity implements
method onCreate (line 15) | @Override
method onMonthOfYearSelected (line 25) | @Override
Condensed preview — 38 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (84K chars).
[
{
"path": "README.md",
"chars": 3922,
"preview": "# ScrollerCalendar\nScrollerCalendar provides straightforward wayt to see calendar for Android 4.0+.\n{\n \t\n "
},
{
"path": "library/src/wgc/shuwoom/scrollercalendar/ScrollerCalendar.java",
"chars": 2757,
"preview": "package wgc.shuwoom.scrollercalendar;\n\nimport android.annotation.SuppressLint;\nimport android.content.Context;\nimport an"
},
{
"path": "library/src/wgc/shuwoom/scrollercalendar/ScrollerCalendarController.java",
"chars": 154,
"preview": "package wgc.shuwoom.scrollercalendar;\n\npublic interface ScrollerCalendarController {\n\n\tpublic abstract void onMonthOfYea"
},
{
"path": "library/src/wgc/shuwoom/scrollercalendar/YearAdapter.java",
"chars": 5242,
"preview": "package wgc.shuwoom.scrollercalendar;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport and"
},
{
"path": "library/src/wgc/shuwoom/scrollercalendar/YearView.java",
"chars": 18285,
"preview": "/***********************************************************************************\n * The MIT License (MIT)\n\n * Copyri"
},
{
"path": "library/src/wgc/shuwoom/scrollercalendar/demo/MainActivity.java",
"chars": 811,
"preview": "package wgc.shuwoom.scrollercalendar.demo;\n\n\nimport wgc.shuwoom.scrollercalendar.ScrollerCalendar;\nimport wgc.shuwoom.sc"
}
]
// ... and 9 more files (download for full content)
About this extraction
This page contains the full source code of the guanchao/ScrollerCalendar GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 38 files (75.5 KB), approximately 21.8k tokens, and a symbol index with 88 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.