castorflex / smoothprogressbar Goto Github PK
View Code? Open in Web Editor NEWA small Android library allowing you to have a smooth and customizable horizontal or circular indeterminate ProgressBar
License: Apache License 2.0
A small Android library allowing you to have a smooth and customizable horizontal or circular indeterminate ProgressBar
License: Apache License 2.0
Hello! First of all, thanks for nice library :)
Ok, now about issue.
_Before fix_
P.S. Taken from demo app from Play Store.
On Nexus 4 runing android 4.2.2 I've reproduced bug of circular progress bar lagging. When I've debuged issue I found that animation toggles between 2 sweep angles one is 20 another 300. On ui it makes effect of progress bar rotating with high speed. Here is the line code which point to the problem I see. During runtime animatedFraction
always has 1.0
value which messes animation at all.
Temporary fix.
Add dependency on NineOld and replaced imports within CircularProgressDrawable
dependencies {
compile 'com.nineoldandroids:library:2.4.0'
}
This made ValueAnimator to return proper animatedFraciton value.
Can you take a look on issue? I would like to use pure dependency instead of bundling sources of lib in my project, also using Nine old
is not what I need, because I'm not targeting old platform.
Looking forward your response.
Best regards, Tom Koptel.
Is it possible to use SmoothProgressBar
in place of ActionBar
's default horizontal progressbar?
Hi, I've received
android/build/intermediates/exploded-aar/com.github.castorflex.smoothprogressbar/library/1.0.0/AndroidManifest.xml:3] Main manifest has but library uses targetSdkVersion='20'
Could someone please update the targetSdkVersion to 20 so the Android Studio can build the project successfully? Thank you very much.
When I call progressiveStart() on progress bar it works fine, but when I call progressiveStop(), the calback method onStop() is being called infinite times. Am I missing something here?
SmoothProgressBar:
<fr.castorflex.android.smoothprogressbar.SmoothProgressBar
android:id="@+id/pb_google_plus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
style="@style/GPlusProgressBar"
android:visibility="gone"/>
style GPlusProgressBar:
<style name="GPlusProgressBar" parent="SmoothProgressBar">
<item name="spb_stroke_separator_length">12dp</item>
<item name="spb_sections_count">4</item>
<item name="spb_speed">1.7</item>
<item name="spb_interpolator">spb_interpolator_linear</item>
<item name="spb_colors">@array/gplus_colors</item>
</style>
set callbacks:
mProgressBar.setSmoothProgressDrawableCallbacks(new SmoothProgressDrawable.Callbacks() {
@Override
public void onStop() {
mProgressBar.setVisibility(View.GONE);
}
@Override
public void onStart() {
mProgressBar.setVisibility(View.VISIBLE);
}
});
There is someting wrong with
<item name="spb_default_speed" format="float" type="string">1.0</item>
I get error logs
02-07 21:27:22.925 28530-28530/com.docd.purefm W/Resources﹕ Converting to string: TypedValue{t=0x4/d=0x3f800000 a=2 r=0x7f0d0077}
Which points to this resource (is was 0x7f0d0077)
✊ Stop being lazy ✊
When adding the widget mentioned in the tutorial, the following error come out at Android Studio:
Rendering Problems The following classes could not be instantiated:
- fr.castorflex.android.smoothprogressbar.SmoothProgressBar (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.ClassNotFoundException: fr.castorflex.android.smoothprogressbar.R$attr
at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:142)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at fr.castorflex.android.smoothprogressbar.SmoothProgressBar.<init>(SmoothProgressBar.java:31)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
It should be quite easy to fix 😄
I am using this library in a project with a target sdk 17. Since that the target sdk in the library is 19 gradle build gives error. I searched it and found a suggestion in this page. (http://stackoverflow.com/a/17757200/937715)
Can you please add this to manifest or show me any other solution than that if you have one? Thanks.
This is the error message:
... Main manifest has but library uses targetSdkVersion='19'
Is it possible to use this within a widget, specifically a remoteView? can that be added
Dear :
i don't know Why I Can run ThE project
Got it my build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
...
}
dependencies {
compile 'com.android.support:support-v13:+'
compile 'com.google.android.gms:play-services:3.2.+'
compile 'com.github.castorflex.smoothprogressbar:library:0.3.X'
}
But I got this error :
Could not find com.github.castorflex.smoothprogressbar:library:0.3.X.
Same thing when trying to search castorflex from MavenCentral, nothing. Any suggestions ?
Any chance that the library will be updated to support Material-style Indeterminate horizontal progress bar, The way that they appear on the play store?
Hi folks,
I am trying to use SPB on my Android project on Android Studio so I added the following to the dependencies
section of my build.gradle
:
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.1'
Then I went ahead and placed the following in my layout file:
<fr.castorflex.android.smoothprogressbar.SmoothProgressBar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
app:spb_sections_count="5"
app:spb_color="#2ecc71"
app:spb_speed="1.0"
app:spb_stroke_width="5dp"
app:spb_stroke_separator_length="10dp"
app:spb_reversed="false"
app:spb_mirror_mode="false" />
In the onCreate
method of my respective activity I called the progress bar:
progressBar = (ProgressBar) findViewById(R.id.progress_bar);
progressBar.setVisibility(View.VISIBLE);
// some code omitted for brevity
But when I try to compile my project, here is the error I get:
/Users/rodrigoalves/AndroidStudioProjects/Instagenio/app/src/main/res/layout/activity_start_game.xml
Error:(45) No resource identifier found for attribute 'spb_sections_count' in package 'me.sgtpeppers.instagenio'
Error:(45) No resource identifier found for attribute 'spb_color' in package 'me.sgtpeppers.instagenio'
Error:(45) No resource identifier found for attribute 'spb_speed' in package 'me.sgtpeppers.instagenio'
Error:(45) No resource identifier found for attribute 'spb_stroke_width' in package 'me.sgtpeppers.instagenio'
Error:(45) No resource identifier found for attribute 'spb_stroke_separator_length' in package 'me.sgtpeppers.instagenio'
Error:(45) No resource identifier found for attribute 'spb_reversed' in package 'me.sgtpeppers.instagenio'
Error:(45) No resource identifier found for attribute 'spb_mirror_mode' in package 'me.sgtpeppers.instagenio'
Why is it happening? I followed the guide correctly, I suppose.
I appreciate any help!
I am switching the progress bar between GONE and VISIBLE and each time it reappears it seems to have more and more sections and possibly the speed is increasing. Is this a "feature"? :)
P.S. The library was easy to integrate and override the default settings. Well done!
Any plans to include ProgressDialog with CircularProgressBar?
Because 37% devices used 2.3.
Can you decrease targetSdkVersion to 9?
I found there are some exception about MalformedURLException when run the get example.
The url is "https://httpbin.org/get".
Why I can't run it
I'm trying to include this cool library using Maven:
<dependency>
<groupId>com.github.castorflex.smoothprogressbar</groupId>
<artifactId>library</artifactId>
<version>0.2.0</version>
</dependency>
But it can't find the files. When checking on Maven central, I see there is no precompiled jar file, only ..-sources and .aar. I'm a Maven noob, so might not even be an "error", but every hint on how to get good old Maven working is appreaciated :)
ActionBar-PullToRefresh is deprecated (https://github.com/chrisbanes/ActionBar-PullToRefresh) but I have a problem with the progress bar color.
The custom color doesn't work since v0.9.9 (default blue). It was ok with v0.9.3.
ActionBar-PullToRefresh changes the color with this code:
https://github.com/chrisbanes/ActionBar-PullToRefresh/blob/master/library/src/main/java/uk/co/senab/actionbarpulltorefresh/library/DefaultHeaderTransformer.java#L375-L384
The dependency for SmoothProgressBar has changed between v0.9.9 and v0.9.3:
chrisbanes/ActionBar-PullToRefresh@8312bcd
Can you help me?
For some values of the params, the circular progress bar blinks a full circle when the circumference is almost complete and just going to draw a new color.
Hi castorflex,
I wan to ask is it possible to use as library of Chrisnaces/ActionBar-PullToRefresh on Eclipse? I try to mark this as library in Eclipse but ActionBar-PullToRefresh still not able to recognize it.
Hi,
This is my xml of my loading screen:
<fr.castorflex.android.circularprogressbar.CircularProgressBar
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:indeterminate="true"
app:cpb_color="@color/blue" />
When the load happens fast (+- 1 second) the CircularProgressBar doesn't appear.
When I delay the load operation the CircularProgressBar is shown.
How can I fix this ?
Heya,
My compliments for this awesome library! I love the way I can customize the progress bar on so many levels.
I am running into an issue with my progress bar starting, when my activity resumes (after dismissing another activity and coming back to the progress bar activity).
I tried to handle it with the setSmoothProgressDrawableCallbacks
, and handling hiding & showing in the onStop()
and onStart()
methods, but this doesn't give the expected result.
I am initializing my progress bar in my activity's onCreate()
:
mProgressBar = (SmoothProgressBar) findViewById(R.id.route_detail_progressbar);
mProgressBar.setVisibility(View.VISIBLE);
mProgressBar.setSmoothProgressDrawableCallbacks(new ProgressBarListener());
mProgressBar.progressiveStart();
And having customized the progress bar in XML:
<fr.castorflex.android.smoothprogressbar.SmoothProgressBar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/route_detail_progressbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:layout_marginTop="-3dp"
android:visibility="gone"
app:spb_sections_count="2"
app:spb_color="@color/Primary"
app:spb_speed="0.7"
app:spb_stroke_width="7dp"
app:spb_stroke_separator_length="16dp"
app:spb_reversed="false"
app:spb_mirror_mode="false"
app:spb_progressiveStart_activated="true"
app:spb_progressiveStart_speed="1.5"
app:spb_progressiveStop_speed="3.4"
/>
Without adding the ProgressBarListener
, everything works as expected, except that when the activity comes in view, it starts again.
My ProgressBarListener
:
private class ProgressBarListener implements SmoothProgressDrawable.Callbacks
{
@Override
public void onStop() {
mProgressBar.setVisibility(View.GONE);
}
@Override
public void onStart() {
mProgressBar.setVisibility(View.VISIBLE);
}
}
With the listener, I don't see the progress bar at all.
Do you have any idea what I am doing wrong? I've put breakpoints in the listener, and it seems that onStop()
is called first, then onStart()
is called twice strangely enough.
Thanks in advance!
Integration with Chris Banes Pull to refresh?
https://github.com/chrisbanes/ActionBar-PullToRefresh
That would be awesome. Isn't it? With appcompat Obviously....
I use NineOldDroids to make my SmoothProgressBar
fades in/out, by manipulating the alpha property. It works well on recent android devices (sdk>14), but on low sdks (I tested with sdk 7 and 8), the drawable doesn't animate any more.
Do you have an idea why ?
circularprogressbar snippet has
app:cpb_color="4"
its supposed to be
app:cpb_color="@color/cpb_default_color"
If I'm correct you cannot use drawables but solely colors, right?
I'll further check to pimp the code how easy can this be.
SPB works great, and you can setup your own styles for different resource qualifiers, but it'd be great if you could set some of the options to scale automatically based on width. For example, a section count of "4" with a separator length of "4dp" works great for a phone portrait layout, but on a landscape Nexus 10 it looks silly.
I can setup my own custom options for varying widths, but it'd be great if it could take the bounds and automatically scale the value based on that.
progressBar.setIndeterminate(false);
progressBar.setProgress(30);
it not working, sorry my bad english
Hi,
Thanks for this excellent library.
Can I use this library as normal progress bar which steadily increases it's progress instead of indeterminate progress bar ?
Thanks in advance.
Hey, could you point me to the commit that is version 0.2.0 of SmoothProgressBar? I’m trying to import chrisbanes / ActionBar-PullToRefresh and it depends on that version. The latest version has a changed API.
Hi! Is it possible to use SmoothProgressBar when "indeterminate" is set to "false"?
Nothing shows when I use the xml above:
<fr.castorflex.android.smoothprogressbar.SmoothProgressBar
android:layout_width="match_parent"
android:layout_height="2dp"
android:indeterminate="false"
android:progress="25"
android:max="100"
app:spb_sections_count="4"
app:spb_color="#FF0000"
app:spb_speed="1.0"
app:spb_stroke_width="2dp"
app:spb_stroke_separator_length="4dp"
app:spb_reversed="false"
app:spb_mirror_mode="false"/>
CircularProgressBar code snippet from readme recommends
app:spb_speed="1.0"
where as styles recommends
<item name="cpb_speed">@string/cpb_default_speed</item>
but none of the above works.
Error:(34) No resource identifier found for attribute 'cpb_speed' in package 'com.mufri.authenticatorplus.debug'
Error:(34) No resource identifier found for attribute 'spb_speed' in package 'com.mufri.authenticatorplus.debug'
PS: I just include
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.0'
when start to load and start the animation,there have a default color bar in the behind,
then there has way to set the default color to transparent?
I'm trying to use your library but I have include API 10 for my app. Isn't it possible to lower the API level?
public static final Interpolator END_INTERPOLATOR = new LinearInterpolator();
private static final Interpolator DEFAULT_ROTATION_INTERPOLATOR = new LinearInterpolator();
private static final Interpolator DEFAULT_SWEEP_INTERPOLATOR = new DecelerateInterpolator(); and so many errors in CircularProgressDRAWABLE i have set api level to 14 and have checked for 16 but still not working
Have you ever tried to pull the google now cards? It starts from the center and have more than one color... I don't think this approach can lead to the same drawable, am I Right?
If there is a way, please do put it into the readme.
the arrtibute spb_default_sections_count that was supposed to be read isn't there
This is what I get from Android Studio Preview
java.lang.AssertionError at android.content.res.BridgeResources.getInteger(BridgeResources.java:425) at
fr.castorflex.android.smoothprogressbar.SmoothProgressDrawable$Builder.initValues(SmoothProgressDrawable.java:651) at
fr.castorflex.android.smoothprogressbar.SmoothProgressDrawable$Builder.<init>(SmoothProgressDrawable.java:623) at
fr.castorflex.android.smoothprogressbar.SmoothProgressBar.<init>(SmoothProgressBar.java:38) at
fr.castorflex.android.smoothprogressbar.SmoothProgressBar.<init>(SmoothProgressBar.java:31) at
fr.castorflex.android.smoothprogressbar.SmoothProgressBar.<init>(SmoothProgressBar.java:27)
Also, your CI server is reporting error too
There doesn't seem to be a way to properly set the colour of the SmoothProgressDrawable.
The colour attribute in the XML is ignored when doing this:
ProgressBar progressBar = (ProgressBar) findViewById(R.id.smooth_progress);
progressBar.setIndeterminateDrawable((new SmoothProgressDrawable.Builder(this).interpolator(new AccelerateDecelerateInterpolator()).build()));
The defaullt colour is blue, setting the colour on the AccelerateDecelerateInterpolator to red makes the progress bar purple?!
ProgressBar progressBar = (ProgressBar) findViewById(R.id.smooth_progress);
progressBar.setIndeterminateDrawable((new SmoothProgressDrawable.Builder(this).interpolator(new AccelerateDecelerateInterpolator()).color(R.color.my_red).build()));
Same effect when setting colour on the SmoothProgressDrawable.
When using chrisbane's ActionBar-PullToRefresh
I get a lot of these warnings:
W/Resources﹕ Converting to string: TypedValue{t=0x4/d=0x3f800000 a=2 r=0x7f0c0021}
Pretty sure it's this line in the defaults.xml file:
<item name="spb_default_speed" format="float" type="string">1.0</item>
Update: I see the issues now with storing floats in the resource files :(
If possible It would be great to see some options to customize the space between the stroke separator.
For example I'm looking customize the progress bar as shown in this image: http://prntscr.com/38vehl
I've tried drawables but the style will only allow for colors is there any way of assigning a gradient to the background?
Hi, will CircularProgressBar support API 10+?
Thanks.
Hi,
I was wondering if it's possible to declare the interpolator in the xml instead of programmatically.
I tried android:interpolator="@android:anim/decelerate_interpolator"
without any success so I guess the library does not support it.
Thanks
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.