Coder Social home page Coder Social logo

insloadinganimation's Introduction

中文文档

InsLoadingAnimation

License Download Android Arsenal

Introduction

InsLoadingAnimation is imitation of instagram and weibo avator animation of loading for Android. More information and code analysis please see blog: http://www.jianshu.com/p/a0e2dbeef88a

Demo

avi

Usage

Step 1

Add dependencies in build.gradle.

dependencies {
  compile 'com.qintong:insLoadingAnimation:1.1.0'
}

Step 2

InsLoadingView is extands ImageView, it can be used like ImageView simply.

<com.qintong.library.InsLoadingView
    android:layout_centerInParent="true"
    android:id="@+id/loading_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@mipmap/pink"/>

Step 3

Set status of InsLoadingView

You can change the status of InsLoadingView manually to match up it's status in your context. The status of InsLoadingView: LOADING: to show this InsLoadingView has been clicked and before it has been loaded, animation of circle is running. UNCLICKED: to show this InsLoadingView neither has been clicked nor loaded, the animation of circle is stopped. CLICKED: to show this InsLoadingView has been clicked and loaded, the animation of circle is stopped and the color of the circle is gray. The default status is LOADING. Set status of InsLoadingView only requires the following code:

xml:

  app:status="loading" //or "clicked",or "clicked"

java:

  mInsLoadingView.setStatus(InsLoadingView.Status.LOADING); //Or InsLoadingView.Status.CLICKED, InsLoadingView.Status.UNCLICKED

Set the color of InsLoadingView

You can set the start color and end color, the circle of InsLoadingView will show the transition of this two colors:

xml:

  app:start_color="#FFF700C2" //or your color
  app:end_color="#FFFFD900" //or your color

java:

  mInsLoadingView.setStartColor(Color.YELLOW); //or your color
  mInsLoadingView.setEndColor(Color.BLUE); //or your color

The default start color and end color is #FFF700C2 and #FFFFD900.

Set the speed of InsLoadingView.

You can change the speed of animation by set the circle animation duration or whole animation rotating duration(MS):

xml:

  app:circle_duration="2000"
  app:rotate_duration="10000"

java:

  mInsLoadingView.setCircleDuration(2000);
  mInsLoadingView.setRotateDuration(10000);

The default circle duration and rotate duration is 2000ms and 10000ms.

Contact me

Email

My Blog

License

Copyright 2017 Qin Tong

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.

insloadinganimation's People

Contributors

dfshizhiqiang avatar qintong91 avatar

Watchers

 avatar

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.