Code Monkey home page Code Monkey logo

animatedcircleloadingview's Introduction

Animated Circle Loading View

Download Android Arsenal

A determiante/indetermiante loading view animation. Based on android-watch-loading-animation by Nils Banner.

How it looks

gif

gif

Usage

Add AnimatedCircleLoadingView to your layout and define mainColor and secondaryColor as custom attributes:

<com.github.jlmd.animatedcircleloadingview.AnimatedCircleLoadingView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/circle_loading_view"
    android:layout_width="250dp"
    android:layout_height="250dp"
    android:background="@color/background"
    android:layout_centerInParent="true"
    app:animCircleLoadingView_mainColor="@color/main_color"
    app:animCircleLoadingView_secondaryColor="@color/secondary_color"
    app:animCircleLoadingView_textColor="@android:color/white"
    />
Determinate

Start determinate:

animatedCircleLoadingView.startDeterminate();

Modify percent:

animatedCircleLoadingView.setPercent(10);

If percent is 100, the animation ends with success animation. On error you must call stopFailure() method, then the application ends with failure animation.

Indeterminate

Start indeterminate:

animatedCircleLoadingView.startIndeterminate();

Stop with success:

animatedCircleLoadingView.stopOk();

Stop with failure:

animatedCircleLoadingView.stopFailure();

Reset loading:

animatedCircleLoadingView.resetLoading();

Gradle dependency

Add repository to your build.gradle

repositories {
  maven {
    url "http://dl.bintray.com/jlmd/maven"
  }
}

Add dependency to your build.gradle

compile 'com.github.jlmd:AnimatedCircleLoadingView:1.1.5@aar'

Developed by

José Luis Martín - [email protected]

License

Copyright 2015 José Luis Martín

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

animatedcircleloadingview's People

Contributors

fcouceiro avatar jlmd avatar tepehan 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

animatedcircleloadingview's Issues

Please remove android:label attribute from AndroidManifest

Thanks for you awesome work.

Can you remove the attribute android:label from your AndroidManifest, in fact you don't need one. When you specify this attribute it's hard to apps change their android:label in build time, as you can note in the error above:

Error:Execution failed for task ':app:processProdDebugManifest'.

Manifest merger failed : Attribute application@label value=(YVD) from AndroidManifest.xml:21:9-44
is also present at [com.github.jlmd:AnimatedCircleLoadingView:1.1.5] AndroidManifest.xml:13:9-41 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:18:5-143:19 to override.

app:animCircleLoadingView_textColor doesn't work

Hi, first of all thank you for this fantastic view!
I'm trying to use this in my app, but when I change the attribute app:animCircleLoadingView_textColor to another color (white is by default) nothing happens. When I run the app, the text color always is white.
My code:

<com.github.jlmd.animatedcircleloadingview.AnimatedCircleLoadingView 
        xmlns:app="http://schemas.android.com/apk/lib-auto"
        android:id="@+id/circle_loading_view"
        android:layout_width="250dp"
        android:layout_height="250dp"
        android:layout_below="@+id/workingTexto"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="74dp"
        android:background="@color/colorPrimary"
        app:animCircleLoadingView_mainColor="@color/colorPrimary"
        app:animCircleLoadingView_secondaryColor="@color/colorPrimaryDark"
        app:animCircleLoadingView_textColor="@android:color/black" />

Can you help me?
Thanks!

Error on startDeterminate

Hi,

Error on startDeterminate. why??

java.lang.NullPointerException: Attempt to invoke virtual method 'void ...AnimatedCircleLoadingView.AnimatedCircleLoadingView.startDeterminate()' on a null object reference

"Tap view"

Why are you implemented circle that represent interaction of user with watch?
I think it's totally redundant.
Anyway - nice work. But removing this circle will be absolutely right choice.

Parent layout visibility issue

If parent layout of this loading view is invisible (Visibility set to GONE) on initial state - then after changing it to visible - animation is not working. It works if visibility is set to INVISIBLE but then it takes up space.

Also - could you please provide a possibility to change the animation speed - 1000ms is too slow for my taste - I suggest to provide a method - setAnimationSpeed(int speed) and set it as a constant that is used trough out the library. Setting hardcoded animation duration (setDuration(1000)) is bad practice.

CircleLoadingView not being displayed

Hello,

I can't seem to get the lib to work at all. Nothing is being displayed either in Android Studio preview, and on my phone (OnePlus 3, Android 7.1).
I'm using 1.1.5 version.
Sdk min is 21, compile sdk is 25.

I call startIndeterminate in onCreate();

Here's my xml :

<ProgressBar
    android:id="@+id/progress_bar"
    android:layout_gravity="center"
    android:visibility="gone"
    android:indeterminate="true"
    android:layout_width="200dp"
    android:layout_height="200dp" />

<com.github.jlmd.animatedcircleloadingview.AnimatedCircleLoadingView
    android:id="@+id/circle_loading_view"
    android:layout_width="250dp"
    android:layout_height="250dp"
    android:layout_gravity="center"
    app:mainColor="@color/white"
    app:secondaryColor="@color/colorPrimaryDark"
    app:textColor="@color/colorAccent"
    />

<TextView
    android:text="Loading"
    android:textSize="35sp"
    android:fontFamily="sans-serif-light"
    android:layout_gravity="center"
    android:textColor="@color/white"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

Thanks.

Colors not found; can not compile

I have added the layout like in your example:

<com.github.jlmd.animatedcircleloadingview.AnimatedCircleLoadingView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/circle_loading_view"
    android:layout_width="250dp"
    android:layout_height="250dp"
    android:background="@color/background"
    android:layout_centerInParent="true"
    app:animCircleLoadingView_mainColor="@color/main_color"
    app:animCircleLoadingView_secondaryColor="@color/secondary_color"
    app:animCircleLoadingView_textColor="@android:color/white"
    />

Additionaly I added the colors to my color.xml file:

<resources>
  <color name="background">#65828e</color>
  <color name="main_color">#ff9a00</color>
  <color name="secondary_color">#BDBDBD</color>
</resources>

Error: It can't find mainColor, secondaryColor and textColor.

Percent text color

Hi,

Is it possible to add a setter to PercentIndicatorView to get the TextView and set some colors/attrs?
public void setTextColor(int color) { setTextColor(color); }
...

And ofc a setter in AnimatedCircleLoadingView ?

Or just a getter on percentIndicatorView ?

Thx,
Bastien.

StartIndeterminate not working

Hello ! I have problems with StartIndeterminate method. When i call this the animation not started.
Can you help me please ?

Thanks, regards.

Version Issue

Hi José Luis Martín.

great work you have done.but In my case your Animation is not working just like a rounded image is blur and sometimes it will not display,in Android Lolipop 5.1 but in below all version it will work perfectly,so please help me to sort out this issue, i assume as a this is not a big deal to sort out this.

Thanks.

ResetLoading not working

I call resetloading and animator not working.
If i re- StartDetermine, it get error, app auto restart so i dont know what errors are!

Fragment replace problem

If the AnimatedCircleLoadingView is in another fragment and is used .replace() to show that fragment, the animation does not start.

gradle

gradle not work

Error:(51, 13) Failed to resolve: com.github.jlmd:AnimatedCircleLoadingView:1.1.2

Is this library working?

I tried the steps mentioned and the loader is not visible. I tried putting the methods inside onResume and onWindowAttached as well. No loader seems to be visible. What can i be missing?

Animation circles are not visible in android versions 6 and higher

Everything works fine in android versions 4 and 5 but the circle indicators is not visible in android version 6 and more. I think the animation is starting and everything goes as expected but the view for two circles is completely not visible in android versions 6.0. I have tried changing colour also.

Showing 8900% on finish

I have 2 issues

  1. I am trying to use this loader multiple times in same class, the first time I have used startDeterminate() and in other functions used startIndeterminate(). I don't know whether it is the right way or not. My I have 3 HTTP calls and I want to show each progress but in the same class. By doing this it is working but not as expected, the percentage text blinks after 1st call.

  2. When progress is 100% and then it shows tick animation but after 1-2 seconds it shows 8900% text written under the tick.

Please help, how to deal with it...

Regards

onAnimationEnd never Triggered

I'm trying to implement the animation, and make it dissapere when it ends but it is never called.

downloadView.setAnimationListener(new AnimatedCircleLoadingView.AnimationListener() {
                                @Override
                                public void onAnimationEnd(boolean success) {
                                    downloadView.setVisibility(View.GONE);  
         }
    });

onAnimationEnd never called

Why this animation listener never called?

 circleLoadingView.setAnimationListener(new AnimatedCircleLoadingView.AnimationListener() {
        @Override
        public void onAnimationEnd(boolean success) {
            if (success) {
                circleLoadingView.setVisibility(View.GONE);
                txtChallenge.animateText(challenge);
            }
        }
    });

AnimatedCircleLoadingView, the Odyssey.

Hi, as happened many times before, I had this problem, I followed all the steps, I even force gradle to update the dependencies, this is my project build.gradle:

buildscript { repositories { maven {url "http://dl.bintray.com/jlmd/maven"} google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { maven {url "http://dl.bintray.com/jlmd/maven"} google() jcenter() } }

this is my module build.gradle:

apply plugin: 'com.android.application' android { compileSdkVersion 26 defaultConfig { applicationId "com.company.holmes.myteste" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } android { useLibrary 'org.apache.http.legacy' } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:cardview-v7:26.1.0' implementation 'com.android.support:gridlayout-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' compile 'com.github.jlmd:AnimatedCircleLoadingView:1.1.5@aar' }

And this is my error:

`Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute application@label value=(Agenda de Serviço) from AndroidManifest.xml:8:9-42
is also present at [com.github.jlmd:AnimatedCircleLoadingView:1.1.5] AndroidManifest.xml:13:9-41 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:5:5-25:19 to override.`

Could you help me? I've already delete the .gradle file on C:/Users/(My User)/ and recompiled the dependencies. I don't anymore what to do.

removeView() error during second run!

I have a button and these two methods inside its button click:
startLoading();
startPercentMockThread();
this runs the circleLoadingView for the first time but I have this error during second run:
"The specified child already has a parent. You must call removeView() on the child's parent first."
can you help me on how to handle this? this crashes my app!

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.