Skip to content

Commit

Permalink
版本1.2,修复选定位置的时候惯性不停止的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yizems committed Dec 21, 2016
1 parent a39501c commit 4a60301
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ allprojects {
}
//module
dependencies {
compile 'com.github.yizeliang:RulerView:1.1'
compile 'com.github.yizeliang:RulerView:1.2'
}
```
Expand Down
33 changes: 33 additions & 0 deletions app/src/main/java/cn/yzl/ruleview/ToastUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package cn.yzl.ruleview;

import android.content.Context;
import android.widget.Toast;

public class ToastUtils {

private static Toast toast;

public static void showShort(Context context, String text) {
if (toast == null) {
toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
} else {
toast.cancel();
toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
toast.setText(text);
toast.setDuration(Toast.LENGTH_SHORT);
}
toast.show();
}

public static void showLong(Context context, String text) {
if (toast == null) {
toast = Toast.makeText(context, text, Toast.LENGTH_LONG);
} else {
toast.cancel();
toast = Toast.makeText(context, text, Toast.LENGTH_LONG);
toast.setText(text);
toast.setDuration(Toast.LENGTH_LONG);
}
toast.show();
}
}
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
versionCode 2
versionName "1.1"
versionCode 3
versionName "1.2"


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ public int getSelPosition() {
public void setSelPosition(int selPosition) {
this.selPosition = selPosition;
offsetX = -selPosition * (lineSpace + lineWidth);
scroller.forceFinished(true);
fixScroller.forceFinished(true);
postInvalidate();
}

Expand Down

0 comments on commit 4a60301

Please sign in to comment.