๐ŸŒˆ SSArcSeekBar

July 27, 2022 ยท View on GitHub

Choose your way to flaunt the progress.

Android-Studio Language Kotlin Version API

Different type of arc seekbar. Easy to use and configure your own seekbar using all the attributes.

Features :

  • Basic arc seekbar
  • Basic arc custom thumb seekbar
  • Basic arc seekbar with animation
  • Segmented arc seekbar
  • segmented arc seekbar with animation
  • Options with Basic Arc Seekbar :
    • Change start angle
    • Change progress thumb and its radius
    • Show/hide thumb
    • put progress thumb outside its track
    • Change track width, color
    • Progress color
  • Option with Segmented Arc Seekbar :
    • Change start angle
    • set sweep angle
    • set Max value for arc
    • set Progress radius
    • Change colors of progress and track
    • Set progress thickness for continuous type

๐ŸŽฌ Preview

Basic arc seekbarCustom thumb arc seekbar
Segmented arc seekbarAnimate Progress on start

๐Ÿค” How to use it

  1. Add it in your root build.gradle at the end of repositories:

          allprojects {
              repositories {
                  maven { url 'https://jitpack.io' }
              }
          }
    
  • Add the dependency in your app's build.gradle file

          dependencies {
              implementation 'com.github.SimformSolutionsPvtLtd:SSArcSeekBar:1.0.2'
          }
    
  • Use this code in xml file (Basic arc seekbar)

          <com.ssarcseekbar.app.GaugeSeekBar
              android:id="@+id/progress"
              android:layout_width="0dp"
              android:layout_height="0dp"
              app:layout_constraintDimensionRatio="1"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintStart_toStartOf="parent"
              app:layout_constraintTop_toTopOf="parent"
              app:thumbRadius="18dp"
              app:trackWidth="18dp" />
    
  • Now get the progress

          view.progress.progressChangedCallback = {
              progressText.text = String.format("%.2f", it)
          }
    
  • Custom Thumb arc seekbar with gradiant color

          <com.ssarcseekbar.app.GaugeSeekBar
              android:id="@+id/progress"
              ...
              app:startAngleDegrees="90"
              app:thumbColor="@color/colorPrimary"
              app:thumbDrawable="@drawable/custom_thumb"
              app:trackGradient="@array/progressRainbow"
              app:trackWidth="13dp" />
    
  • Segmented arc seekbar

          <com.ssarcseekbar.app.segmented.SegmentedArc
              android:id="@+id/segmentedArc"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              app:max="40"
              app:progress_primary_circle_size="20"
              app:progress_primary_color="@color/color_progress"
              app:progress_radius="380"
              app:progress_secondary_circle_size="15"
              app:progress_secondary_color="@color/colorPrimaryDark"
              app:start_offset="40" />
    
  • Add animation for the progress, show animation when it is first time loaded on screen

          // Create a function to animate progress 
          private fun valueAnimator(oldProgressValue: Int, newProgressValue: Int) {
              val valueAnimator = ValueAnimator.ofInt(oldProgressValue, newProgressValue)
              valueAnimator.duration = 1000
              valueAnimator.addUpdateListener {
                  view?.segmentedArcSeekbar?.progress = it.animatedValue as Int
              }
              valueAnimator.start() 
          }
    
          // Add delay before starting the animation
          lifecycleScope.launch(Dispatchers.Main) {
              delay(1000)
              valueAnimator(view.segmentedArcSeekbar.getMax(), oldProgressValue)
          }
    

All Attributes


Basic Arc Seekbar

AttributeDescriptionDefault
startAngleDegreesFrom which angle do you want to start your arc.30
thumbRadiusRadius of thumb in seekbar.11
thumbDrawableSet custom icon for thumb.None
showThumbShow/hide thumb according to your need.true
isThumbOutsideIf true then it will set thumb outside the progress track.false
thumbColorSet thumb color when not using any image/drawable for it.orange
trackGradientUsed to set array of colors for track. can be used with single color.grey
showProgressShow/hide progress according to your need.true
progressSet default progress.0
trackWidthset width of seekbar track and progress.8
progressGradientArray of colors for progress. Can be used with single color.green, red

Segmented Arc Seekbar

AttributeDescriptionDefault
start_progressSet default start progress.1
start_offsetSet the seekbar start offset angle from bottom horizontal center.30
sweep_angleSet total angle covered by arc.-1
maxSet the maximum value of the seekbar.25
minSet the minimum value of the seekbar.1
progress_radiusSet the radius of the progress arc.-1
progress_primary_colorSet the progress color.yellow
progress_secondary_colorSet the track color.black
progress_primary_circle_sizeSet the progress circle size.-1
progress_secondary_circle_sizeSet the track circle size..-1
progress_primary_stroke_widthSet the progress thickness for continuous type.25
progress_secondary_stroke_widthSet the track thickness for continuous type.10

Other Library used:

Find this library useful? โค๏ธ

Support it by joining stargazers for this repository..โญ

๐Ÿค How to Contribute

Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! ๐Ÿ’ช Check out our Contributing Guide for ideas on contributing.

๐Ÿ› Bugs and Feedback

For bugs, feature requests, and discussion please use GitHub Issues.

Awesome Mobile Libraries

License

Copyright 2021 Simform Solutions

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.