Git Product home page Git Product logo

segmentedprogressbar's Introduction

Segmented Progress Bar

Segmented Progress Bar allows you to create progress bars with Segments. And you can update the segments in any sequence.

This comes in very handy when you wish to inform the user about completed/pending segments of the app.

alt text

Sample App

Download the Demo app on Google Play Store:

Get it on Google Play

Installation

Gradle

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

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

Add this line as a dependency in your app's build.gradle file

dependencies {
    implementation 'com.github.rayzone107:durationview:0.0.1'
}

How to use

Add a SegmentedProgressBar to your XML layout

Below are the default values for all the properties

<com.rachitgoyal.segmented.SegmentedProgressBar
        android:id="@+id/segmented_progress_bar"
        android:layout_width="match_parent"
        android:layout_height="10dp"
        
        app:divisions="30"                          \\ Integer value for total number of divisions
        app:progressBarBackgroundColor="#b4b4b4"    \\ Progress bar background color
        app:progressBarColor="#3d70d6"              \\ Progress bar color
        
        app:dividerColor="#ffffff"                  \\ Divider color
        app:dividerWidth="0dp"                      \\ Divider width - set 0dp for no divider
        app:isDividerEnabled="true"                 \\ Whether to show divider or not - no effect if dividerWidth not set
        app:cornerRadius="4dp"                      \\ Corner radius for the progress bar
 />

These values can also be set programatically.

        SegmentedProgressBar spb = findViewById(R.id.segmented_progress_bar);
        
        spb.setDivisions(10);
        spb.setProgressBarBackgroundColor(Color.GREY);
        spb.setProgressBarColor(Color.BLUE);
        spb.setDividerColor(Color.WHITE);
        spb.setDividerWidth(10);                        \\ in px (best to set this using xml, or convert from dp to px first)
        
        spb.setEnabledDivisions(Arrays.asList(1, 3, 4, 6, 8, 9)); \\ pass a list of integers, with the values that are to be enabled.

Now within the code, you can anytime change the value of the enabled/disabled divisions by simply making a call to spb.setEnabledDivisions(enabledList).

Contribution

Any kind of contribution will be appreciated; feel free to create a pull request or file issues on the issue tracker.

segmentedprogressbar's People

Contributors

djani97 avatar rayzone107 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.