# 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 {
/** Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int dayLabelCircleBgColor=0x7f01000e;
/**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int dayLabelCircleRadius=0x7f01000f;
/**
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int dayLabelTextColor=0x7f01000b;
/**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int dayLabelTextSize=0x7f01000d;
/**
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int dayLabelTextTodayColor=0x7f01000c;
/**
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int dividerColor=0x7f010000;
/**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int monthDayRowHeight=0x7f010010;
/**
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int monthLabelTextColor=0x7f010008;
/**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int monthLabelTextHeight=0x7f01000a;
/**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int monthLabelTextSize=0x7f010009;
/**
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int showYearLunarLabel=0x7f010011;
/**
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int yearHeaderDashColor=0x7f010007;
/**
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int yearHeaderLunarTextColor=0x7f010004;
/**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int yearHeaderLunarTextHeight=0x7f010005;
/**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int yearHeaderLunarTextSize=0x7f010006;
/**
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int yearHeaderTextColor=0x7f010001;
/**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
*/
public static final int yearHeaderTextHeight=0x7f010002;
/**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
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.
Includes the following attributes:
| Attribute | Description |
{@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} | |
@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
};
/**
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.
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dayLabelCircleBgColor
*/
public static final int ScrollerCalendar_dayLabelCircleBgColor = 14;
/**
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.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dayLabelCircleRadius
*/
public static final int ScrollerCalendar_dayLabelCircleRadius = 15;
/**
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.
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dayLabelTextColor
*/
public static final int ScrollerCalendar_dayLabelTextColor = 11;
/**
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.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dayLabelTextSize
*/
public static final int ScrollerCalendar_dayLabelTextSize = 13;
/**
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.
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dayLabelTextTodayColor
*/
public static final int ScrollerCalendar_dayLabelTextTodayColor = 12;
/**
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.
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:dividerColor
*/
public static final int ScrollerCalendar_dividerColor = 0;
/**
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.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:monthDayRowHeight
*/
public static final int ScrollerCalendar_monthDayRowHeight = 16;
/**
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.
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:monthLabelTextColor
*/
public static final int ScrollerCalendar_monthLabelTextColor = 8;
/**
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.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:monthLabelTextHeight
*/
public static final int ScrollerCalendar_monthLabelTextHeight = 10;
/**
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.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:monthLabelTextSize
*/
public static final int ScrollerCalendar_monthLabelTextSize = 9;
/**
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.
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:showYearLunarLabel
*/
public static final int ScrollerCalendar_showYearLunarLabel = 17;
/**
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.
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderDashColor
*/
public static final int ScrollerCalendar_yearHeaderDashColor = 7;
/**
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.
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderLunarTextColor
*/
public static final int ScrollerCalendar_yearHeaderLunarTextColor = 4;
/**
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.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderLunarTextHeight
*/
public static final int ScrollerCalendar_yearHeaderLunarTextHeight = 5;
/**
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.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderLunarTextSize
*/
public static final int ScrollerCalendar_yearHeaderLunarTextSize = 6;
/**
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.
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderTextColor
*/
public static final int ScrollerCalendar_yearHeaderTextColor = 1;
/**
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.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
@attr name wgc.shuwoom.scrollercalendar:yearHeaderTextHeight
*/
public static final int ScrollerCalendar_yearHeaderTextHeight = 2;
/**
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.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
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
================================================
================================================
FILE: library/res/menu/main.xml
================================================
================================================
FILE: library/res/values/attrs.xml
================================================
================================================
FILE: library/res/values/colors.xml
================================================
#FF000000
#FFDDDDDD
#FFCCCCCC
#FFFF0000
#FFFF0000
#FF000000
#FFFFFFFF
#FFFF0000
================================================
FILE: library/res/values/dimens.xml
================================================
16dp
16dp
40dp
34sp
12sp
16sp
35dp
10sp
8dp
145dp
20dp
================================================
FILE: library/res/values/strings.xml
================================================
ScrollerCalendar
Hello world!
Settings
================================================
FILE: library/res/values/styles.xml
================================================
================================================
FILE: library/res/values-v11/styles.xml
================================================
================================================
FILE: library/res/values-v14/styles.xml
================================================
================================================
FILE: library/res/values-w820dp/dimens.xml
================================================
64dp
================================================
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 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 drawingParams = new HashMap();
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 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();
}
}