GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 新增揭露动画 · hzjc/AndroidCustomView@5d8c242

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • app/src/main
    • AndroidManifest.xml
    • java/com/allen/androidcustomview/activity
      • MainActivity.java
      • RevealAnimationActivity.java
    • res
      • layout
        • activity_reveal_animation.xml
      • mipmap-xxhdpi
        • icon_img1.png
        • icon_img2.jpg
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎app/src/main/AndroidManifest.xml‎

Copy file name to clipboardExpand all lines: app/src/main/AndroidManifest.xml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<activity android:name=".activity.FingerprintActivity" />
3535
<activity android:name=".activity.BannerActivity" />
3636
<activity android:name=".activity.HoverItemActivity"/>
37+
<activity android:name=".activity.RevealAnimationActivity" />
3738
</application>
3839

3940
</manifest>
Collapse file

‎app/src/main/java/com/allen/androidcustomview/activity/MainActivity.java‎

Copy file name to clipboardExpand all lines: app/src/main/java/com/allen/androidcustomview/activity/MainActivity.java
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ protected void onCreate(Bundle savedInstanceState) {
3838
adapter.setOnItemClickListener(this);
3939
recyclerView.setLayoutManager(new LinearLayoutManager(this));
4040
recyclerView.addItemDecoration(new SuperDividerItemDecoration.Builder(this)
41-
.setDividerWidth(5)
42-
.setDividerColor(getResources().getColor(R.color.colorAccent))
4341
.build());
4442
recyclerView.setAdapter(adapter);
4543
}
@@ -57,6 +55,7 @@ private List<TypeBean> getData() {
5755
typeBeans.add(new TypeBean("粘性小球", 9));
5856
typeBeans.add(new TypeBean("banner", 10));
5957
typeBeans.add(new TypeBean("吸顶效果--一行代码实现", 11));
58+
typeBeans.add(new TypeBean("揭露动画", 12));
6059
return typeBeans;
6160
}
6261

@@ -99,6 +98,9 @@ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
9998
case 11:
10099
startActivity(new Intent(MainActivity.this, HoverItemActivity.class));
101100
break;
101+
case 12:
102+
startActivity(new Intent(MainActivity.this, RevealAnimationActivity.class));
103+
break;
102104
default:
103105

104106
}
Collapse file

‎app/src/main/java/com/allen/androidcustomview/activity/RevealAnimationActivity.java‎

Copy file name to clipboard
+85Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package com.allen.androidcustomview.activity;
2+
3+
import android.animation.Animator;
4+
import android.os.Build;
5+
import android.os.Bundle;
6+
import android.support.annotation.Nullable;
7+
import android.support.v7.app.AppCompatActivity;
8+
import android.view.View;
9+
import android.view.ViewAnimationUtils;
10+
import android.widget.Button;
11+
import android.widget.ImageView;
12+
13+
import com.allen.androidcustomview.R;
14+
15+
/**
16+
* <pre>
17+
* @author : xiaoyao
18+
* e-mail : [email protected]
19+
* date : 2018/08/24
20+
* desc : 揭露动画
21+
* version : 1.0
22+
* </pre>
23+
*/
24+
public class RevealAnimationActivity extends AppCompatActivity {
25+
26+
private ImageView imageView;
27+
private Button startBtn;
28+
29+
@Override
30+
protected void onCreate(@Nullable Bundle savedInstanceState) {
31+
super.onCreate(savedInstanceState);
32+
setContentView(R.layout.activity_reveal_animation);
33+
34+
imageView = findViewById(R.id.img_iv);
35+
startBtn = findViewById(R.id.start_btn);
36+
37+
38+
final int centerX = 0;
39+
final int centerY = 0;
40+
startBtn.setOnClickListener(new View.OnClickListener() {
41+
@Override
42+
public void onClick(View v) {
43+
final float radius = (float) Math.hypot(imageView.getWidth(), imageView.getHeight());
44+
45+
if (imageView.getVisibility() == View.VISIBLE) {
46+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
47+
Animator animator = ViewAnimationUtils.createCircularReveal(imageView, centerX, centerY, radius, 0);
48+
animator.setDuration(3000);
49+
animator.addListener(new Animator.AnimatorListener() {
50+
@Override
51+
public void onAnimationStart(Animator animation) {
52+
53+
}
54+
55+
@Override
56+
public void onAnimationEnd(Animator animation) {
57+
imageView.setVisibility(View.GONE);
58+
}
59+
60+
@Override
61+
public void onAnimationCancel(Animator animation) {
62+
63+
}
64+
65+
@Override
66+
public void onAnimationRepeat(Animator animation) {
67+
68+
}
69+
});
70+
animator.start();
71+
}
72+
73+
} else {
74+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
75+
Animator animator = ViewAnimationUtils.createCircularReveal(imageView, centerX, centerY, 0, radius);
76+
animator.setDuration(3000);
77+
imageView.setVisibility(View.VISIBLE);
78+
animator.start();
79+
}
80+
}
81+
}
82+
});
83+
84+
}
85+
}
Collapse file

‎app/src/main/res/layout/activity_reveal_animation.xml‎

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:orientation="vertical">
6+
7+
<FrameLayout
8+
android:layout_width="match_parent"
9+
android:layout_height="wrap_content">
10+
11+
<ImageView
12+
android:layout_width="match_parent"
13+
android:layout_height="200dp"
14+
android:scaleType="centerCrop"
15+
android:src="@mipmap/icon_img1" />
16+
17+
<ImageView
18+
android:id="@+id/img_iv"
19+
android:layout_width="match_parent"
20+
android:layout_height="200dp"
21+
android:scaleType="centerCrop"
22+
android:src="@mipmap/icon_img2"
23+
android:visibility="invisible" />
24+
</FrameLayout>
25+
26+
<Button
27+
android:id="@+id/start_btn"
28+
android:layout_width="match_parent"
29+
android:layout_height="wrap_content"
30+
android:text="开启" />
31+
</LinearLayout>
Collapse file

‎app/src/main/res/mipmap-xxhdpi/icon_img1.png‎

Copy file name to clipboard
778 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎app/src/main/res/mipmap-xxhdpi/icon_img2.jpg‎

Copy file name to clipboard
81.5 KB
  • Display the source diff
  • Display the rich diff
Loading

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.