rahatarmanahmed / circularprogressview Goto Github PK
View Code? Open in Web Editor NEWMaterial style circular progress bar for Android
License: MIT License
Material style circular progress bar for Android
License: MIT License
I want a smaller progress view but I am not able to change the size.
For example, I call setProgress(100) on a view that its progress is 0.
Is it possible to know when the animation has ended?
as the title says. What are the configurations for this?
Also, can I make it so that if newer versions of Android arrive, it will use their default style and not the one of the library?
Hi
Well first of all your work is amazing!!
I added this code to my webView based app.But it loads forever.
When my website completes loading it still running.
Can you guide me what to do for that
Any way of setting the "behind progress color" like in this example ?
Hi,
I try to use it with image pager UIL library.
https://github.com/nostra13/Android-Universal-Image-Loader/tree/master/sample
There is an adapter with item that has an image and a progrees bar on top of it, after the image is loaded the progress bar is hidden. So there are many instances of a progress bar there...
UIL crashes with an error about out of memory on their sample application after about 10-20 swipes.
With a standard progress bar this doesn't happen
When implementing the basic CircularProgressView I noticed a memory leak from the Android Monitor.
Hie Guys
Im grateful for your piece of work, but however i have an issue. The thing is, everything works fine, when im doing an async task the progressview should animate ( and it does,using the method startAnimation() ) but my challenge comes to when i want to stop the animation...i would suggest for a stopAnimation() method...thanks again
I use progessview only on xml and not use on code, progressview show on dialogfragment
Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'boolean android.animation.AnimatorSet.mTerminated' on a null object reference
at android.animation.AnimatorSet$DependencyListener.startIfReady(AnimatorSet.java:778)
at android.animation.AnimatorSet$DependencyListener.onAnimationStart(AnimatorSet.java:767)
at android.animation.ValueAnimator.notifyStartListeners(ValueAnimator.java:981)
at android.animation.ValueAnimator.start(ValueAnimator.java:1043)
at android.animation.ValueAnimator.start(ValueAnimator.java:1050)
at android.animation.AnimatorSet.start(AnimatorSet.java:585)
at android.animation.AnimatorSet.start(AnimatorSet.java:585)
at com.github.rahatarmanahmed.cpv.CircularProgressView.resetAnimation(CircularProgressView.java:399)
at com.github.rahatarmanahmed.cpv.CircularProgressView$5.onAnimationEnd(CircularProgressView.java:396)
at android.animation.AnimatorSet$AnimatorSetListener.onAnimationEnd(AnimatorSet.java:854)
at android.animation.AnimatorSet$AnimatorSetListener.onAnimationEnd(AnimatorSet.java:854)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1171)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:722)
at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:738)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:829)
at android.view.Choreographer.doCallbacks(Choreographer.java:606)
at android.view.Choreographer.doFrame(Choreographer.java:575)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:815)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6934)
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)
CircularProgressView lags while spinning.
java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class com.yingyonghui.market.widget.CircularProgressView$WheelSavedState instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/0x0. Make sure other views do not use the same id.
at android.view.View.onRestoreInstanceState(View.java:13978)
at android.view.View.dispatchRestoreInstanceState(View.java:13954)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3025)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3031)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3031)
at android.view.View.restoreHierarchyState(View.java:13932)
at android.support.v4.app.Fragment.restoreViewState(Fragment.java:466)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:981)
at android.support.v4.app.FragmentManagerImpl.attachFragment(FragmentManagerImpl.java:1314)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:730)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1501)
at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManagerImpl.java:490)
at android.support.v4.app.FragmentPagerAdapter.finishUpdate$52bc874c(FragmentPagerAdapter.java:141)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1105)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:551)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:513)
at android.support.v4.view.ViewPager.setCurrentItem$2563266(ViewPager.java:505)
at me.xiaopan.psts.PagerSlidingTabStrip$TabViewClickListener.onClick(PagerSlidingTabStrip.java:575)
at android.view.View.performClick(View.java:4848)
at android.view.View$PerformClick.run(View.java:20300)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:210)
at android.app.ActivityThread.main(ActivityThread.java:5809)
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:1113)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)
hi, want set background only for progressbar
Circular Progress blink instead of rotate when on battery saver, Android >=5.0
Hey,
Thankx for this library. I just have one request. Could you please add a method to finish the animation for indeterminate progress?
Simply hiding the progress bar suddenly when the background task is complete looks janky and I would love for the animation to complete the full circle before dissapearing. Please add that if its not too much work..
Thankx
Why this lib requires api > 14?
Commit 8ea4a9d resolves the memory leak but introduces a minor issue. When using the CPV in a ListView or RecyclerView where Views are recycled/reused the CPV hangs when it gets visible the second time. The solution is to override onAttachedToWindow()
and call startAnimation()
there.
I think you could even move the block
if(autostartAnimation)
startAnimation();
from init(AttributeSet attrs, int defStyle)
to onAttachedToWindow()
.
Hi, I was using this library and robolectric (3.0-rc3) for unit test. I found that circularProgressView.startAnimation()
will prevent Robolectric from proceeding.
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
CircularProgressView progressView = (CircularProgressView) findViewById(R.id.progress_view);
progressView.startAnimation();
}
}
@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class MainActivityTest {
@Test
public void testMainActivity() {
MainActivity mainActivity = Robolectric.setupActivity(MainActivity.class);
Assert.assertNotNull(mainActivity);
}
}
The program will stuck in setupActivity()
and the assertion will never be reached. And if I comment out progressView.startAnimation();
, then everything works fine. I don't know if its a problem of this library or of Robolectric, but would you take a look at this?
Hi!
Two random crashes showed up in Crashlytics. Not sure in what circumstances and how to reproduce it. Never encountered myself. Just for your information, maybe there is something obviuos.
Devices: Sony ST26I (4.1.2) and LG-E460 (4.1.2)
java.lang.NullPointerException
at android.view.GLES20Canvas.drawArc(GLES20Canvas.java:726)
at com.github.rahatarmanahmed.cpv.CircularProgressView.onDraw(CircularProgressView.java:119)
at android.view.View.draw(View.java:13573)
at android.view.View.getDisplayList(View.java:12524)
at android.view.View.getDisplayList(View.java:12568)
at android.view.View.draw(View.java:13297)
at android.view.ViewGroup.drawChild(ViewGroup.java:3037)
...
Thanks for awesome library.
I have a code build on version 2.0.1 and it works fine
When updated gradle to 2.2.0 nothing is showed in the place of the progress
my code:
<com.github.rahatarmanahmed.cpv.CircularProgressView
android:id="@+id/progressBar"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerVertical="true"
android:layout_gravity="right"
android:layout_marginRight="12dp"
app:cpv_color="#ffffff"
app:cpv_indeterminate="true"
app:cpv_thickness="2dp"/>
I have tried to remove all extra params so it is like in the sample
<com.github.rahatarmanahmed.cpv.CircularProgressView
android:id="@+id/progressBar"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="24dp"
android:layout_height="24dp"
app:cpv_indeterminate="true"/>
Still nothing...
No exceptions in the log...
I also have the following dependencies:
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.android.support:cardview-v7:22.1.1'
compile 'com.android.support:support-v4:22.1.1'
not showing in webview please fix this.
Pixels are of no use, because devices have different density. There's a huge difference between xxxhdpi and mdpi.
How can I add this in my eclipse project ?
I removed appcompat as dependency and every works fine..why you include it?
See #18
Before calling startAnimation()
on a built indeterminate progress view, it doesn't show the view until after calling startAnimation()
, which is convenient in cases you want to conceal the view first while no process is executed. Is it possible to remove view visibility on stopAnimation()
? Where in a single instance of the progress view can handle repeated start and stop animation calls throughout an activity, showing and hiding the view respectively.
Hello, thank you for the great lib. I was wandering how to stop the animation of the circularprogressview. The only way i found is just setting its visibility to GONE. Is there a way to stop the animation? Or if i miss something can you point me the right way? I'm quite new to android. So my worries are if it just hide the animation and doesn't stop it, won't it eat the resources of the device? Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.