-
Notifications
You must be signed in to change notification settings - Fork 518
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
688faa3
commit 3245229
Showing
22 changed files
with
616 additions
and
316 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
app/src/main/java/com/xw/samlpe/bubbleseekbar/DemoFragment1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.xw.samlpe.bubbleseekbar; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.design.widget.Snackbar; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.Button; | ||
import android.widget.Toast; | ||
|
||
import com.xw.repo.BubbleSeekBar; | ||
|
||
import java.util.Random; | ||
|
||
/** | ||
* DemoFragment1 | ||
* <><p/> | ||
* Created by woxingxiao on 2017-03-11. | ||
*/ | ||
|
||
public class DemoFragment1 extends Fragment { | ||
|
||
private BubbleSeekBar mBubbleSeekBar; | ||
|
||
public static DemoFragment1 newInstance() { | ||
return new DemoFragment1(); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
|
||
View view = inflater.inflate(R.layout.fragment_demo_1, container, false); | ||
|
||
final BubbleSeekBar bubbleSeekBar = (BubbleSeekBar) view.findViewById(R.id.demo_1_seek_bar); | ||
Button button = (Button) view.findViewById(R.id.demo_1_button); | ||
|
||
bubbleSeekBar.setOnProgressChangedListener(new BubbleSeekBar.OnProgressChangedListenerAdapter() { | ||
@Override | ||
public void getProgressOnActionUp(int progress, float progressFloat) { | ||
Toast.makeText(getContext(), "progressOnActionUp:" + progress, Toast.LENGTH_SHORT).show(); | ||
} | ||
}); | ||
button.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
int progress = new Random().nextInt(bubbleSeekBar.getMax()); | ||
bubbleSeekBar.setProgress(progress); | ||
Snackbar.make(v, "set random progress = " + progress, Snackbar.LENGTH_SHORT).show(); | ||
} | ||
}); | ||
|
||
return view; | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
app/src/main/java/com/xw/samlpe/bubbleseekbar/DemoFragment2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.xw.samlpe.bubbleseekbar; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import com.xw.repo.BubbleSeekBar; | ||
|
||
import java.util.Locale; | ||
|
||
/** | ||
* DemoFragment1 | ||
* <><p/> | ||
* Created by woxingxiao on 2017-03-11. | ||
*/ | ||
|
||
public class DemoFragment2 extends Fragment { | ||
|
||
public static DemoFragment2 newInstance() { | ||
return new DemoFragment2(); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
|
||
View view = inflater.inflate(R.layout.fragment_demo_2, container, false); | ||
|
||
final BubbleSeekBar bubbleSeekBar = (BubbleSeekBar) view.findViewById(R.id.demo_2_seek_bar); | ||
final TextView progressText1 = (TextView) view.findViewById(R.id.demo_2_progress_text_1); | ||
final TextView progressText2 = (TextView) view.findViewById(R.id.demo_2_progress_text_2); | ||
final TextView progressText3 = (TextView) view.findViewById(R.id.demo_2_progress_text_3); | ||
|
||
bubbleSeekBar.setOnProgressChangedListener(new BubbleSeekBar.OnProgressChangedListenerAdapter() { | ||
@Override | ||
public void onProgressChanged(int progress, float progressFloat) { | ||
String s = String.format(Locale.CHINA, "onChanged int:%d, float:%.1f", progress, progressFloat); | ||
progressText1.setText(s); | ||
} | ||
|
||
@Override | ||
public void getProgressOnActionUp(int progress, float progressFloat) { | ||
String s = String.format(Locale.CHINA, "onActionUp int:%d, float:%.1f", progress, progressFloat); | ||
progressText2.setText(s); | ||
} | ||
|
||
@Override | ||
public void getProgressOnFinally(int progress, float progressFloat) { | ||
String s = String.format(Locale.CHINA, "onFinally int:%d, float:%.1f", progress, progressFloat); | ||
progressText3.setText(s); | ||
} | ||
}); | ||
|
||
return view; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
app/src/main/java/com/xw/samlpe/bubbleseekbar/DemoFragment3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.xw.samlpe.bubbleseekbar; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import com.xw.repo.BubbleSeekBar; | ||
|
||
/** | ||
* DemoFragment1 | ||
* <><p/> | ||
* Created by woxingxiao on 2017-03-11. | ||
*/ | ||
|
||
public class DemoFragment3 extends Fragment { | ||
|
||
private BubbleSeekBar mBubbleSeekBar; | ||
|
||
public static DemoFragment3 newInstance() { | ||
return new DemoFragment3(); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
|
||
View view = inflater.inflate(R.layout.fragment_demo_3, container, false); | ||
ObservableScrollView mObsScrollView = (ObservableScrollView) view.findViewById(R.id.demo_3_obs_scroll_view); | ||
mBubbleSeekBar = (BubbleSeekBar) view.findViewById(R.id.demo_3_seek_bar); | ||
|
||
mObsScrollView.setOnScrollChangedListener(new ObservableScrollView.OnScrollChangedListener() { | ||
@Override | ||
public void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy) { | ||
mBubbleSeekBar.correctOffsetWhenContainerOnScrolling(); | ||
} | ||
}); | ||
|
||
return view; | ||
} | ||
|
||
} |
141 changes: 53 additions & 88 deletions
141
app/src/main/java/com/xw/samlpe/bubbleseekbar/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<item android:color="@color/colorPrimary" android:state_checked="false"/> | ||
<item android:color="@color/colorAccent" android:state_checked="true"/> | ||
</selector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<gradient | ||
android:angle="90" | ||
|
||
android:endColor="#ffffff" | ||
android:startColor="#4F000000"/> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<size | ||
android:width="1px" | ||
android:height="16dp"/> | ||
|
||
<solid android:color="@android:color/darker_gray"/> | ||
</shape> |
Oops, something went wrong.