Multiple Progress Bar

Additional

Language
Kotlin
Version
1.1.0 (Mar 6, 2021)
Created
Mar 6, 2021
Updated
Mar 6, 2021
Owner
Salih Selim ŞEKERCİ (salihselimsekerci)
Contributor
Salih Selim ŞEKERCİ (salihselimsekerci)
1
Activity
Badge
Generate
Download
Source code

Announcement

MultipleProgressBar

Short description

This library makes it possible to display a progress bar, as in "Social Media" Stories, without much effort.

View support state recovery using onSaveInstanceState

Details

These attributes (app in your layout) allow you to fine-tune the behavior of the progress bar:

  1. lineColor (color) default: Color.GRAY
  2. progressColor (color) default: Color.WHITE
  3. progressSteps (integer) default: 1
  4. progressPadding (dimension) default: 8dp
  5. progressWidth (dimension) default: 10F
  6. progressPercents (integer) default: 100
  7. isNeedRestoreProgress (boolean) default: false
  8. singleDisplayedTime (float) default: 1F

Also the following api allows you to control the display of progress:

  1. start() - starts / resumes showing progress
  2. pause() - pauses showing progress. The scale stops at the current position
  3. previous() - move to the beginning of the previous block of progress. If progress is started, the show will start immediately. Otherwise, it will stop at the beginning of the block.
  4. next() - move to the beginning of the next block of progress. If progress is started, the show will start immediately. Otherwise, it will stop at the beginning of the block.
  5. clear() - clearing the current state of progress, resetting the scale to the very beginning
  6. setListener(listener: ProgressStepChangeListener) - sets the listener ProgressStepChangeListener to switch progress blocks
  7. setProgressPercents(progress: Int - sets the number of percent for calculating the progress scale
  8. setProgressStepsCount(stepsCount: Int) - sets the total number of progress steps
  9. setSingleDisplayTime(singleDisplayedTime: Float) - sets the display time of one cell. Can be used in runtime
interface ProgressStepChangeListener {
    fun onProgressStepChange(newStep: Int)
}

Usage

Artifact is publishing to Jitpack.io . You can add this repository to your project with:

 allprojects {
  repositories {
   ...
   maven { url 'https://jitpack.io' }
  }
 }
}

Add to your .gradle file:

dependencies {
         implementation 'dependencies {
         implementation 'com.github.salihselimsekerci:MultipleProgressBar:1.1.0'
 }'
 }

Sample

The sample is on app module

License

MIT License

Copyright (c) 2021 Salih Selim ŞEKERCİ

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.