A SquaresLoadingView based on android.View, nicely rotation、easy to use.
Supported functions:
-
Optionally configure the colors of each square
-
Manually stop and start the animation
-
Configurable anim's speed
-
Support the padding settings
Support will be forthcoming:
-
Manual rotation
-
Refresh header view support
-
Etc
To get a Git project into your build:
Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.fairytale110:SquaresLoadingView:1.0.0'
}
<tech.nicesky.libsquaresloadingview.SquaresLoadingView
android:id="@+id/slv_loading"
android:padding="10dp"
app:slv_scale_speed="0.77"
app:slv_squares_alpha="1"
app:slv_background="@android:color/white"
android:layout_width="80dp"
android:layout_height="200dp" />
or
private void loading(){
int[] colorsDefault = {
Color.parseColor("#C5523F"),
Color.parseColor("#F2B736"),
Color.parseColor("#499255"),
Color.parseColor("#F2B736"),
Color.parseColor("#499255"),
Color.parseColor("#1875E5"),
Color.parseColor("#499255"),
Color.parseColor("#1875E5"),
Color.parseColor("#C5523F"),
};
SquaresLoadingView squaresLoadingView = new SquaresLoadingView(this);
squaresLoadingView.setAnimSpeed(0.5F);
squaresLoadingView.setSquareAlpha(0.8F);
squaresLoadingView.setColors(colorsDefault);
squaresLoadingView.start();
//squaresLoadingView.stop();
}
Copyright 2018 fairytale110
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.