A framework used to create circular seek bar
implementation 'com.github.stefanodp91.android:circularseekbar:0.2'
<dependency>
<groupId>com.github.stefanodp91.android</groupId>
<artifactId>circularseekbar</artifactId>
<version>0.2</version>
<type>pom</type>
</dependency>
...
<com.github.stefanodp91.android.circularseekbar.CircularSeekBar
android:id="@+id/seek"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cs_arcRadius="150dp"/>
...
Subscribe to progress changes with OnCircularSeekBarChangeListener:
...
CircularSeekBar seekBar = findViewById(R.id.seek);
seekBar.setOnRoundedSeekChangeListener(new OnCircularSeekBarChangeListener() {
/**
* Progress change
* @param CircularSeekBar
* @param progress the progress
*/
@Override
public void onProgressChange(CircularSeekBar CircularSeekBar, float progress) {
Log.d("progress", "" + progress);
}
/**
* Indicator touched
* @param CircularSeekBar
*/
@Override
public void onStartTrackingTouch(CircularSeekBar CircularSeekBar) {
}
/**
* Indicator released
* @param CircularSeekBar
*/
@Override
public void onStopTrackingTouch(CircularSeekBar CircularSeekBar) {
}
});
...
app:cs_arcRadius
: The radius of the circle. It is a mandatory field and must be chosen wisely. It must be less than the screen sizeapp:cs_step
: The increment of the percentual. Default is set to 1app:cs_progressWidth
: The width of progressapp:cs_arcWidth
: The width of base cicleapp:cs_indicatorRadius
: The radius of the draggable indicatorapp:cs_enabled
: Enable or disable the dragapp:cs_color_list
: Integer vector used for gradient generationapp:cs_text
: Text to display to the center of the base cicleapp:cs_text_size
: Text sizeapp:cs_text_color
: Text static colorapp:cs_dynamic_text_color
: Text color changes according to the indicator colorapp:cs_text_progress
: Display the current progress as textapp:cs_indicator_enabled
: Show/Hide the indicatorapp:cs_progress
: Set the current progress
java.lang.IllegalArgumentException: y must be >= 0
or
java.lang.IllegalArgumentException: x must be < bitmap.width()
Probably the cs_arcRadius is too large
Copyright 2019 stefanodp91.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.