https://github.com/yanzhenjie/years
Just select the year and month view on Android.
https://github.com/yanzhenjie/years
date-picker month year year-month
Last synced: 8 months ago
JSON representation
Just select the year and month view on Android.
- Host: GitHub
- URL: https://github.com/yanzhenjie/years
- Owner: yanzhenjie
- License: apache-2.0
- Created: 2018-01-16T11:14:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-29T09:05:37.000Z (over 7 years ago)
- Last Synced: 2025-02-02T04:51:13.382Z (8 months ago)
- Topics: date-picker, month, year, year-month
- Language: Java
- Homepage: https://github.com/yanzhenjie/Years
- Size: 1.32 MB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Years
Just select the year and month view on Android, its internal use [AndroidWheel](https://github.com/yanzhenjie/AndroidWheel) implementation.## Screenshot
Gif's effect may not be very good, this is how it looks when it is quiet.
## Download
* Gradle
```
implementation 'com.yanzhenjie:years:1.0.0'
```* Maven
```com.yanzhenjie
years
1.0.0```
AndroidWheel requires at minimum Java 7 or Android 4.0(Api level 14) .
## Usage
Initialize YearsView:
```xml```
Or in Java files:
```java
YearsView yearsView = ...;
```Modify the appearance of the Api:
```java
int colors = new int[]{Color.WHITE, Color.TRANSPARENT};
yearsView.setShadow(colors); // Modify the top and bottom audio.Drawable drawable = getDrawable(R.drawable.shape_year_filter);
yearsView.setCenterFilter(Drawable); // Modify the middle of the selector.
```Set the data of the API:
```java
List yearList = ...;
yearsView.setYearItemList(yearList);List monthList = ...;
yearsView.setMonthItemList(monthList);
```Or use the adapter to load the data:
```java
yearsView.setYearAdapter(WheelViewAdapter);
yearsView.setMonthAdapter(WheelViewAdapter);
```Modify the currently selected Item:
```java
int yearIndex = ...;
int monthIndex = ...;
yearsView.setYearIndex(yearIndex);
yearsView.setMonthIndex(monthIndex);
```Monitor the value of the wheel:
```java
final List yearList = ...;
final List monthList = ...;...
mYearsView.setValueChangedListener(new YearsView.OnValueChangedListener() {
@Override
public void onChanged(YearsView yearsView, int yearValue, int monthValue) {
String year = yearList.get(yearValue);
String month = monthList.get(monthValue);
...
}
});
```Active obtain the value of the wheel:
```java
final List yearList = ...;
final List monthList = ...;...
int yearIndex = mYearsView.getYearIndex();
int monthIndex = mYearsView.getMonthIndex();
String year = yearList.get(yearValue);
String month = monthList.get(monthValue);
...
```## ProGuard
If you are using ProGuard you might need to add the following options:
```
-dontwarn com.yanzhenjie.wheel.**
-dontwarn com.yanzhenjie.years.**
```## License
```text
Copyright 2017 Yan ZhenjieLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```