GithubHelp home page GithubHelp logo

akexorcist / roundcornerprogressbar Goto Github PK

View Code? Open in Web Editor NEW
2.5K 68.0 370.0 3.21 MB

[Android] Round Corner Progress Bar Library for Android

License: Apache License 2.0

Kotlin 100.00%
java kotlin android android-library

roundcornerprogressbar's Introduction

Android Kotlin Minimum SDK Version Maven Central Apache 2.0 Workflow Status

Google Dev Library Android Arsenal

RoundCornerProgressBar

Round corner is cool. Let's make your progress bar with round corner

Round Corner Progress Bar Sample

Colorful rounded corner progress bar

Download

Gradle

implementation 'com.akexorcist:round-corner-progress-bar:2.2.1'

Demo

Go to Google Play to download the demo app

Overview

Round Corner Progress Bar

Simple round corner progress bar

Round Corner Progress Bar

CenteredRoundCornerProgressBar

Round corner progress bar with progress expands from the center

Centered Round Corner Progress Bar

Icon Round Corner Progress Bar

Round corner progress bar with heading icon

Icon Round Corner Progress Bar

TextRoundCornerProgressBar

Round corner progress bar with text inside the progress

Icon Round Corner Progress Bar

IndeterminateRoundCornerProgressBar and IndeterminateCenteredRoundCornerProgressBar

Simple round corner progress bar and centered round corner progress bar with indeterminate animation

Indeterminate Round Corner Progress Bar and Indeterminate Centered Round Corner Progress Bar

Feature

Standard Features

  • Primary progress and secondary progress supported
  • Primary progress, secondary progress and progress background color are customizable
  • Customize your own progress background padding
  • Customize your own progress's corner radius
  • Reversing progress bar supported
  • Progress bar with gradient color? Yes!
  • Progress change animation? Absolutely yes!

Component Features

  • Progress expanding from center with CenteredRoundCornerProgressBar
  • Heading icon supported with IconRoundCornerProgressBar
  • Text inside progress supported with TextRoundCornerProgressBar
  • Indeterminate animation supported with IndeterminateRoundCornerProgressBar or IndeterminateCenteredRoundCornerProgressBar

Usage

For using custom attribute of progress bar, define 'app' namespace as root view attribute in your layout

xmlns:app="http://schemas.android.com/apk/res-auto"

RoundCornerProgressBar

Example

<com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar
    android:layout_width="260dp"
    android:layout_height="30dp"
    app:rcBackgroundColor="#0A000000"
    app:rcBackgroundPadding="2dp"
    app:rcMax="100"
    app:rcProgress="40"
    app:rcProgressColor="#EF5350"
    app:rcRadius="10dp"
    app:rcSecondaryProgress="60"
    app:rcSecondaryProgressColor="#40EF5350" />

Round Corner Progress Bar

Layout XML

<com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar
    app:rcProgress="float"
    app:rcSecondaryProgress="float"
    app:rcMax="float"
    app:rcRadius="dimension"
    app:rcBackgroundPadding="dimension"
    app:rcReverse="boolean"
    app:rcProgressColor="color"
    app:rcSecondaryProgressColor="color"
    app:rcBackgroundColor="color"
    app:rcAnimationEnable="boolean"
    app:rcAnimationSpeedScale="float" />

Public Methods

// Progress
fun getMax(): Float
fun setMax(max: Float)
fun setMax(max: Int)
fun getProgress(): Float
fun setProgress(progress: Int)
fun setProgress(progress: Float)
fun getSecondaryProgress(): Float
fun setSecondaryProgress(secondaryProgress: Int)
fun setSecondaryProgress(secondaryProgress: Float)

// Dimension
fun getRadius(): Int
fun setRadius(radius: Int)
fun getPadding(): Int
fun setPadding(padding: Int)
fun getLayoutWidth(): Float

// Animation
fun enableAnimation()
fun disableAnimation()
fun getAnimationSpeedScale(): Float
fun setAnimationSpeedScale(scale: Float)
fun isProgressAnimating(): Boolean
fun isSecondaryProgressAnimating(): Boolean

// Reversing Progress
fun isReverse(): Boolean
fun setReverse(isReverse: Boolean)

// Color
fun getProgressBackgroundColor(): Int
fun setProgressBackgroundColor(color: Int)
fun getProgressColor(): Int
fun setProgressColor(color: Int)
fun getProgressColors(): List<Int>
fun setProgressColors(colors: List<Int>)
fun getSecondaryProgressColor(): Int
fun setSecondaryProgressColor(color: Int)
fun getSecondaryProgressColors(): List<Int>
fun setSecondaryProgressColors(colors: List<Int>)

// Listener
fun setOnProgressChangedListener(listener: OnProgressChangedListener)

CenteredRoundCornerProgressBar

Same as RoundCornerProgressBar but reversing does not supported.

Example

<com.akexorcist.roundcornerprogressbar.CenteredRoundCornerProgressBar
    android:layout_width="260dp"
    android:layout_height="30dp"
    app:rcBackgroundColor="#0A000000"
    app:rcBackgroundPadding="2dp"
    app:rcMax="100"
    app:rcProgress="40"
    app:rcProgressColor="#EF5350"
    app:rcRadius="10dp"/>

Centerd Round Corner Progress Bar

Layout XML

<com.akexorcist.roundcornerprogressbar.CenteredRoundCornerProgressBar
    app:rcProgress="float"
    app:rcSecondaryProgress="float"
    app:rcMax="float"
    app:rcRadius="dimension"
    app:rcBackgroundPadding="dimension"
    app:rcProgressColor="color"
    app:rcSecondaryProgressColor="color"
    app:rcBackgroundColor="color"
    app:rcAnimationEnable="boolean"
    app:rcAnimationSpeedScale="float" />

Public Methods

// Progress
fun getMax(): Float
fun setMax(max: Float)
fun setMax(max: Int)
fun getProgress(): Float
fun setProgress(progress: Int)
fun setProgress(progress: Float)
fun getSecondaryProgress(): Float
fun setSecondaryProgress(secondaryProgress: Int)
fun setSecondaryProgress(secondaryProgress: Float)

// Dimension
fun getRadius(): Int
fun setRadius(radius: Int)
fun getPadding(): Int
fun setPadding(padding: Int)
fun getLayoutWidth(): Float

// Animation
fun enableAnimation()
fun disableAnimation()
fun getAnimationSpeedScale(): Float
fun setAnimationSpeedScale(scale: Float)
fun isProgressAnimating(): Boolean
fun isSecondaryProgressAnimating(): Boolean

// Color
fun getProgressBackgroundColor(): Int
fun setProgressBackgroundColor(color: Int)
fun getProgressColor(): Int
fun setProgressColor(color: Int)
fun getProgressColors(): List<Int>
fun setProgressColors(colors: List<Int>)
fun getSecondaryProgressColor(): Int
fun setSecondaryProgressColor(color: Int)
fun getSecondaryProgressColors(): List<Int>
fun setSecondaryProgressColors(colors: List<Int>)

// Listener
fun setOnProgressChangedListener(listener: OnProgressChangedListener)

IconRoundCornerProgressBar

Icon size is required for this progress bar. Use wrap_content for layout_height is recommended.

<com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar
        android:layout_height="wrap_content"
        app:rcIconSize="40dp"
        ... />

Example

<com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar
    android:layout_width="260dp"
    android:layout_height="wrap_content"
    app:rcBackgroundColor="#0A000000"
    app:rcBackgroundPadding="2dp"
    app:rcIconBackgroundColor="#00796B"
    app:rcIconPadding="5dp"
    app:rcIconSize="40dp"
    app:rcIconSrc="@drawable/ic_android"
    app:rcMax="150"
    app:rcProgress="90"
    app:rcProgressColor="#EF5350"
    app:rcRadius="5dp"
    app:rcReverse="true" />

Icon Round Corner Progress Bar

Layout XML

<com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar
        app:rcProgress="float"
        app:rcSecondaryProgress="float"
        app:rcMax="float"
        app:rcRadius="dimension"
        app:rcBackgroundPadding="dimension"
        app:rcReverse="boolean"
        app:rcProgressColor="color"
        app:rcSecondaryProgressColor="color"
        app:rcBackgroundColor="color"
        app:rcAnimationEnable="boolean"
        app:rcAnimationSpeedScale="float"
        app:rcIconSrc="reference"
        app:rcIconSize="dimension"
        app:rcIconWidth="dimension"
        app:rcIconHeight="dimension"
        app:rcIconPadding="dimension"
        app:rcIconPaddingLeft="dimension"
        app:rcIconPaddingRight="dimension"
        app:rcIconPaddingTop="dimension"
        app:rcIconPaddingBottom="dimension"
        app:rcIconBackgroundColor="color" />

Public Methods

// Progress
fun getMax(): Float
fun setMax(max: Float)
fun setMax(max: Int)
fun getProgress(): Float
fun setProgress(progress: Int)
fun setProgress(progress: Float)
fun getSecondaryProgress(): Float
fun setSecondaryProgress(secondaryProgress: Int)
fun setSecondaryProgress(secondaryProgress: Float)

// Dimension
fun getRadius(): Int
fun setRadius(radius: Int)
fun getPadding(): Int
fun setPadding(padding: Int)
fun getLayoutWidth(): Float

fun getIconSize(): Int
fun setIconSize(size: Int)
fun getIconPadding(): Int
fun setIconPadding(padding: Int)
fun getIconPaddingLeft(): Int
fun setIconPaddingLeft(padding: Int)
fun getIconPaddingTop(): Int
fun setIconPaddingTop(padding: Int)
fun getIconPaddingRight(): Int
fun setIconPaddingRight(padding: Int)
fun getIconPaddingBottom(): Int
fun setIconPaddingBottom(padding: Int)

// Animation
fun enableAnimation()
fun disableAnimation()
fun getAnimationSpeedScale(): Float
fun setAnimationSpeedScale(scale: Float)
fun isProgressAnimating(): Boolean
fun isSecondaryProgressAnimating(): Boolean

// Reversing Progress
fun isReverse(): Boolean
fun setReverse(isReverse: Boolean)

// Color
fun getProgressBackgroundColor(): Int
fun setProgressBackgroundColor(color: Int)
fun getProgressColor(): Int
fun setProgressColor(color: Int)
fun getProgressColors(): List<Int>
fun setProgressColors(colors: List<Int>)
fun getSecondaryProgressColor(): Int
fun setSecondaryProgressColor(color: Int)
fun getSecondaryProgressColors(): List<Int>
fun setSecondaryProgressColors(colors: List<Int>)
fun getColorIconBackground(): Int
fun setIconBackgroundColor(color: Int)

// Icon
fun getIconImageResource(): Int
fun setIconImageResource(resId: Int)
fun getIconImageBitmap(): Birmap
fun setIconImageBitmap(bitmap: Bitmap)
fun getIconImageDrawable(): Drawable
fun setIconImageDrawable(drawable: Drawable)

// Listener
fun setOnProgressChangedListener(listener: OnProgressChangedListener)
fun setOnIconClickListener(listener: OnIconClickListener)

TextRoundCornerProgressBar

Example

<com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar
    android:layout_width="260dp"
    android:layout_height="30dp"
    app:rcBackgroundColor="#0A000000"
    app:rcBackgroundPadding="2dp"
    app:rcMax="100"
    app:rcProgress="40"
    app:rcProgressColor="#EF5350"
    app:rcRadius="80dp"
    app:rcReverse="true"
    app:rcSecondaryProgress="60"
    app:rcSecondaryProgressColor="#40009688"
    app:rcTextPositionPriority="outside"
    app:rcTextProgress="40"
    app:rcTextProgressColor="#111111" />

Text Round Corner Progress Bar

Layout XML

<com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar
        app:rcProgress="float"
        app:rcSecondaryProgress="float"
        app:rcMax="float"
        app:rcRadius="dimension"
        app:rcBackgroundPadding="dimension"
        app:rcReverse="boolean"
        app:rcProgressColor="color"
        app:rcSecondaryProgressColor="color"
        app:rcBackgroundColor="color"
        app:rcAnimationEnable="boolean"
        app:rcAnimationSpeedScale="float"
        app:rcTextProgressColor="color"
        app:rcTextProgressSize="dimension"
        app:rcTextProgressMargin="dimension"
        app:rcTextProgress="String"
        app:rcTextInsideGravity="start|end"
        app:rcTextOutsideGravity="start|end"
        app:rcTextPositionPriority="inside|outside" />

Public Methods

// Progress
fun getMax(): Float
fun setMax(max: Float)
fun setMax(max: Int)
fun getProgress(): Float
fun setProgress(progress: Int)
fun setProgress(progress: Float)
fun getSecondaryProgress(): Float
fun setSecondaryProgress(secondaryProgress: Int)
fun setSecondaryProgress(secondaryProgress: Float)

// Dimension
fun getRadius(): Int
fun setRadius(radius: Int)
fun getPadding(): Int
fun setPadding(padding: Int)
fun getLayoutWidth(): Float
fun getTextProgressSize(): Int
fun setTextProgressSize(size: Int)
fun getTextProgressMargin(): Int
fun setTextProgressMargin(margin: Int)

// Animation
fun enableAnimation()
fun disableAnimation()
fun getAnimationSpeedScale(): Float
fun setAnimationSpeedScale(scale: Float)
fun isProgressAnimating(): Boolean
fun isSecondaryProgressAnimating(): Boolean

// Reversing Progress
fun isReverse(): Boolean
fun setReverse(isReverse: Boolean)

// Color
fun getProgressBackgroundColor(): Int
fun setProgressBackgroundColor(color: Int)
fun getProgressColor(): Int
fun setProgressColor(color: Int)
fun getProgressColors(): List<Int>
fun setProgressColors(colors: List<Int>)
fun getSecondaryProgressColor(): Int
fun setSecondaryProgressColor(color: Int)
fun getSecondaryProgressColors(): List<Int>
fun setSecondaryProgressColors(colors: List<Int>)
fun getTextProgressColor(): Int
fun setTextProgressColor(color: Int)

// Text
fun getProgressText(): String
fun setProgressText(text: String)

// Position
fun getTextPositionPriority(): Int
fun setTextPositionPriority(priority: Int)
fun getTextInsideGravity(): Int
fun setTextInsideGravity(gravity: Int)
fun getTextOutsideGravity(): Int
fun setTextOutsideGravity(gravity: Int)

// Listener
fun setOnProgressChangedListener(listener: OnProgressChangedListener)

IndeterminateRoundCornerProgressBar

Example

<com.akexorcist.roundcornerprogressbar.indeterminate.IndeterminateRoundCornerProgressBar
    android:layout_width="260dp"
    android:layout_height="10dp"
    app:rcAnimationSpeedScale="3"
    app:rcBackgroundColor="#0A000000"
    app:rcProgressColor="#EF5350" />

Indeterminate Round Corner Progress Bar

Layout XML

<com.akexorcist.roundcornerprogressbar.indeterminate.IndeterminateRoundCornerProgressBar
        app:rcRadius="dimension"
        app:rcBackgroundPadding="dimension"
        app:rcReverse="boolean"
        app:rcProgressColor="color"
        app:rcSecondaryProgressColor="color"
        app:rcBackgroundColor="color"
        app:rcAnimationSpeedScale="float" />

Public Methods

// Dimension
fun getRadius(): Int
fun setRadius(radius: Int)
fun getPadding(): Int
fun setPadding(padding: Int)
fun getLayoutWidth(): Float

// Animation
fun getAnimationSpeedScale(): Float
fun setAnimationSpeedScale(scale: Float)

// Reversing Progress
fun isReverse(): Boolean
fun setReverse(isReverse: Boolean)

// Color
fun getProgressBackgroundColor(): Int
fun setProgressBackgroundColor(color: Int)
fun getProgressColor(): Int
fun setProgressColor(color: Int)
fun getProgressColors(): List<Int>
fun setProgressColors(colors: List<Int>)
fun getSecondaryProgressColor(): Int
fun setSecondaryProgressColor(color: Int)
fun getSecondaryProgressColors(): List<Int>
fun setSecondaryProgressColors(colors: List<Int>)

IndeterminateCenteredRoundCornerProgressBar

Same as IndeterminateRoundCornerProgressBar

Example

<com.akexorcist.roundcornerprogressbar.indeterminate.IndeterminateCenteredRoundCornerProgressBar
    android:layout_width="260dp"
    android:layout_height="10dp"
    app:rcAnimationSpeedScale="0.75"
    app:rcBackgroundColor="#0A000000"
    app:rcProgressColor="#EF5350" />

Indeterminate Centered Round Corner Progress Bar

Layout XML

<com.akexorcist.roundcornerprogressbar.IndeterminateCenteredRoundCornerProgressBar
        app:rcRadius="dimension"
        app:rcBackgroundPadding="dimension"
        app:rcReverse="boolean"
        app:rcProgressColor="color"
        app:rcSecondaryProgressColor="color"
        app:rcBackgroundColor="color"
        app:rcAnimationSpeedScale="float" />

Public Methods

// Dimension
fun getRadius(): Int
fun setRadius(radius: Int)
fun getPadding(): Int
fun setPadding(padding: Int)
fun getLayoutWidth(): Float

// Animation
fun getAnimationSpeedScale(): Float
fun setAnimationSpeedScale(scale: Float)

// Reversing Progress
fun isReverse(): Boolean
fun setReverse(isReverse: Boolean)

// Color
fun getProgressBackgroundColor(): Int
fun setProgressBackgroundColor(color: Int)
fun getProgressColor(): Int
fun setProgressColor(color: Int)
fun getProgressColors(): List<Int>
fun setProgressColors(colors: List<Int>)
fun getSecondaryProgressColor(): Int
fun setSecondaryProgressColor(color: Int)
fun getSecondaryProgressColors(): List<Int>
fun setSecondaryProgressColors(colors: List<Int>)

Apply Gradient Progress Bar Color

Gradient color for progress bar must be in int array resource. At least 2 colors.

<!-- Color Resource -->
<resources>
    <array name="sample_progress_gradient">
        <item>#009688</item>
        <item>#80CBC4</item>
    </array>
</resources>

<!-- Layout -->
<com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar
    ...
    app:rcBackgroundColor="#0A000000"
    app:rcBackgroundPadding="4dp"
    app:rcMax="100"
    app:rcProgress="50"
    app:rcProgressColors="@array/sample_progress_gradient"
    app:rcRadius="30dp" />

Gradient Progress Bar Color

Progress bar does not clipped when size changed. So the gradient color will fully display without clipping also.

Apply Progress Change Animation

Animation when progress change is disabled by default (exclude IndeterminateProgressBar and IndeterminateCenteredProgressBar).

So you have to enable the animation by XML attribute or programmatically

<com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar
    ...
    app:rcAnimationEnable="true"
    app:rcAnimationSpeedScale="1" />

When progress changed, the animation will applied automatically.

Comparison Between With/Without Animation

Animation speed scale's value is float between 0.2 - 5.0 (default is 1.0). Higher for slow down the animation, lower for speed up.

What's Next

  • IconTextRoundCornerProgressBar (#69)
  • UI Preview improvement

Known Issues

  • Incorrect progress showing in CenteredRoundCornerProgressBar with 1%-2% value
  • Incorrect text's width in TextRoundCornerProgressBar when outside priority and value close to 100%
  • setProgress(progress: Int) does not update text position

Change Log

See CHANGELOG.md

Migration

See MIGRATION.md

Licence

Copyright 2023 Akexorcist

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or 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.

roundcornerprogressbar's People

Contributors

akexorcist avatar bharat275 avatar first087 avatar kimbeejay avatar romavic 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  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

roundcornerprogressbar's Issues

Parcelable error when reloading app back from stack and has been cleared by the os

Caused by: java.lang.RuntimeException: Parcel android.os.Parcel@1b179a5d: Unmarshalling unknown type code 7471204 at offset 1112

STR:
Enable Don't keep activities in Developer options. Start the app and go to activity with the rc progressbar.
Get out of app and go back to it. crash.

From what i gathered
Happens due to progaurd

Need to add

-keepclassmembers class * implements android.os.Parcelable {
static ** CREATOR;
}

in progaurd-rules

width Animation

Hey, how can I animate the whole progressBar?
I want to set the width from 0 to match parent with an animation.

Anyone knows how?

RunTimeException

Hi i'm getting this through Firebase Crash Console, this happens when i put my app in background (recent list) for a while and then open it again after i dont know several minutes, then app crashes, thanks to firebase i can see the error. This is what it shows:

Thanks in advance.

Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ayc.ayc_app/com.ayc.ayc_app.HolderActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.akexorcist.roundcornerprogressbar.common.BaseRoundCornerProgressBar$SavedState
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2209)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2269)
android.app.ActivityThread.access$800 (ActivityThread.java:139)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1210)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:136)
android.app.ActivityThread.main (ActivityThread.java:5102)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:515)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:803)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:619)
dalvik.system.NativeStart.main (NativeStart.java)
arrow_drop_down
Caused by android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.akexorcist.roundcornerprogressbar.common.BaseRoundCornerProgressBar$SavedState
android.os.Parcel.readParcelableCreator (Parcel.java:2154)
android.os.Parcel.readParcelable (Parcel.java:2104)
android.view.AbsSavedState.<init> (AbsSavedState.java:57)
android.view.View$BaseSavedState.<init> (View.java:18779)
com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState.<init> (TextRoundCornerProgressBar.java:318)
com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState.<init> (TextRoundCornerProgressBar.java:306)
com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState$1.createFromParcel (TextRoundCornerProgressBar.java:340)
com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState$1.createFromParcel (TextRoundCornerProgressBar.java:338)
android.os.Parcel.readParcelable (Parcel.java:2111)
android.os.Parcel.readValue (Parcel.java:2020)
android.os.Parcel.readSparseArrayInternal (Parcel.java:2382)
android.os.Parcel.readSparseArray (Parcel.java:1742)
android.os.Parcel.readValue (Parcel.java:2077)
android.os.Parcel.readArrayMapInternal (Parcel.java:2321)
android.os.Bundle.unparcel (Bundle.java:249)
android.os.Bundle.getSparseParcelableArray (Bundle.java:1275)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:997)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1252)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1234)
android.support.v4.app.FragmentManagerImpl.dispatchCreate (FragmentManager.java:2041)
android.support.v4.app.Fragment.performCreate (Fragment.java:1964)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1029)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1252)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1234)
android.support.v4.app.FragmentManagerImpl.dispatchCreate (FragmentManager.java:2041)
android.support.v4.app.FragmentController.dispatchCreate (FragmentController.java:163)
android.support.v4.app.FragmentActivity.onCreate (FragmentActivity.java:331)
android.support.v7.app.AppCompatActivity.onCreate (AppCompatActivity.java:85)
com.ayc.ayc_app.HolderActivity.onCreate (HolderActivity.java:45)
android.app.Activity.performCreate (Activity.java:5248)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1110)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2173)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2269)
android.app.ActivityThread.access$800 (ActivityThread.java:139)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1210)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:136)
android.app.ActivityThread.main (ActivityThread.java:5102)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:515)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:803)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:619)
dalvik.system.NativeStart.main (NativeStart.java)

ProgressColor is not showing properly

I use the color code #1577F0 (blue) but it seems to be drawing with #36303F (tuna), screenshot and code below

Screenshot => http://i.imgur.com/jf1c8PD.png

Code

    productionDetailProgressBar.setProgressColor(R.color.colorPrimary);
    productionDetailProgressBar.setMax(100);

And in xml

    <com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar
            android:id="@+id/progress_1"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:padding="8dp" />

Text Alignment (TextRoundCorner )

Hello, nice work. I would like to suggest a new feature. Like set the property Text Alignment on the TextRoundCorner (Center, Left or Right)

Or is it already implemented?

Regards

Typos in readme

  1. Usage of rcReverse is reversed.
  2. In the example at the bottom, layout_width and layout_height are switched.

Unable to instantiate view

Every time i get this error in xml layout unable to instantiate view.

Rendering Problems The following classes could not be instantiated:
- com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar (Open Class, Show Exception)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details
java.lang.NullPointerException
at com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar.setBackgroundColor(RoundCornerProgressBar.java:194)
at com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar.(RoundCornerProgressBar.java:81)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:413)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
at com.android.tools.idea.rendering.LayoutlibCallback.loadView(LayoutlibCallback.java:176)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:206)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:131)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:756)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:728)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:391)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:337)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:708)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:697)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:697)
at com.android.tools.idea.rendering.RenderService.render(RenderService.java:816)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:646)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:82)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:589)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:584)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

Centered Progress Bar

Hello, I made a temporary implementation while waiting for the request to be evaluated.
This is a simple tutorial in which you will need to create some custom files.

Step 1 : setup

Create a class with a custom name. In example, let's say CenteredProgressBar.java.
What you need is:

  • to extend com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar:

    import com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar;
    
    public class CenteredProgressBar extends RoundCornerProgressBar {
    
    }
  • to create two constructors matching super class:

    public CenteredProgressBar(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    
    public CenteredProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    since @akexorcist uses them both and we need to use them

  • to override the drawProgress method, using MarginLayoutParams to simulate a left margin equal to (max width - current width) / 2:

    @SuppressWarnings("deprecation")
    @Override
    protected void drawProgress(LinearLayout layoutProgress, float max, float progress, float totalWidth,
                                int radius, int padding, int colorProgress, boolean isReverse) {
    
        super.drawProgress(layoutProgress, max, progress, totalWidth, radius, padding, colorProgress, isReverse);
        MarginLayoutParams params = (MarginLayoutParams) layoutProgress.getLayoutParams();
    
        float ratio = max / progress;
        float progressWidth = (totalWidth - (padding * 2)) / ratio;
        float deltaWidth = totalWidth - progressWidth;
    
        params.setMargins((int) (deltaWidth / 2), params.topMargin, (int) (deltaWidth / 2), params.bottomMargin);
        layoutProgress.setLayoutParams(params);
    }

Step 2 : use it!

It's simple! Just call your custom object in your layout.

<com.your.app.package.CenteredProgressBar
                    android:layout_width="80dp"
                    android:layout_height="8dp"
                    android:layout_gravity="center_horizontal|center_vertical"
                    android:layout_margin="8dp"
                    xmlns:app="http://schemas.android.com/apk/res-auto"
                    app:rcBackgroundPadding="1dp"
                    app:rcBackgroundColor="#000000"
                    app:rcProgress="0.3"
                    app:rcMax="1" />

Demo

Here is an example. The grey background is from my external layout, you would not see it if you copy paste.

aaa

The gradient bar color is explained in another issue: #39

I would like to give my thanks to @akexorcist for his awesome work. It really boosted my app development!

Icon bug

I created an IconProgressBar. If I start the activity the icon is show very big for like a half second in the middle of the screen and dissapears then. This looks awful.

Add view instead of icon

Hello, nice work. I would like to suggest an addition. Instead of adding an icon at the beginning of progress bar, why not to add a TextView or another view.

Or is it already implemented?

There is still error on older versions

Hi guys,

I am using your widget on my app. In android 2.3.7 version, I have an error although I use 1.1.0 version. It crashes while inflating the view. And there is logcat below:

882-882/com.sembozdemir.dortislem E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.NoSuchMethodError: android.view.ViewTreeObserver.removeOnGlobalLayoutListener
            at com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar$1.onGlobalLayout(RoundCornerProgressBar.java:109)
            at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:549)
            at android.view.ViewRoot.performTraversals(ViewRoot.java:1189)
            at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:130)
            at android.app.ActivityThread.main(ActivityThread.java:3683)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:507)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
            at dalvik.system.NativeStart.main(Native Method)

by the way: Click here if you want to see the app

Animation

Any plans of adding animation effects in the near future?

Can't build TextRoundCornerProgressBar

Included com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar into xml.

compile 'com.akexorcist:RoundCornerProgressBar:2.0.3'
classpath 'com.android.tools.build:gradle:1.5.0'
buildToolsVersion '23.0.2'


Warning: com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$2: can't find referenced method 'android.widget.TextView access$000(com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar)' in program class com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar
Warning: com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$2: can't find enclosing method 'void setTextProgressAlign()' in program class com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar

fix google play link

there is l end of google play link and cause of google couldn't find this library on play store, fix it 👍

Vertical progressbar

I would like to implement this progress bar but with a vertical orientation.

Is that possible? If so what syntax would i need?

Thanks in advance

Use as SeekBar

Is it possible to use this libraries ProgressBar as a SeekBar?
If it's not a built in feature, how easy would it be to implement such a ability?

RuntimeException: Parcel android.os.Parcel@3d770ee5: Unmarshalling unknown type code 7471204 at offset 2264

There is some issues with view state restoring:

SavedState of BaseRoundCornerProgressBar does not write all the values in write in writeToParcel,
correct code is:

        public void writeToParcel(Parcel out, int flags) {
            super.writeToParcel(out, flags);
            out.writeFloat(this.max);
            out.writeFloat(this.progress);
            out.writeFloat(this.secondaryProgress);

            out.writeInt(this.backgroundWidth);
            out.writeInt(this.backgroundHeight);
            out.writeInt(this.radius);
            out.writeInt(this.padding);
            out.writeInt(this.progressColor);
            out.writeInt(this.secondaryProgressColor);
            out.writeInt(this.backgroundColor);

            out.writeInt(this.layoutBackgroundColor);
            out.writeInt(this.layoutProgress);
            out.writeInt(this.layoutSecondaryProgress);

            out.writeByte((byte) (this.isProgressBarCreated ? 1 : 0));
            out.writeByte((byte) (this.isProgressSetBeforeDraw ? 1 : 0));
            out.writeByte((byte) (this.isMaxProgressSetBeforeDraw ? 1 : 0));
            out.writeByte((byte) (this.isBackgroundColorSetBeforeDraw ? 1 : 0));
            out.writeByte((byte) (this.isProgressColorSetBeforeDraw ? 1 : 0));
            out.writeByte((byte) (this.isScreenMeasure ? 1 : 0));
            out.writeByte((byte) (this.isBackgroundLayourSet ? 1 : 0));
        }

After fixing this issue I am getting other issues with IconRoundCornerProgressBar
Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.ake
xorcist.roundcornerprogressbar.common.BaseRoundCornerProgressBar$SavedState
E at android.os.Parcel.readParcelableCreator(Parcel.java:2289)
E at android.os.Parcel.readParcelable(Parcel.java:2239)
E at android.view.AbsSavedState.(AbsSavedState.java:57)
E at android.view.View$BaseSavedState.(View.java:20038)
E at com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar$SavedState.(IconRo
undCornerProgressBar.java:216)
E at com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar$SavedState.(IconRo
undCornerProgressBar.java:202)
E at com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar$SavedState$1.createFromP
arcel(IconRoundCornerProgressBar.java:240)
E at com.akexorcist.roundcornerprogressbar.IconRoundCornerProgressBar$SavedState$1.createFromP
arcel(IconRoundCornerProgressBar.java:238)
E at android.os.Parcel.readParcelable(Parcel.java:2246)
E at android.os.Parcel.readValue(Parcel.java:2146)
E at android.os.Parcel.readSparseArrayInternal(Parcel.java:2540)
E at android.os.Parcel.readSparseArray(Parcel.java:1868)
E at android.os.Parcel.readValue(Parcel.java:2203)
E at android.os.Parcel.readArrayMapInternal(Parcel.java:2479)
E at android.os.BaseBundle.unparcel(BaseBundle.java:221)
E at android.os.Bundle.getSparseParcelableArray(Bundle.java:871)
E at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1979)
E at android.app.Activity.onRestoreInstanceState(Activity.java:1022)
E at android.app.Activity.performRestoreInstanceState(Activity.java:977)
E at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1161)
E at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2271)

All tested with the sample prject and with don't keep actitivties activated

android.os.BadParcelableException: ClassNotFoundException when unmarshalling

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.routeyou.startup/com.routeyou.ui.DownloadRouteActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.akexorcist.roundcornerprogressbar.common.BaseRoundCornerProgressBar$SavedState at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3184) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3294) at android.app.ActivityThread.access$1000(ActivityThread.java:210) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1704) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) Caused by android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.akexorcist.roundcornerprogressbar.common.BaseRoundCornerProgressBar$SavedState at android.os.Parcel.readParcelableCreator(Parcel.java:2295) at android.os.Parcel.readParcelable(Parcel.java:2245) at android.view.AbsSavedState.<init>(AbsSavedState.java:57) at android.view.View$BaseSavedState.<init>(View.java:21487) at com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState.<init>(TextRoundCornerProgressBar.java:318) at com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState.<init>(TextRoundCornerProgressBar.java:306) at com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState$1.createFromParcel(TextRoundCornerProgressBar.java:340) at com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$SavedState$1.createFromParcel(TextRoundCornerProgressBar.java:338) at android.os.Parcel.readParcelable(Parcel.java:2252) at android.os.Parcel.readValue(Parcel.java:2152) at android.os.Parcel.readSparseArrayInternal(Parcel.java:2546) at android.os.Parcel.readSparseArray(Parcel.java:1874) at android.os.Parcel.readValue(Parcel.java:2209) at android.os.Parcel.readArrayMapInternal(Parcel.java:2485) at android.os.BaseBundle.unparcel(BaseBundle.java:221) at android.os.Bundle.getSparseParcelableArray(Bundle.java:822) at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2290) at android.app.Activity.onRestoreInstanceState(Activity.java:1170) at android.app.Activity.performRestoreInstanceState(Activity.java:1115) at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1190) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3157) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3294) at android.app.ActivityThread.access$1000(ActivityThread.java:210) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1704) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

progress and max value on first inflate

I came to a issue where I was trying to get progress value on first inflation but I was getting only default value (0.0), not the one I set in xml. The problem got solved by chaning position of if branch

if (!isProgressSetBeforeDraw) { 
            progress = typedArray.getFloat(R.styleable.RoundCornerProgress_rcProgress, DEFAULT_CURRENT_PROGRESS);
            secondaryProgress = typedArray.getFloat(R.styleable.RoundCornerProgress_rcSecondaryProgress, DEFAULT_SECONDARY_PROGRESS);
        }

if (!isProgressColorSetBeforeDraw) {
            setProgressColor(
                    typedArray.getColor(R.styleable.RoundCornerProgress_rcProgressColor, DEFAULT_PROGRESS_COLOR),
                    typedArray.getColor(R.styleable.RoundCornerProgress_rcSecondaryProgressColor, DEFAULT_SECONDARY_PROGRESS_COLOR)
            );
        }

if (!isMaxProgressSetBeforeDraw) {
            max = typedArray.getFloat(R.styleable.RoundCornerProgress_rcMax, DEFAULT_MAX_PROGRESS);
        }

in file https://github.com/akexorcist/Android-RoundCornerProgressBar/blob/master/library/src/main/java/com/akexorcist/roundcornerprogressbar/common/BaseRoundCornerProgressBar.java

When padding is changed pragmatically it does not refresh the view

To start, love the library. I am changing the padding of the progressbar pragmatically and it does not refresh the view to match the progress. How would I solve this issue. I will post two photos of the issue.

The progress bar is below the toolbar. I have set the max to 100 and progress to 50
device-2015-03-15-142740

Here is what the progress bar looks like when I change the padding on the left and right of it.
device-2015-03-15-142816

Fix low version compatibility

Method "removeOnGlobalLayoutListener" is API Level 16

Method "setProgressColor" in RoundCornerProgressBar class is wrong.

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    layoutBackground.setBackground(gradient);
} else {
    layoutBackground.setBackgroundDrawable(gradient);
}

Please fix it.

Nice library. Thx.

Progress not showing after VISIBLE from GONE

When I set GONE visibility on the progressbar or the surrounding layout ,when visibility is set back to visible progress is not showing.Working normaly when INVISIBLE and back to VISIBLE ,but with GONE has a problem

Can the progress bar be vertical?

Wondering if the pb can be rotated that way be display vertical sided?
I mean programmatically can be done by setRotation() method, the thing its i need like 5 progress bar's in conjuction and need them perfectly aligned one after another one.

Great work

drawPrimaryProgress called twice with same parameters

Hi,

In onSizeChanged, there are 2 calls to drawPrimaryProgress with same parameters. The calls are on different threads , if I remove one of them the progress is not drawn. Why does the postDelayed needed? Why doesnt the first call take effect? I am asking because the postDelayed call causes an unwanted blink.

Thanks.

Screen in half

Hey, i tried to use your progressBar but i had a window that is split into 2 sides left and right, i tried to use your progressbar but it tries to use the whore screen as the main width instead of one side.

using compile 'com.akexorcist:RoundCornerProgressBar:1.2.0'

screenshot_2015-06-14-22-26-19

my xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:baselineAligned="false"
        android:orientation="horizontal"
        android:paddingBottom="@dimen/main_screen_between_padding">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1.0"
            android:layout_marginRight="@dimen/main_screen_between_padding"
            android:layout_marginStart="@dimen/main_screen_between_padding"
            android:layout_marginLeft="@dimen/main_screen_zero_dp"
            android:layout_marginEnd="@dimen/main_screen_zero_dp"
            android:background="@drawable/background_note"
            android:id="@+id/note_button">

            <com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar
                android:id="@+id/audio_progress"
                android:layout_width="fill_parent"
                android:layout_height="20dp"
                android:layout_above="@+id/textView"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_margin="10dp"
                app:rcProgressColor="@color/progressBarColor"
                app:rcProgress="30"
                app:rcMax="100"
                app:rcBackgroundPadding="2dp"
                app:rcBackgroundRadius="5dp"/>


        </RelativeLayout>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:orientation="vertical"
            android:layout_marginEnd="@dimen/main_screen_zero_dp"
            android:layout_marginLeft="@dimen/main_screen_between_padding"
            android:layout_marginRight="@dimen/main_screen_zero_dp"
            android:layout_marginStart="@dimen/main_screen_between_padding"
            android:background="@drawable/background_pic"
            android:id="@+id/photo_button">

        </RelativeLayout>
    </LinearLayout>

</LinearLayout>

When i try to render it in android studio:

java.lang.NullPointerException
    at com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar.setBackgroundLayoutSize(RoundCornerProgressBar.java:48)
    at com.akexorcist.roundcornerprogressbar.BaseRoundCornerProgressBar.onMeasure(BaseRoundCornerProgressBar.java:218)
    at android.view.View.measure(View.java:17547)
    at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727)
    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463)
    at android.view.View.measure(View.java:17547)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1083)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:615)
    at android.view.View.measure(View.java:17547)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17547)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
    at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:124)
    at android.view.View.measure(View.java:17547)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
    at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:444)
    at android.view.View.measure(View.java:17547)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17547)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:875)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17547)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:640)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:540)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:323)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:497)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:485)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:894)
    at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:485)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:590)
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:480)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
    at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:351)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Progress bar does not move ahead

I have set rcMax as app:rcMax="10000"

and when I try to set progress such as 6000 the progress bar is stuck at a level of 5000

Problem with RecyclerView not rendering the progress.

So.. I'm using CardsLib with a CardRecyclerViewList and I'm having problems with the rendering of the ProgressBar.

The only elements that get rendered are the elements that are visible on the first screen. But as I scroll down all of the remaining cards only show a grey background.

unnamed

Rendering problem

Hi!
I have this error on preview layout:
java.lang.NullPointerException   at com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar.setBackgroundLayoutSize(RoundCornerProgressBar.java:50)   at com.akexorcist.roundcornerprogressbar.common.BaseRoundCornerProgressBar.onMeasure(BaseRoundCornerProgressBar.java:220)

this is my layout file:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center">
    <com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar
        android:id="@+id/progress_splash_screen"
        android:layout_height="32dp"
        android:layout_width="match_parent"
        app:backgroundPadding="5dp" />
</LinearLayout>

why??

Attribute "..." has already been defined

When I want to build my project only with the gradle addition of your project I receive the following errors...

\app\build\intermediates\res\debug\values\values.xml:497: error: Attribute "progress" has already been defined

\app\build\intermediates\res\debug\values\values.xml:497: error: Attribute "max" has already been defined

\app\build\intermediates\res\debug\values\values.xml:497: error: Attribute "iconSize" has already been defined

\app\build\intermediates\res\debug\values\values.xml:497: error: Attribute "iconPadding" has already been defined

Maybe add a prefix to all your custom attributes?

TextRoundCornerProgressBar alignment of text .

I have used TextRoundCornerProgressBar and i want to suggest a enhancement of text gravity .
Currently it's rendering left of progress view and we can add this alignment as per user oriented like left,right or center.

there is no progress happening.

hi,

I'm trying to use your library to implement a loading bar. However, when I use settings like :

  1. layout_width = "fill_parent"
  2. layout weight = 1 along with layout_width = 0

I don't see any progress happening. Just an empty bar.

But when I explicitly put for example layout_width = 250dp , then it works without any problem. Here is a image of my layout xml :

http://imgur.com/3odBve4

Any suggestions? thank yoi

Corners still showing up even radius set ,

im using 2.0.2, since its the only one that worked properly, but im having problems with corners, even when the radius is set, the bars corners do change by the bars view itself has corners , not sure how to get rid of it, i tried changing the background of it to transparent but does nothing ,

Filling progress with drawable texture

Hello. Tell me please, can I set drawable resource for progress, not color? Something like rcProgressDrawable attribute. I would like to fill progress with drawable texture with tile mode. Can your library provide this feature? If not, is it planned in the future? Thanks in advance.

Skew Line

It's possible to do it with this library?

image

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.