Skip to content

Commit

Permalink
1,修复setProgress设置值低于min的时候thumb位置错误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
shengMR committed Nov 26, 2020
1 parent 6fcf5e6 commit a164af1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

```groovy
dependencies {
implementation 'com.github.shengMR:EasySeekBar:v1.0.12'
implementation 'com.github.shengMR:EasySeekBar:v1.0.13'
}
```

Expand Down
4 changes: 2 additions & 2 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 13
versionName "1.0.12"
versionCode 14
versionName "1.0.13"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand Down
29 changes: 13 additions & 16 deletions lib/src/main/java/com/sheng/lib/EasySeekBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
Expand Down Expand Up @@ -2126,15 +2125,15 @@ public int getSelectIndex() {
return this.diySelectIndex;
}

public void setThumbProgress(final int progress) {
public void setThumbProgress(final int value) {
this.thumbProgress = value;
autoInitWith(false);
this.post(new Runnable() {
@Override
public void run() {
if (isThumbAndProgressPart) {
thumbProgress = progress;
float delta = max - min;
float result = (progress - min) * 1.0f / delta * barDstRectF.width() + barDstRectF.left;
float result = (thumbProgress - min) * 1.0f / delta * barDstRectF.width() + barDstRectF.left;
if (isOpenAnimator) {
if (valueAnimatorForThumb != null) {
valueAnimatorForThumb.cancel();
Expand Down Expand Up @@ -2164,15 +2163,14 @@ public int getThumbProgress() {
return (int) this.thumbProgress;
}

public void setProgress(final int progress) {
this.progress = progress;
public void setProgress(final int value) {
this.progress = value;
autoInitWith(false);
this.post(new Runnable() {
@Override
public void run() {
float delta = max - min;
if (isThumbAndProgressPart) {
Log.d(TAG, "ssssss = 开始rogressDstRectF.right : " + progressDstRectF.right);
float result = (progress - min) * 1.0f / delta * barDstRectF.width() + barDstRectF.left;
if (isOpenAnimator) {
if (valueAnimatorForProgress != null) {
Expand All @@ -2186,7 +2184,6 @@ public void run() {
public void onAnimationUpdate(ValueAnimator animation) {
float value = (float) animation.getAnimatedValue();
progressDstRectF.right = value;
Log.d(TAG, "ssssss = rogressDstRectF.right : " + progressDstRectF.right);
invalidate();
}
});
Expand Down Expand Up @@ -2231,8 +2228,8 @@ public int getProgressForInt() {
return (int) this.progress;
}

public void setLowProgress(int lowProgress) {
this.lowProgress = lowProgress;
public void setLowProgress(int value) {
this.lowProgress = value;
autoInit();
postInvalidate();
}
Expand All @@ -2241,8 +2238,8 @@ public int getLowProgress() {
return (int) this.lowProgress;
}

public void setHeightProgress(int heightProgress) {
this.heightProgress = heightProgress;
public void setHeightProgress(int value) {
this.heightProgress = value;
autoInit();
postInvalidate();
}
Expand All @@ -2251,8 +2248,8 @@ public int getHeightProgress() {
return (int) this.heightProgress;
}

public void setMax(int max) {
this.max = max;
public void setMax(int value) {
this.max = value;
autoInit();
postInvalidate();
}
Expand All @@ -2261,8 +2258,8 @@ public int getMax() {
return (int) max;
}

public void setMin(int min) {
this.min = min;
public void setMin(int value) {
this.min = value;
autoInit();
postInvalidate();
}
Expand Down

0 comments on commit a164af1

Please sign in to comment.