Skip to content

Commit ba855ff

Browse files
committed
v2.0.5
修复底部越界
1 parent 88bc649 commit ba855ff

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ android {
2222
dependencies {
2323
compile fileTree(dir: 'libs', include: ['*.jar'])
2424
compile project(':pickerview')
25-
// compile 'com.bigkoo:pickerview:2.0.4'
25+
// compile 'com.bigkoo:pickerview:2.0.5'
2626
compile 'com.android.support:appcompat-v7:23.1.0'
2727
}

pickerview/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
22
apply plugin: 'com.github.dcendents.android-maven'
33
apply plugin: 'com.jfrog.bintray'
44

5-
version = "2.0.4"
5+
version = "2.0.5"
66

77
android {
88
compileSdkVersion 21

pickerview/src/main/java/com/bigkoo/pickerview/lib/InertiaTimerTask.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ public final void run() {
4242
if(loopView.totalScrollY - itemHeight*0.3 < top){
4343
top = loopView.totalScrollY + i;
4444
}
45+
else if(loopView.totalScrollY + itemHeight*0.3 > bottom){
46+
bottom = loopView.totalScrollY + i;
47+
}
48+
4549
if (loopView.totalScrollY <= top){
4650
a = 40F;
4751
loopView.totalScrollY = (int)top;

pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelView.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,13 +504,13 @@ public boolean onTouchEvent(MotionEvent event) {
504504
// 边界处理。
505505
if (!isLoop) {
506506
float top = -initPosition * itemHeight;
507-
507+
float bottom = (adapter.getItemsCount() - 1 - initPosition) * itemHeight;
508508
if(totalScrollY - itemHeight*0.3 < top){
509509
top = totalScrollY - dy;
510510
}
511-
512-
513-
float bottom = (adapter.getItemsCount() - 1 - initPosition) * itemHeight;
511+
else if(totalScrollY + itemHeight*0.3 > bottom){
512+
bottom = totalScrollY - dy;
513+
}
514514

515515
if (totalScrollY < top) {
516516
totalScrollY = (int) top;

0 commit comments

Comments
 (0)