GithubHelp home page GithubHelp logo

wheelpicker's Introduction

Banner


Overview

Download API License ![Size](https://img.shields.io/badge/Size-17 KB-e91e63.svg)

Contact

QQ QQGroup Mail Sina Twitter

Preview

Preview

Demo

WheelPicke.APK

Include

Compile

compile 'cn.aigestudio.wheelpicker:WheelPicker:1.1.3'

or

<dependency>
  <groupId>cn.aigestudio.wheelpicker</groupId>
  <artifactId>WheelPicker</artifactId>
  <version>1.1.3</version>
  <type>pom</type>
</dependency>

or

<dependency org='cn.aigestudio.wheelpicker' name='WheelPicker' rev='1.1.3'>
  <artifact name='$AID' ext='pom'></artifact>
</dependency>

Import aar

WheelPicker-1.1.3.aar

Import Module

1.Import moudle WheelPicker in your project.

2.Add module like below in your settings.gradle file of project:

include ':YourMoudle',':WheelPicker'

Notably, in some version of gradle you need to add module single line:

include ':WheelPicker'

click the "sycn now" when it appear on the top-right of IDE window.

3.Compile project like below in the dependencies in your build.gradle file of application module:

compile project(':WheelPicker')

Usage

WIKI | 帮助文档

Versions

1.0.0 beta

  • Preview for WheelPicker and support few function.

1.0.1 beta

  • BugFix:Cache in WheelCuredPicker can not clean...a stupid mistake.

1.0.2 beta

  • BugFix:MotionEvent lost when point outside of view in WheelCurvedPicker

1.0.3 beta

  • BugFix:Error parameter after scroll using setXXX method

1.1.0 Stable

  • Refactor project fix all known bug and some function additions
  • I will create a tag for old beta version but not be updated anymore
  • 重构项目发布稳定版修复测试版所有BUG以及新增功能
  • Beta版本会打上TAG方便老版本过渡但不再更新

1.1.1

  • BugFix:Scroll automatically when touch but not move on WheelPicker in some low resolution phone
  • BugFix:Scroll range incorrect when invoke setData twice and set data source's length less than last
  • BugFix:Wheel state do not refresh when invoke setData twice and set data source's length-1 less than last selected position
  • BugFix:Switch between click and scroll event
  • BugFix:Call OnItemSelectedListener more time when user want to scroll continuously
  • BugFix:Scroll range incorrect when set current selected item again
  • BugFix:Scroll will be triggered when click WheelPicker
  • Function:All the parameters of WheelPicker will be reset when you setData
  • ADD WheelYearPicker, WheelMonthPicker, WheelDayPicker
  • ADD WheelDatePicker
  • 修复某些低分辨率手机触摸不动时自滑动问题
  • 修复第二次调用setData设置长度比上次小的数据时滑动范围不改变的问题
  • 修复第二次调用setData设置长度位置小于上次选中位置时滚轮状态不刷新问题
  • 修复点击与滑动事件切换的问题
  • 修复当用户想连续滑动时出现多次回调的问题
  • 修复重新设置选择的数据项位置后滑动范围错位问题
  • 修复点击后触发滚动的问题
  • 重新设置数据源后会重置滚轮选择器相关参数
  • 新增年份、月份、日期选择器
  • 新增三级联动的日期选择器

1.1.2

  • BugFix:WheelPicker can not get the height in some layout
  • Support Android Nougat

1.1.3

  • BugFix:Divide by zero

Function

  • Data display circulation
  • Set visible item count
  • Get the current item data straight in stationary
  • Monitor status of scroll get selected item data and other parameter when wheel stop
  • Dynamic update data
  • Set text color of selected or non-selected item
  • Set item space
  • Support display indicator and set the indicator's size and color
  • Support display curtain and set the curtain's color
  • Enable atmospheric effect
  • Enable perspective effect
  • Curl the items base on mathematic models
  • Support item align when perspective or atmospheric enable
  • 循环显示数据项
  • 设置可见数据项条数
  • 在滚轮静止状态直接获取选中数据项
  • 滚动监听获取滚轮停止后选中项以及滚动各项参数
  • 动态更新数据源
  • 设置当前选中项文本颜色和非选中项文本颜色
  • 设置数据项之间间隔
  • 支持绘制指示器以及指定指示器颜色、尺寸
  • 支持绘制幕布以及指定幕布颜色
  • 可开启数据项空气感模拟
  • 可开启数据项模拟真实透视效果
  • 根据严格数学建模模拟滚轮弯曲效果
  • 在开启透视或弯曲效果后支持让数据项左右对齐

Widgets

WheelDatePicker

WheelDatePicker

Method

  • setVisibleItemCount
  • setCyclic
  • setSelectedItemTextColor
  • setItemTextColor
  • setItemTextSize
  • setItemSpace
  • setIndicator
  • setIndicatorColor
  • setIndicatorSize
  • setCurtain
  • setCurtainColor
  • setAtmospheric
  • setCurved
  • setItemAlignYear
  • setItemAlignDay
  • setYearFrame
  • setSelectedYear
  • setSelectedMonth
  • setSelectedDay
  • etc...

WheelYearPicker

WheelYearPicker

Method

  • All method of WheelPicker
  • setYearFrame
  • set/getYearStart
  • set/getYearEnd
  • set/getSelectedYear
  • getCurrentYear

WheelMonthPicker

WheelMonthPicker

Method

  • All method of WheelPicker
  • set/getSelectedMonth
  • getCurrentMonth

WheelDayPicker

WheelDayPicker

Method

  • All method of WheelPicker
  • set/getSelectedDay
  • getCurrentDay
  • setYearAndMonth
  • set/getYear
  • set/getMonth

WheelAreaPicker

**行政区域划分根据国家统计局最新数据国家统计局行政区域划分


Donation

如果您觉得该项目帮助了您那不妨赏小弟一杯咖啡钱 :)

Pay

You can support the project and thank the author for his hard work :)


LICENSE

Copyright 2015-2017 AigeStudio

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.

wheelpicker's People

Contributors

aigestudio avatar cranberyxl avatar goushengli avatar manuelgon47 avatar nimatrueway avatar obllivion avatar szn001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wheelpicker's Issues

WheelCurvedPicker 调用setItemIndex()方法 界面错乱

使用WheelCurvedPicker,在没有上下滑动过的时候调用setItemIndex没有问题,但是有过上下滑动之后再调用就会出现乱跳现象。

经过debug发现unitDeltaTotal变量没有制空导致的,所以我试了复写setItemIndex方法就好了。
@OverRide
public void setItemIndex(int index) {
super.setItemIndex(index);
unitDeltaTotal = 0;
}

WheelCurvedPicker具体逻辑看上去非常复杂,不是很了解,所以没有提Pull request。

当wheel的data为空时,滑动会崩溃.

08-31 10:05:22.225 4814-4814/? E/AndroidRuntime: FATAL EXCEPTION: main Process: cn.area, PID: 4814 java.lang.ArithmeticException: divide by zero at smartcity.view.WheelPicker.WheelPicker.run(WheelPicker.java:781)

建议在run()方法中先检查data的是否有数据再执行滑动.
@Override public void run() { _if(mData==null || mData.size()<=0){ return; }_ if (mScroller.isFinished() && !isForceFinishScroll ) { .... }}

divide by zero trying to change item space and size

I am trying to extend your wheel picker and change item spacing and text size.

This case work OK:

setItemSpace(18); setItemTextSize(54);

java.lang.ArithmeticException: divide by zero at com.aigestudio.wheelpicker.WheelPicker.onDraw(WheelPicker.java:505) :

setItemSpace(27); setItemTextSize(54);

WheelDatePicker

WheelDatePicker调用setLabelTextSize后年月日会和lab挤在一起

setCurrentItem(#) not giving me particular position and not being called second time.

I've tested below scenario on your latest demo 1.1.0.

I've array of 20. What I need is if User select position 2 then I want spinner to rotate to 3rd position.
So onItemSelected callback I've written as below.

public void onItemSelected(WheelPicker picker, Object data, int position) {
String text = "";
switch (picker.getId()) {
case R.id.main_wheel_left:
if (position == 2)
{
wheelLeft.setCurrentItem(1);
}
text = "Left: " + position + " :: ";
break;
case R.id.main_wheel_center:
text = "Center:";
break;
case R.id.main_wheel_right:
text = "Right:";
break;
}
Toast.makeText(this, text + String.valueOf(data), Toast.LENGTH_SHORT).show();
}

I'm stuck with Two Issues. It's not sending me to 1st position on call of setCurrentItem(1) and this condition not working
for second time.

Class couldn't be found

It was running perfectly.. Suddenly I started getting Problems while rendering which states

The following classes could not be found:
- com.aigestudio.wheelpicker.WheelPicker (Fix Build Path, Create Class)
Tip: Try to build the project.

I tried clean/rebuild project but still it doesn't work.

I was getting another error as well saying resource not found.

The following classes could not be instantiated:
- com.aigestudio.wheelpicker.WheelPicker (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE

android.content.res.Resources$NotFoundException: Could not resolve resource value: 0x7F040003.

I dont know how to solve this problem as I am beginner in using this.

手指点击导致flying状态终止的时候, 不会重新选定item

大力(出奇迹)滚动, 在picker处于flying的时候, 手机按下使picker强行停止滚动, 然后手指抬起, 这个时候picker不会自动滚动到最近的item, 也许会处于2个item之间, 并且(重要的是), 虽然picker经历的滚动->停止这个过程, 但是并没有重新选定数值, 相当于这次滚动一直没有停止.

try it?

Implement adapter

Thanks for your great library, But still need to implement adapter to be able to make list item layout to display text with image, "Not only text."

大婶好,有两个问题

1、现在是否支持横向的模式?
2、对于每一个item是否支持自定义UI样式?
多谢支持~

setItemIndex error

when i setItemIndex to the WheelHourPicker, the picker show the view error,
for example, when i set WheelHourPicker.setCurrentHour(6); the picker show 3
but when first entry the activity,set setCurrentHour is true.
Once i scroll the wheel picker, the method setcurrenthour will error

setdata()之后不会自动回滚

我设置一个size为10的data,然后滚动到第8个,然后再设置size为3的data,然后设置setIndex为0,但是wheelpicker没有回滚,要我手动滑动才能看到新设置的数据,请问当第二次数据少于前一次数据的时候,怎么样才能让wheelpicker能重新最新数据(不需要手动滑动)

Double tab on scrolling wheel does not trigger onItemSelected anymore.

Hi there,

thank you very much for this really cool wheel picker library!

I found a bug, which is not reproduceable with the provided Demo.apk but can be reproduced with the Demo.apk build from the latest version:
If you double tab on the scrolling wheel, onItemSelected won't be called anymore. In the provided Demo.apk it will be called.

I uploaded two videos, showing the issue.

Would be really nice if you can fix this issue!

videos.zip

Best regards
Marco

java.lang.IndexOutOfBoundsException: Invalid index 86, size is 57

IndexOutOfBounds after setYearRange, But it's not always happen;
ExceptionStackMsg:
java.lang.IndexOutOfBoundsException: Invalid index 86, size is 57
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.get(ArrayList.java:308)
at com.aigestudio.wheelpicker.core.AbstractWheelPicker.onSizeChanged(AbstractWheelPicker.java:234)
at com.aigestudio.wheelpicker.view.WheelCrossPicker.onSizeChanged(WheelCrossPicker.java:69)
at android.view.View.sizeChange(View.java:16135)

wheelpicker default decor

how to remove wheel picker default decor? I am getting black shaded box for selected item. please help

求解答

我想问一下,现在是还没有添加像ios中的选中那一栏上下有横线的功能是么?

Get the new position while scrolling

Great library guys, only it lacks the possibility to get the new position while being scrolled.
setOnWheelChangeListener is not enough, for it triggers only when switching between states.
A useful listener would be a ChangingListener with onChanged method:

public interface OnWheelChangeListener {
    public void onChanged(View wheel, int oldPosition, int newPosition) ;
}

wheelpicker滑动选择数据有时候会失败

问题:当使用同一个wheelpicker显示多个集合数据(集合A,集合B)的时候,如果集合A滑倒位置3显示是“apple”;此时将wheelpicker装载集合B,滑倒位置5如果也显示的是“apple”(和集合A最后选中的相同),那么它将不会出发onWheelSelected(int index, String data)回调。如果在装载集合B时调用WheelPicker.setItemIndex(0)方法,点击确定将会显示集合B的第0的位置的数据而不是“apple”。

问题原因:
WheelCrossPicker.java
private void confirmData() {
if (state != SCROLL_STATE_IDLE) {
return;
}
int curIndex = itemIndex - unitDeltaTotal / unit;
curIndex = Math.max(0, curIndex);
curIndex = Math.min(data.size() - 1, curIndex);
String curData = data.get(curIndex);
if (!this.curData.equals(curData)) { // 此处this.curData=="apple",curData=="apple"
this.curData = curData;
onWheelSelected(curIndex, curData);
}
}

解决办法:忽略掉if (!this.curData.equals(curData)) 的判断就行了。

建议不要使用enum

安卓上尽量不要使用enum,可以结合@IntDef注解,使用int定义常量。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.