Home

Awesome

Material-ProgressView

<img src="./image/material_progress_poster.png" style="zoom:50%;" /> <p align="center"> <a href="https://bintray.com/moosphon/maven/Material-ProgressView/_latestVersion"> <img src="https://api.bintray.com/packages/moosphon/maven/Material-ProgressView/images/download.svg"/> </a> <a href="https://github.com/Moosphan/Material-ProgressView/issues"> <img src="https://img.shields.io/github/issues/Moosphan/Material-ProgressView.svg"/> </a> <img src="https://img.shields.io/github/stars/Moosphan/Material-ProgressView.svg"/> <img src="https://img.shields.io/github/forks/Moosphan/Material-ProgressView.svg"/> <img src="https://img.shields.io/github/license/Moosphan/Material-ProgressView.svg"/> </p>

A beautiful and simple used progress view for Android. It provides two different styles to display the progress. You can achieve a gradual change by setting the start color and the end color.

Todo

Recently, this library is refactoring and improving underway. Here's the plan:

Quick start

It's very easy to use this library, just need two or three steps.

Gradle:

  1. Project —> build.gradle :

    allprojects {
        repositories {
            maven { url "https://maven.google.com" }
            jcenter()
        }
    }
    
  2. Moudle —> build.gradle :

    implementation 'com.moos:Material-ProgressView:1.0.6'
    

Use in XML

<com.moos.library.CircleProgressView
        android:id="@+id/progressView_circle"
        android:layout_width="240dp"
        android:layout_height="240dp"
        android:layout_marginTop="12dp"
        app:start_progress="0"
        app:end_progress="60"
        app:start_color="@color/purple_end"
        app:end_color="@color/purple_start"
        app:circleBroken="true"
        app:isTracked="true"
        app:track_width="26dp"/>

<com.moos.library.HorizontalProgressView
      android:id="@+id/progressView_horizontal"
      android:layout_width="320dp"
      android:layout_height="100dp"
      android:layout_marginBottom="40dp"
      android:layout_marginTop="36dp"
      app:start_color="@color/red_start"
      app:end_color="@color/red_end"
      app:track_width="12dp"
      app:end_progress="60"
      app:progressTextColor="#696969"
      app:corner_radius="12dp"
      app:isTracked="true"
      app:trackColor="#f4f4f4"/>

Use In Java/Kotlin

We can use these ProgressViews by following codes:


        //CircleProgressView
        CircleProgressView circleProgressView = (CircleProgressView)       	view.findViewById(R.id.progressView_circle);
        circleProgressView.setStartProgress(0);
        circleProgressView.setEndProgress(80);
        circleProgressView.setStartColor(Color.parseColor("#FF8F5D"));
        circleProgressView.setEndColor(Color.parseColor("#F54EA2"));
        circleProgressView.setCircleBroken(true);
        circleProgressView.setTrackWidth(20);
        circleProgressView.setProgressDuration(2000);
        circleProgressView.setTrackEnabled(true);
        circleProgressView.setFillEnabled(false);
        circleProgressView.startProgressAnimation();
       
        //HorizontalProgressView
        HorizontalProgressView circleProgressView = (HorizontalProgressView)              view.findViewById(R.id.progressView_horizontal);
        horizontalProgressView.setStartProgress(0);
        horizontalProgressView.setEndProgress(80);
        horizontalProgressView.setStartColor(Color.parseColor("#FF8F5D"));
        horizontalProgressView.setEndColor(Color.parseColor("#F54EA2"));
        horizontalProgressView.setTrackWidth(30);
        horizontalProgressView.setProgressDuration(2000);
        horizontalProgressView.setTrackEnabled(true);
        horizontalProgressView.setProgressCornerRadius(20);
        horizontalProgressView.setProgressTextPaddingBottom(12);
        horizontalProgressView.startProgressAnimation();

Something more

Or if you want to let the progress value text moved with HorizontalProgressView progress animation, you can use it like this in xml:

   app:textMovedEnable="true"

Or you can use it in java:

   horizontalProgressView.setProgressTextMoved(true);

What's more, If you want to animate the progress view's value in dynamic state, like download or upload files. You can use method setProgress like this:

......
      //downloading or uploading call back
      @Override
      public void onDownloading(float progress) {
          // you don't need to use `startProgressAnimation` method
          horizontalProgressView.setProgress(progress);
      }
......

API

Attributes

  1. Common attributes:

    AttributeDescription
    start_progressthe progress you wanted to start with
    end_progressthe progress you wanted to finish
    start_colorthe start color of gradient ramp
    end_colorthe end color of gradient ramp
    isTrackeddisplay the progress track or not
    track_widththe width of progress stroke border
    trackColorthe color of progress background
    progressTextVisibilitydisplay or hide the progress value text
    progressTextColorthe color of progress text color
    progressTextSizesize of progress text
    progressDurationthe duration of progress animating from start progress to end progress
    animateTypetype of progress animation moving
  2. Unique attributes for CircleProgressView:

    AttributeDescription
    isFilledfill the progress inner space or not
    circleBrokenthe circle has loophole or not(circle or arc)
    isGraduatedStart the scale zone border mode or not
    scaleZone_widthEach scale zone's width
    scaleZone_lengthEach scale zone's length
    scaleZone_corner_radiusscale zone's rect corner radius
    scaleZone_paddingthe padding between two scale zones
  3. Unique attributes for HorizontalProgressView:

    AttributeDescription
    corner_radiusthe radius of progress four corners
    text_padding_bottomthe distance offset between text and progress view

Sample App download

ProgressView-sample.apk

Update logs

Thanks to

About me

If you have any question or ideas of this library, please let me know by giving an issue. Or you can contact me by the following E-mail:

moosphon@gmail.com

License

Copyright (c) 2018 - 2020 Moosphon 

   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.