Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf41f59

Browse files
author
dinuscxj
committed
add the animal series 1
1 parent 21f5062 commit cf41f59

File tree

14 files changed

+623
-22
lines changed

14 files changed

+623
-22
lines changed

Preview/AnimalDrawable.gif

1.58 MB
Loading

README-ZH.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@
55
一些酷炫的加载动画, 可以与任何View配合使用,作为加载动画或者Progressbar, 此外很适合与[RecyclerRefreshLayout](https://github.com/dinuscxj/RecyclerRefreshLayout)
66
配合使用作为刷新的loading 动画
77

8+
![](https://raw.githubusercontent.com/dinuscxj/LoadingDrawable/master/Preview/AnimalDrawable.gif?width=300)
89
![](https://raw.githubusercontent.com/dinuscxj/LoadingDrawable/master/Preview/SceneryDrawable.gif?width=300)
910
![](https://raw.githubusercontent.com/dinuscxj/LoadingDrawable/master/Preview/CircleJumpDrawable.gif?width=300)
1011
![](https://raw.githubusercontent.com/dinuscxj/LoadingDrawable/master/Preview/CircleRotateDrawable.gif?width=300)
1112

1213
## 功能
14+
#### 动物系列
15+
* FishLoadingRenderer
16+
* GhostsEyeLoadingRenderer
17+
18+
#### 风景系列
19+
* DayNightLoadingRenderer
20+
* ElectricFanLoadingRenderer
21+
1322
#### 圆形滚动系列
1423
* GearLoadingRenderer
1524
* WhorlLoadingRenderer
@@ -22,11 +31,6 @@
2231
* DanceLoadingRenderer
2332
* CollisionLoadingRenderer
2433

25-
#### 风景系列
26-
* DayNightRenderer
27-
* ElectricFanLoadingRenderer
28-
29-
3034
## 待办事项
3135
当我感觉bug比较少的时候,我会添加一个gradle依赖。 所以在推上去之前希望大家多提提建议和bug.
3236

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@
77
some android loading drawable, can be combined with any View as the loading View and Progressbar,
88
and is especially suitable for the loading animation of the [RecyclerRefreshLayout](https://github.com/dinuscxj/RecyclerRefreshLayout).
99

10+
![](https://raw.githubusercontent.com/dinuscxj/LoadingDrawable/master/Preview/AnimalDrawable.gif?width=300)
1011
![](https://raw.githubusercontent.com/dinuscxj/LoadingDrawable/master/Preview/SceneryDrawable.gif?width=300)
1112
![](https://raw.githubusercontent.com/dinuscxj/LoadingDrawable/master/Preview/CircleJumpDrawable.gif?width=300)
1213
![](https://raw.githubusercontent.com/dinuscxj/LoadingDrawable/master/Preview/CircleRotateDrawable.gif?width=300)
1314

1415
## Features
16+
#### Animal
17+
* FishLoadingRenderer
18+
* GhostsLoadingEyeRenderer
19+
20+
#### Scenery
21+
* DayNightLoadingRenderer
22+
* ElectricFanLoadingRenderer
23+
1524
#### Circle Rotate
1625
* GearLoadingRenderer
1726
* WhorlLoadingRenderer
@@ -24,10 +33,6 @@
2433
* DanceLoadingRenderer
2534
* CollisionLoadingRenderer
2635

27-
#### Scenery
28-
* DayNightRenderer
29-
* ElectricFanLoadingRenderer
30-
3136
## TODO
3237
When I feel less bugs enough, I will add a gradle dependency. So I hope you will make more Suggestions or Issues.
3338

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525

2626
<activity android:name=".SceneryActivity"
2727
android:label="@string/label_scenery"/>
28+
29+
<activity android:name=".AnimalActivity"
30+
android:hardwareAccelerated="false"
31+
android:label="@string/label_animal"/>
2832
</application>
2933

3034
</manifest>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package app.dinus.com.example;
2+
3+
import android.content.Context;
4+
import android.content.Intent;
5+
import android.os.Bundle;
6+
import android.support.v7.app.AppCompatActivity;
7+
import android.widget.ImageView;
8+
9+
import app.dinus.com.loadingdrawable.LoadingDrawable;
10+
import app.dinus.com.loadingdrawable.render.animal.FishLoadingRenderer;
11+
import app.dinus.com.loadingdrawable.render.animal.GhostsEyeLoadingRenderer;
12+
13+
public class AnimalActivity extends AppCompatActivity {
14+
private LoadingDrawable mFishDrawable;
15+
private LoadingDrawable mGhostsEyeDrawable;
16+
17+
private ImageView mIvFish;
18+
private ImageView mIvGhostsEye;
19+
20+
public static void startActivity(Context context) {
21+
Intent intent = new Intent(context, AnimalActivity.class);
22+
context.startActivity(intent);
23+
}
24+
25+
@Override
26+
protected void onCreate(Bundle savedInstanceState) {
27+
super.onCreate(savedInstanceState);
28+
setContentView(R.layout.activity_animal);
29+
30+
mIvFish = (ImageView) findViewById(R.id.fish_view);
31+
mIvGhostsEye = (ImageView) findViewById(R.id.ghosts_eye_view);
32+
33+
mFishDrawable = new LoadingDrawable(new FishLoadingRenderer(this));
34+
mGhostsEyeDrawable = new LoadingDrawable(new GhostsEyeLoadingRenderer(this));
35+
36+
mIvFish.setImageDrawable(mFishDrawable);
37+
mIvGhostsEye.setImageDrawable(mGhostsEyeDrawable);
38+
}
39+
40+
@Override
41+
protected void onStart() {
42+
super.onStart();
43+
mFishDrawable.start();
44+
mGhostsEyeDrawable.start();
45+
}
46+
47+
@Override
48+
protected void onStop() {
49+
mFishDrawable.stop();
50+
mGhostsEyeDrawable.stop();
51+
super.onStop();
52+
}
53+
}

app/src/main/java/app/dinus/com/example/MainActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
10+
private Button mBtnAnimal;
1011
private Button mBtnScenery;
1112
private Button mBtnCircleJump;
1213
private Button mBtnCircleRotate;
@@ -16,10 +17,12 @@ protected void onCreate(Bundle savedInstanceState) {
1617
super.onCreate(savedInstanceState);
1718
setContentView(R.layout.activity_main);
1819

20+
mBtnAnimal = (Button) findViewById(R.id.animal);
1921
mBtnScenery = (Button) findViewById(R.id.scenery);
2022
mBtnCircleJump = (Button) findViewById(R.id.circle_jump);
2123
mBtnCircleRotate = (Button) findViewById(R.id.circle_rotate);
2224

25+
mBtnAnimal.setOnClickListener(this);
2326
mBtnScenery.setOnClickListener(this);
2427
mBtnCircleJump.setOnClickListener(this);
2528
mBtnCircleRotate.setOnClickListener(this);
@@ -28,6 +31,9 @@ protected void onCreate(Bundle savedInstanceState) {
2831
@Override
2932
public void onClick(View v) {
3033
switch (v.getId()){
34+
case R.id.animal:
35+
AnimalActivity.startActivity(this);
36+
break;
3137
case R.id.scenery:
3238
SceneryActivity.startActivity(this);
3339
break;

app/src/main/java/app/dinus/com/example/SceneryActivity.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
import android.widget.ImageView;
88

99
import app.dinus.com.loadingdrawable.LoadingDrawable;
10-
import app.dinus.com.loadingdrawable.render.circle.rotate.GearLoadingRenderer;
11-
import app.dinus.com.loadingdrawable.render.circle.rotate.LevelLoadingRenderer;
12-
import app.dinus.com.loadingdrawable.render.circle.rotate.MaterialLoadingRenderer;
13-
import app.dinus.com.loadingdrawable.render.circle.rotate.WhorlLoadingRenderer;
14-
import app.dinus.com.loadingdrawable.render.scenery.DayNightRenderer;
10+
import app.dinus.com.loadingdrawable.render.scenery.DayNightLoadingRenderer;
1511
import app.dinus.com.loadingdrawable.render.scenery.ElectricFanLoadingRenderer;
1612

1713
public class SceneryActivity extends AppCompatActivity {
@@ -34,7 +30,7 @@ protected void onCreate(Bundle savedInstanceState) {
3430
mIvDayNight = (ImageView) findViewById(R.id.day_night_view);
3531
mIvElectricFan = (ImageView) findViewById(R.id.electric_fan_view);
3632

37-
mDayNightDrawable = new LoadingDrawable(new DayNightRenderer(this));
33+
mDayNightDrawable = new LoadingDrawable(new DayNightLoadingRenderer(this));
3834
mElectricFanDrawable = new LoadingDrawable(new ElectricFanLoadingRenderer(this));
3935

4036
mIvDayNight.setImageDrawable(mDayNightDrawable);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<LinearLayout
2+
android:orientation="vertical"
3+
android:layout_height="match_parent"
4+
android:layout_width="match_parent"
5+
xmlns:android="http://schemas.android.com/apk/res/android">
6+
7+
8+
<ImageView
9+
android:id="@+id/fish_view"
10+
android:layout_weight="1"
11+
android:layout_width="match_parent"
12+
android:background="#ff071c28"
13+
android:layout_height="0dp" />
14+
15+
<ImageView
16+
android:id="@+id/ghosts_eye_view"
17+
android:layout_weight="1"
18+
android:layout_height="0dp"
19+
android:background="#ffcdcdcd"
20+
android:layout_width="match_parent" />
21+
22+
</LinearLayout>

app/src/main/res/layout/activity_main.xml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,36 @@
22
android:layout_width="match_parent"
33
android:layout_height="match_parent"
44
android:orientation="vertical"
5+
android:layout_marginTop="50dp"
56
android:gravity="center">
67

8+
<Button
9+
android:layout_width="wrap_content"
10+
android:layout_height="wrap_content"
11+
android:textAllCaps="false"
12+
android:text="AnimalActivity"
13+
android:id="@+id/animal" />
14+
715
<Button
816
android:layout_width="wrap_content"
917
android:layout_height="wrap_content"
1018
android:textAllCaps="false"
1119
android:text="SceneryActivity"
20+
android:layout_marginTop="30dp"
1221
android:id="@+id/scenery" />
1322

1423
<Button
1524
android:layout_width="wrap_content"
1625
android:layout_height="wrap_content"
1726
android:textAllCaps="false"
18-
android:layout_marginTop="50dp"
27+
android:layout_marginTop="30dp"
1928
android:text="CircleRotateActivity"
2029
android:id="@+id/circle_rotate" />
2130

2231
<Button
2332
android:layout_width="wrap_content"
2433
android:layout_height="wrap_content"
25-
android:layout_marginTop="50dp"
34+
android:layout_marginTop="30dp"
2635
android:textAllCaps="false"
2736
android:text="CircleJumpActivity"
2837
android:id="@+id/circle_jump" />

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<string name="label_circle_rotate">CircleRotateActivity</string>
44
<string name="label_circle_jump">CircleJumpActivity</string>
55
<string name="label_scenery">SceneryActivity</string>
6+
<string name="label_animal">AnimalActivity</string>
67

78
<string name="hello_world">Hello world!</string>
89
<string name="action_settings">Settings</string>

library/src/main/java/app/dinus/com/loadingdrawable/render/LoadingRenderer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ private void setupAnimators() {
7777
mRenderAnimator = ValueAnimator.ofFloat(0.0f, 1.0f);
7878
mRenderAnimator.setRepeatCount(Animation.INFINITE);
7979
mRenderAnimator.setRepeatMode(Animation.RESTART);
80+
//fuck you! the default interpolator is AccelerateDecelerateInterpolator
81+
mRenderAnimator.setInterpolator(new LinearInterpolator());
8082
mRenderAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
8183
@Override
8284
public void onAnimationUpdate(ValueAnimator animation) {

0 commit comments

Comments
 (0)