diff --git a/README.md b/README.md
index 8f2971a..ec9c615 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ repositories {
- add to your module gradle file
```gradle
-implementation 'com.github.dtboy1995:android-sex-ring:0.2.2'
+implementation 'com.github.dtboy1995:android-sex-ring:0.2.3'
```
# screenshot
@@ -54,20 +54,22 @@ implementation 'com.github.dtboy1995:android-sex-ring:0.2.2'
RingView rv = (RingView)findViewById(R.id.ring_view);
// set progress - true is animated
rv.go(20, true);
+// set prgress range mapped
+rv.go(10, -20, 30, true);
// set progress callback
rv.setCallback(new AVCallback() {
+ // progress 0~100
@Override
public void step(int progress) {
- // progress 0~100
- tv.setText(String.valueOf(progress));
+
}
});
// set range mapped progress callback [0, 100] map to => [-20, 30]
rv.setCallback(new AVRangeMapCallback(-20, 30) {
+ // progress -20~30
@Override
public void step(int progress) {
- // progress -20~30
- tv.setText(String.valueOf(progress));
+
}
});
```
diff --git a/example/src/main/java/org/ithot/android/example/ring/ExampleActivity.java b/example/src/main/java/org/ithot/android/example/ring/ExampleActivity.java
index 1c244e8..93e0d94 100644
--- a/example/src/main/java/org/ithot/android/example/ring/ExampleActivity.java
+++ b/example/src/main/java/org/ithot/android/example/ring/ExampleActivity.java
@@ -29,6 +29,10 @@ public void go2(View v) {
ring2.go(30, true);
}
+ public void goRangeMapped(View v) {
+ ring1.go(-20, -20, 30, true);
+ }
+
public void step1(int progress) {
tv1.setText(String.valueOf(progress));
}
diff --git a/example/src/main/res/layout/activity_main.xml b/example/src/main/res/layout/activity_main.xml
index 1db19fb..53e9e0b 100644
--- a/example/src/main/res/layout/activity_main.xml
+++ b/example/src/main/res/layout/activity_main.xml
@@ -53,12 +53,22 @@
+ android:textSize="17sp" />
+
+
+ android:textSize="17sp" />
diff --git a/ring/build.gradle b/ring/build.gradle
index 1b6d372..ed265e3 100644
--- a/ring/build.gradle
+++ b/ring/build.gradle
@@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
- versionCode 3
- versionName "0.2.2"
+ versionCode 4
+ versionName "0.2.3"
}
buildTypes {
diff --git a/ring/src/main/java/org/ithot/android/view/RingView.java b/ring/src/main/java/org/ithot/android/view/RingView.java
index 147a1d9..00dd3a8 100644
--- a/ring/src/main/java/org/ithot/android/view/RingView.java
+++ b/ring/src/main/java/org/ithot/android/view/RingView.java
@@ -328,6 +328,16 @@ public void go(int progress) {
go(progress, false);
}
+ public void go(int progress, int min, int max) {
+ float unit = (max - min) / MAX_PROGRESS;
+ go((int) ((progress - min) / unit));
+ }
+
+ public void go(int progress, int min, int max, boolean animate) {
+ float unit = (max - min) / MAX_PROGRESS;
+ go((int) ((progress - min) / unit), true);
+ }
+
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);