Skip to content
dinus_developer edited this page Aug 14, 2016 · 18 revisions

LoadingDrawable is a cool animation loading library. The project uses the strategy mode, LoadingRenderer responsible for the relevant measurements and draw.

Support Builder (now)

[SwapLoadingRenderer] (https://github.com/dinuscxj/LoadingDrawable/wiki/SwapLoadingRenderer) [CollisionLoadingRenderer] (https://github.com/dinuscxj/LoadingDrawable/wiki/CollisionLoadingRenderer) [WhorlLoadingRenderer] (https://github.com/dinuscxj/LoadingDrawable/wiki/WhorlLoadingRenderer) [MaterialLoadingRenderer] (https://github.com/dinuscxj/LoadingDrawable/wiki/MaterialLoadingRenderer) [GearLoadingRenderer] (https://github.com/dinuscxj/LoadingDrawable/wiki/GearLoadingRenderer) [LevelLoadingRenderer] (https://github.com/dinuscxj/LoadingDrawable/wiki/LevelLoadingRenderer)

LoadingDrawable is Lightweight and Efficiency

LoadingDrawable tries to be very lightweight and Efficiency. Unlike a View, LoadingDrawable does not have any facility to receive events or otherwise interact with the user. Besides, LoadingDrawable without aggressive API, there is no dependence on the container, easy to configure, easy to universal, high rendering efficiency. And I will try to optimize the memory consumption of LoadingDrawable.

LoadingDrawable Libraries

The following content show a brief overview of LoadingDrawable

  • It extends Drawable and implement the interface Animatable
  • it uses strategy mode
  • It can be used as the background of View or content of ImageView
  • It's constructor must be passed a LoadingRenderer
  • It can be used as the background of View or content of ImageView
  • LoadingView(extends ImageView) easy to use with LoadingRenderer. E.g: mLoadingView.setLoadingRenderer(loadingRenderer)
  • LoadingRenderer is used for measuring and drawing the LoadingDrawable. note: LoadingRenderer is the core
  • LoadingRenderer only can be created by their Builder.

How to use

Define the LoadingView in XML and specify the LoadingRenderer style:

<app.dinus.com.loadingdrawable.LoadingView
   android:id="@+id/level_view"
   android:layout_width="0dp"
   android:layout_height="match_parent"
   android:layout_weight="1"
   android:background="#fff1c02e"
   app:loading_renderer="LevelLoadingRenderer"/>

Or specify the LoadingRenderer style in Java

***LoadingRenderer.Builder builder = new ***LoadingRenderer.Builder(context);
LoadingView.setLoadingRenderer(builder.build());

Besides LoadingDrawable can be used as the background of View and the image drawable of ImageView

***LoadingRenderer.Builder builder = new ***LoadingRenderer.Builder(context);
LoadingDrawable drawable = new LoadingDrawable(builder.build());
View.setBackgroundDrawable(drawable); 
//you need start animation
drawable.start()
//you also need stop animation
drawable.stop()
***LoadingRenderer.Builder builder = new ***LoadingRenderer.Builder(context);
LoadingDrawable drawable = new LoadingDrawable(builder.build());
ImageView.setImageDrawable(drawable); 
//you need start animation
drawable.start()
//you also need stop animation
drawable.stop()

If the LoadingView can't meet your requirements, you might need to refer to the LoadingView customize the View you need