Years

Years for Android

License

License

GroupId

GroupId

com.yanzhenjie
ArtifactId

ArtifactId

years
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

aar
Description

Description

Years
Years for Android
Project URL

Project URL

https://github.com/yanzhenjie/Years
Source Code Management

Source Code Management

https://github.com/yanzhenjie/Years

Download years

How to add to project

<!-- https://jarcasting.com/artifacts/com.yanzhenjie/years/ -->
<dependency>
    <groupId>com.yanzhenjie</groupId>
    <artifactId>years</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.yanzhenjie/years/
implementation 'com.yanzhenjie:years:1.0.0'
// https://jarcasting.com/artifacts/com.yanzhenjie/years/
implementation ("com.yanzhenjie:years:1.0.0")
'com.yanzhenjie:years:aar:1.0.0'
<dependency org="com.yanzhenjie" name="years" rev="1.0.0">
  <artifact name="years" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.yanzhenjie', module='years', version='1.0.0')
)
libraryDependencies += "com.yanzhenjie" % "years" % "1.0.0"
[com.yanzhenjie/years "1.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.yanzhenjie : wheel jar 1.0.0

Project Modules

There are no modules declared in this project.

Years

Just select the year and month view on Android, its internal use 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
<dependency>
  <groupId>com.yanzhenjie</groupId>
  <artifactId>years</artifactId>
  <version>1.0.0</version>
</dependency>

AndroidWheel requires at minimum Java 7 or Android 4.0(Api level 14) .

Usage

Initialize YearsView:

<com.yanzhenjie.years.YearsView
    android:id="@+id/years"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

Or in Java files:

YearsView yearsView = ...;

Modify the appearance of the Api:

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:

List<String> yearList = ...;
yearsView.setYearItemList(yearList);

List<String> monthList = ...;
yearsView.setMonthItemList(monthList);

Or use the adapter to load the data:

yearsView.setYearAdapter(WheelViewAdapter);
yearsView.setMonthAdapter(WheelViewAdapter);

Modify the currently selected Item:

int yearIndex = ...;
int monthIndex = ...;
yearsView.setYearIndex(yearIndex);
yearsView.setMonthIndex(monthIndex);

Monitor the value of the wheel:

final List<String> yearList = ...;
final List<String> 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:

final List<String> yearList = ...;
final List<String> 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

Copyright 2017 Yan Zhenjie

Licensed 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 at

   http://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.

Versions

Version
1.0.0