Giter Site home page Giter Site logo

circularprogressbar's Introduction

circularprogressbar's People

Contributors

lopspower avatar ytrino 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

circularprogressbar's Issues

Caused by kotlin.UninitializedPropertyAccessException

Caused by kotlin.UninitializedPropertyAccessException
lateinit property initialState has not been initialized
br.com.simplepass.loadingbutton.customViews.CircularProgressButton.access$getInitialState$p (CircularProgressButton.kt:21)
br.com.simplepass.loadingbutton.customViews.CircularProgressButton$morphAnimator$2.invoke (CircularProgressButton.kt:70)
br.com.simplepass.loadingbutton.customViews.CircularProgressButton$morphAnimator$2.invoke (CircularProgressButton.kt:21)
kotlin.SynchronizedLazyImpl.getValue (LazyJVM.kt:74)
br.com.simplepass.loadingbutton.customViews.CircularProgressButton.getMorphAnimator (Fonte desconhecida:7)
br.com.simplepass.loadingbutton.customViews.CircularProgressButton.dispose (CircularProgressButton.kt:171)
java.lang.reflect.Method.invoke (Method.java)
androidx.lifecycle.ClassesInfoCache$MethodReference.invokeCallback (ClassesInfoCache.java:216)
androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeMethodsForEvent (ClassesInfoCache.java:194)
androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeCallbacks (ClassesInfoCache.java:185)
androidx.lifecycle.ReflectiveGenericLifecycleObserver.onStateChanged (ReflectiveGenericLifecycleObserver.java:37)
androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent (LifecycleRegistry.java:361)
androidx.lifecycle.LifecycleRegistry.backwardPass (LifecycleRegistry.java:316)
androidx.lifecycle.LifecycleRegistry.sync (LifecycleRegistry.java:334)
androidx.lifecycle.LifecycleRegistry.moveToState (LifecycleRegistry.java:145)
androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent (LifecycleRegistry.java:131)
androidx.lifecycle.ReportFragment.dispatch (ReportFragment.java:68)
androidx.lifecycle.ReportFragment$LifecycleCallbacks.onActivityPreDestroyed (ReportFragment.java:216)
android.app.Activity.dispatchActivityPreDestroyed (Activity.java:1415)
android.app.Activity.performDestroy (Activity.java:8174)
android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1342)
android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5019)
android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:5063)
android.app.servertransaction.DestroyActivityItem.execute (DestroyActivityItem.java:44)
android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:176)
android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:2044)
android.os.Handler.dispatchMessage (Handler.java:107)
android.os.Looper.loop (Looper.java:224)
android.app.ActivityThread.main (ActivityThread.java:7562)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:539)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:950)

Exclude kotlin-stdlib from pom file

Your lib dependency :

./gradlew -q app:dependencies
Output:

debugCompileClasspath - Compile classpath for compilation 'developDebug' (target  (androidJvm)).
+--- com.mikhaellopez:circularprogressbar:3.0.3
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.50 -> 1.3.72 (*)

Center color

Hi can we add the center color inside the circle ?

progress max

How to set progress max .
It is possible if yes then how and not then what is max progress.

Build fails while using Databinding

For some reason, the build fails while using databindng feature with the progress bar.

I was using the binding variable to set the progress value on the progressbar. The code is as follows

<com.mikhaellopez.circularprogressbar.CircularProgressBar 
            app:cpb_background_progressbar_color="@color/c_light_orange_ff"
            app:cpb_background_progressbar_width="@dimen/spacing_4"
            .
            .
            .
            app:cpb_progress="@{vm.progress}" 
/>

Above vm is the binding variable and progress is a variable of type Float

I use databinding in my project heavily and every other databinding expression is working fine. Only when I try to use the binding with CircularProgressBar the build fails with a very generic error BindingClassImpl symbol not found(Thanks DataBinding it was very helpful -_- ).

Can someone please guide what am I probably doing wrong?

Environment Specs:
Dependency:implementation 'com.mikhaellopez:circularprogressbar:3.0.3'
Android Studio: 3.5.2
Gradle Distribution: gradle-5.1.1-all.zip
Mac Os: Catalina 10.15.5
Model: MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports)
Processor: 2.3 GHz Dual-Core Intel Core i5

Why just support float number?

Hello.
In this code:

progressBar.setOnProgressChangedListener(new CircularProgressBar.ProgressChangeListener() {
            @Override
            public void onProgressChanged(float progress) {
            }
        });

float progress

I need to work with Double number but your library just support float progress number.
Is there any way to fix it?

Restart animation

How to restart animation?
setProgressWithAnimation(float progress) just do nothing.
I need it for progressbar for recyclerview because I don't want recreate progressbar just to show animation.

Design Contribution

Hi, I am a graphic designer. I do designs for open source projects. I designed a logo for Circular. The designs are as follows.

circular_design
Did you like it?

the app crashes when calling Activity.finish because of the library

the issue is present in stack over flow by another user as well :
https://stackoverflow.com/questions/56200896/unable-to-destroy-activity-failed-to-call-observer-method

when you call Activity.finish(), the app crashes and these are the logs that holds the root cause :

Caused by: kotlin.UninitializedPropertyAccessException: lateinit property initialState has not been initialized
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.access$getInitialState$p(CircularProgressButton.kt:21)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton$morphAnimator$2.invoke(CircularProgressButton.kt:70)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton$morphAnimator$2.invoke(CircularProgressButton.kt:21)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.getMorphAnimator(Unknown Source:7)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.dispose(CircularProgressButton.kt:171)
at java.lang.reflect.Method.invoke(Native Method)
at androidx.lifecycle.ClassesInfoCache$MethodReference.invokeCallback(ClassesInfoCache.java:216)
at androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeMethodsForEvent(ClassesInfoCache.java:194) 
at androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeCallbacks(ClassesInfoCache.java:185) 
at androidx.lifecycle.ReflectiveGenericLifecycleObserver.onStateChanged(ReflectiveGenericLifecycleObserver.java:36) 
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:361) 
at androidx.lifecycle.LifecycleRegistry.backwardPass(LifecycleRegistry.java:316) 
at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:334) 
at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:145) 
at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:131) 
at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:123) 
at androidx.lifecycle.ReportFragment.onDestroy(ReportFragment.java:108) 
at android.app.Fragment.performDestroy(Fragment.java:2870) 
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1424) 
at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1554) 
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1616) 
at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3044) 
at android.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:3024) 
at android.app.FragmentController.dispatchDestroy(FragmentController.java:244) 
at android.app.Activity.performDestroy(Activity.java:7251) 
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1249) 
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4492) 
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4523) 
at android.app.ActivityThread.-wrap5(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1683) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:176) 
at android.app.ActivityThread.main(ActivityThread.java:6701) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:249) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783) 

Memory leak if you set `indeterminateMode` on detached view

When you set the indeterminateMode to true you spawn a handler that continuously updates the state of the progress bar.

    var indeterminateMode = false
        set(value) {
            field = value
            onIndeterminateModeChangeListener?.invoke(field)
            progressIndeterminateMode = 0f
            progressDirectionIndeterminateMode = ProgressDirection.TO_RIGHT
            startAngleIndeterminateMode = DEFAULT_START_ANGLE

            indeterminateModeHandler?.removeCallbacks(indeterminateModeRunnable)
            progressAnimator?.cancel()
            indeterminateModeHandler = Handler()

            if (field) {
                indeterminateModeHandler?.post(indeterminateModeRunnable)
            }
        }

The problem is that this handler gets cleared only in onDetachedFromWindow. Hence you get the leak if the view was never attached.

Beware or Proguard Incompatibilities

ObjectAnimator uses reflection to call its method, which won't work if a user proguards their application. Either ignore this class for proguard, or check if ValueAnimator can be used. Example:

ValueAnimator animator = ValueAnimator.ofFloat(currentAngle, newAngle);
animator.setDuration(duration);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
	@Override
	public void onAnimationUpdate(ValueAnimator animation) {
		...
		invalidate();
	}
});
animator.start();

indeterminate mode?

Any plans to support indeterminate mode ? or offset ?
It looks quite simple to implement, would you take a pull request for this functionality ?
Thanks

Get Progress State

How i can get Progress State ?

i used :
CircularProgressBar circularProgressBar = view.findViewById(R.id.cpg_verify_code_fragment);
circularProgressBar.setProgressWithAnimation(100, 120000);

I need to know how many steps passed And how many reminds, progress And duration ?

Bug on Samsung M10

<com.mikhaellopez.circularprogressbar.CircularProgressBar
                        android:id="@+id/progress_bar"
                        android:layout_width="@dimen/_40sdp"
                        android:layout_height="@dimen/_40sdp"
                        android:layout_centerInParent="true"
                        android:layout_gravity="center"
                        android:visibility="visible"
                        app:cpb_background_progressbar_color="@android:color/transparent"
                        app:cpb_background_progressbar_width="2dp"
                        app:cpb_indeterminate_mode="true"
                        app:cpb_progress_direction="to_right"
                        app:cpb_progressbar_color="@color/white"
                        app:cpb_progressbar_width="6dp"/>

on Samsung device
on other devices

SetProgress sets progress to maxProgress if the old progress was higher than maxProgress

I think there is a small bug in this library. For example: when you set the max progress to 20 and the progress to 15, then set the max progress to 10 and the progress to 5, the actual progress will be set to 10 because of this line.

This is a very easy fix, just change if (progress ... to if (value ... so that it checks the actual progress you set.

The use case where i am facing this is in a recyclerview. Here i have different max progress and progress values in each entry for a leveling system. As rows get recycled the max progress is changed before the progress.

A quick workaround (without changing the library) is to set the progress to 0 before changing the maxProgress.

Cancel Progress Animation

public class CircularProgressBarExtended extends CircularProgressBar {

	private ObjectAnimator objectAnimator;
	public CircularProgressBarExtended(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public void setProgressWithAnimation(float progress, int duration, TimeInterpolator interpolator) {
		objectAnimator = ObjectAnimator.ofFloat(this, "progress", progress);
		objectAnimator.setDuration(duration);
		objectAnimator.setInterpolator(interpolator);
		objectAnimator.start();
	}

	public void cancelAnimation(){
		if(objectAnimator != null){
			objectAnimator.cancel();
		}
	}

}

Animation direction

Is there a way for animation to be set from 0 to the progress level or vice-versa?

Set progressbar with animation error

When I use circularProgressBar.setProgressWithAnimation(65f, 1000);

I get error - "Wrong 2nd argument type, found int, required Java.lang.long "

CountDown progressbar

Is it possible to use CircularProgressBar as CountDown progressbar automatically ?

or should to set it manually ?

set progress in data binding

hi.
i don't set progress in xml with data binding??
please help me!

<com.mikhaellopez.circularprogressbar.CircularProgressBar android:id="@+id/pb_improvement_fragmentStateProfile" android:layout_width="wrap_content" android:layout_height="0dp" android:scrollbarFadeDuration="1000" app:cpb_background_progressbar_color="@color/shadowOrange" app:cpb_background_progressbar_width="5dp" app:cpb_progress="@{data.improvementPercent}" app:cpb_progress_direction="to_right" app:cpb_progressbar_color="@color/orange" app:cpb_progressbar_width="5dp" app:cpb_round_border="false" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.0" />

i try by any type of variable(int,float,...),but not working

Release

This library is in version 3.0.2
Why don't you create a Release?

Initialize CircularProgressBar with no AttributeSet

Hello,
I define the CircularProgressBar in the Kotlin class and not in the xml file. In the previous versions I was able to initialize it passing null as attributeSet while with the new version I can't. Can you please make it possible to initialize it with a null attributeSet parameter again?
Many thanks for your time.

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.