Git Product home page Git Product logo

segmentedprogressbar's Introduction

SegmentedProgressBar

Instagram like segmented progress bar for Android.

Screenshots

How does it work?

Just add the dependency to your build.gradle:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
dependencies {
        compile 'com.github.carlosmuvi:SegmentedProgressBar:0.8.3'
}

Next, add it to your layout

  <com.carlosmuvi.segmentedprogressbar.SegmentedProgressBar
      android:id="@+id/segmented_progressbar"
      android:layout_width="match_parent"
      android:layout_height="5dp"/>

Usage and customization

Programatically

segmentedProgressBar = (SegmentedProgressBar) findViewById(R.id.segmented_progressbar);

// number of segments in your bar
segmentedProgressBar.setSegmentCount(7); 

//empty segment color
segmentedProgressBar.setContainerColor(Color.BLUE); 
//fill segment color
segmentedProgressBar.setFillColor(Color.GREEN); 

//play next segment specifying its duration
segmentedProgressBar.playSegment(5000);

//pause segment
segmentedProgressBar.pause();

//reset
segmentedProgressBar.reset();

//set filled segments directly
segmentedProgressBar.setCompletedSegments(3);

//fill the next empty segment without animation
segmentedProgressBar.incrementCompletedSegments();

In your layout

  <com.carlosmuvi.segmentedprogressbar.SegmentedProgressBar
      android:id="@+id/segmented_progressbar"
      android:layout_width="match_parent"
      android:layout_height="5dp"
      app:container_color="@color/colorAccent"
      app:fill_color="@color/colorPrimary"
      app:gap_size="@dimen/progressbar_gap"
      app:segment_count="3"
      />

License

Copyright 2015 Carlos Munoz

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.

segmentedprogressbar's People

Contributors

carlosmuvi avatar dmitrym9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

segmentedprogressbar's Issues

Segment progressbar use with viewpager transform

when first fragment open and it total segment count progress finish. it automatically change next page like instagram story.It works proper but when first screen is open ,in background next fragment progress also start with it . actually its wrong because of it process flow is not proper manage . please can you help me for how can i manage it properly.its progress start with visible fragment only and not in next fragment until it not visible.

Can I use different color for each part of this progress ?

How can I use different color for each part of this progress bar ? For example I want to show red and green color to user. My app is quiz, when user click on answer for example 5th question, I want if answer is correct that specific part color set tor GREEN, if was't correct answer , must be change color to RED, but just 5th part progress bar not all. And use this method for all answers.

How to reset the Progress Bar

First time its fill smoothly when i reused this progressbar its already filled. I am also reset the container background color again when its filled.
Kindly help me?

App crashes when starting the progressbar

Hi,
I am using your library to show a progress bar upon drawing a route using google maps api...
There is a play/pause button to start drawing/tracing the route..
When I click on my play button I have this error:

java.lang.ArithmeticException: divide by zero at
com.carlosmuvi.segmentedprogressbar.SegmentedProgressBar$initDrawingTimer$1.onTick(SegmentedProgressBar.kt:49)

The stacktrace doesn't show any line in my code so I don't really know what I am missing here....
Thx

Add resume feature.

how to resume ? is there any implementation or about to release new version with this feature?

Why does Gradle build fail with "Unable to merge dex" error after adding SegementProgressBar library?

Hello,

After adding your library to my app's build.gradle, I get the following error message:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

From what I can gather, this indicates that there is some kind of dependency issue. I tried resolving the issue by updating my google-services dependencies and updating android sdk to no avail. Furthermore, I am not using Kotlin to develop my application.

Is there a way to find which dependency might be causing this, if any?

Thanks a lot for your time!

Below I have posted my project build.gradle and my app build.gradle and information related to Android Studio version and JVM version.

Project build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url "https://jitpack.io"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "[redacted]"
        minSdkVersion 17
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/rxjava.properties'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    //    compile project(':cardstackview')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'org.igniterealtime.smack:smack-tcp:4.2.0'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.android.support:support-v4:24.2.1'
    compile 'com.android.support:recyclerview-v7:24.2.1'
    compile 'com.android.support:cardview-v7:24.2.1'
    compile 'com.android.support:gridlayout-v7:24.2.1'
    compile 'com.google.android.gms:play-services-maps:+'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'org.jetbrains:annotations-java5:15.0'
    compile 'com.google.android:flexbox:0.2.5'
    compile 'org.igniterealtime.smack:smack-android-extensions:4.2.0'
    compile 'org.igniterealtime.smack:smack-android:4.2.0'
    compile 'io.reactivex:rxandroid:1.1.0'
    compile 'io.reactivex:rxjava:1.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.makeramen:roundedimageview:2.3.0'
    compile 'com.github.carlosmuvi:SegmentedProgressBar:0.6.0'
    testCompile 'junit:junit:4.12'
}

More Specs

Android Studio 3.0
Build #AI-171.4408382, built on October 20, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

call event on complete segment

hello...

actually i want to perfom action after complete 1 segment and also get event for all complete segment from one screen

private void initDrawingTimer() {
    drawingTimer = new DrawingTimer();

    drawingTimer.setListener(new DrawingTimer.Listener() {
        @Override
        public void onTick(int currentTicks, int totalTicks) {

            int segmentWidth = getSegmentWidth();
            currentSegmentProgressInPx = currentTicks * segmentWidth / totalTicks;
            if (totalTicks <= currentTicks) {
                lastCompletedSegment++;
                currentSegmentProgressInPx = 0;

            }
            invalidate();
        }
    });

I see in this condition i can write code for start next segment. for this i use eventbus and post event for start next segment in this condition. and also check if last completed segment and segment count equal that it means all segment of one screen are completed and in this condition post event for start next fragment .

if (totalTicks <= currentTicks) {
lastCompletedSegment++;
currentSegmentProgressInPx = 0;
}
but i found issue that this condition call not only one time but 2- 3 time .so my question is why its happen this condition becomes true means segment completed.but because 2-3 time this condition call - event also post for not one time and multiple time
so any suggestion for manage it?

}

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.