-
Notifications
You must be signed in to change notification settings - Fork 636
Home
LoadingDrawable
is a cool animation loading library. The project uses the strategy mode,
LoadingRenderer
responsible for the relevant measurements and draw.
[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
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
.
The following content show a brief overview of LoadingDrawable
- It extends
Drawable
and implement the interfaceAnimatable
- it uses strategy mode
- It can be used as the background of
View
or content ofImageView
- It's constructor must be passed a
LoadingRenderer
- It can be used as the background of
View
or content ofImageView
-
LoadingView
(extendsImageView
) easy to use withLoadingRenderer
. E.g: mLoadingView.setLoadingRenderer(loadingRenderer) -
LoadingRenderer
is used for measuring and drawing theLoadingDrawable
. note:LoadingRenderer
is the core -
LoadingRenderer
only can be created by theirBuilder
.
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