diff --git a/apk/sample.apk b/apk/sample.apk
index 1c47cdd..9684d0c 100644
Binary files a/apk/sample.apk and b/apk/sample.apk differ
diff --git a/app/build.gradle b/app/build.gradle
index 0db5527..bd7055b 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,14 +1,14 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.3"
+ compileSdkVersion 25
+ buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.xw.samlpe.bubbleseekbar"
minSdkVersion 14
- targetSdkVersion 23
- versionCode 1
- versionName "1.0"
+ targetSdkVersion 25
+ versionCode 2
+ versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
@@ -34,8 +34,8 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- compile 'com.android.support:appcompat-v7:23.4.0'
- compile 'com.android.support:design:23.4.0'
+ compile 'com.android.support:appcompat-v7:25.1.0'
+ compile 'com.android.support:design:25.1.0'
testCompile 'junit:junit:4.12'
compile project(':bubbleseekbar')
}
diff --git a/app/src/main/java/com/xw/samlpe/bubbleseekbar/MainActivity.java b/app/src/main/java/com/xw/samlpe/bubbleseekbar/MainActivity.java
index 8ada5cc..fa3d3cb 100644
--- a/app/src/main/java/com/xw/samlpe/bubbleseekbar/MainActivity.java
+++ b/app/src/main/java/com/xw/samlpe/bubbleseekbar/MainActivity.java
@@ -18,8 +18,14 @@
public class MainActivity extends AppCompatActivity {
BubbleSeekBar mBubbleSeekBar0;
+ BubbleSeekBar mBubbleSeekBar1;
+ BubbleSeekBar mBubbleSeekBar2;
+ BubbleSeekBar mBubbleSeekBar3;
+ BubbleSeekBar mBubbleSeekBar4;
BubbleSeekBar mBubbleSeekBar5;
BubbleSeekBar mBubbleSeekBar6;
+ BubbleSeekBar mBubbleSeekBar8;
+ BubbleSeekBar mBubbleSeekBar9;
TextView mProgressText;
ObservableScrollView mObsScrollView;
@@ -33,10 +39,16 @@ protected void onCreate(Bundle savedInstanceState) {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
mBubbleSeekBar0 = (BubbleSeekBar) findViewById(R.id.bubble_seek_bar_0);
+ mBubbleSeekBar1 = (BubbleSeekBar) findViewById(R.id.bubble_seek_bar_1);
+ mBubbleSeekBar2 = (BubbleSeekBar) findViewById(R.id.bubble_seek_bar_2);
+ mBubbleSeekBar3 = (BubbleSeekBar) findViewById(R.id.bubble_seek_bar_3);
+ mBubbleSeekBar4 = (BubbleSeekBar) findViewById(R.id.bubble_seek_bar_4);
mBubbleSeekBar5 = (BubbleSeekBar) findViewById(R.id.bubble_seek_bar_5);
mBubbleSeekBar6 = (BubbleSeekBar) findViewById(R.id.bubble_seek_bar_6);
+ mBubbleSeekBar8 = (BubbleSeekBar) findViewById(R.id.bubble_seek_bar_8);
+ mBubbleSeekBar9 = (BubbleSeekBar) findViewById(R.id.bubble_seek_bar_9);
mProgressText = (TextView) findViewById(R.id.progress_text);
- mObsScrollView = (ObservableScrollView) findViewById(R.id.scroll_view);
+ mObsScrollView = (ObservableScrollView) findViewById(R.id.content_main);
setSupportActionBar(toolbar);
@@ -44,6 +56,8 @@ protected void onCreate(Bundle savedInstanceState) {
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
+ mObsScrollView.smoothScrollTo(0, 0);
+
int progress = new Random().nextInt(100);
mBubbleSeekBar0.setProgress(progress);
Snackbar.make(view, "set random progress = " + progress, Snackbar.LENGTH_SHORT).show();
@@ -77,7 +91,15 @@ public void onProgressChanged(float progress) {
@Override
public void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy) {
// 调用修正偏移方法
+ mBubbleSeekBar0.correctOffsetWhenContainerOnScrolling();
+ mBubbleSeekBar1.correctOffsetWhenContainerOnScrolling();
+ mBubbleSeekBar2.correctOffsetWhenContainerOnScrolling();
+ mBubbleSeekBar3.correctOffsetWhenContainerOnScrolling();
+ mBubbleSeekBar4.correctOffsetWhenContainerOnScrolling();
+ mBubbleSeekBar5.correctOffsetWhenContainerOnScrolling();
mBubbleSeekBar6.correctOffsetWhenContainerOnScrolling();
+ mBubbleSeekBar8.correctOffsetWhenContainerOnScrolling();
+ mBubbleSeekBar9.correctOffsetWhenContainerOnScrolling();
}
});
diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml
index 9dfa5e8..35c2cca 100644
--- a/app/src/main/res/layout/content_main.xml
+++ b/app/src/main/res/layout/content_main.xml
@@ -1,5 +1,5 @@
-
-
+ android:layout_height="wrap_content"
+ android:background="@color/color_red_light"
+ android:orientation="vertical"
+ android:paddingBottom="8dp">
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_marginBottom="8dp"
+ android:layout_marginLeft="8dp"
+ android:layout_marginTop="8dp"
+ android:text="@string/not_fix"
+ android:textSize="12sp"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 659b094..b683edd 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -4,4 +4,6 @@
下面演示BubbleSeekBar嵌套在可滑动的容器中时,监听滑动修正Bubble的位置偏移。(上下滑动,观察Bubble位置)
已修正
未修正
+ touch track to seek
+ touch track to seek and auto adjust
diff --git a/demo.gif b/screenshot/demo.gif
similarity index 100%
rename from demo.gif
rename to screenshot/demo.gif
diff --git a/screenshot/demo2.gif b/screenshot/demo2.gif
new file mode 100644
index 0000000..cb25ebf
Binary files /dev/null and b/screenshot/demo2.gif differ