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 — 添加translate的动画 · tmexcept/AndroidCustomView@2b18ffe

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .gitignore
  • .idea
    • gradle.xml
    • misc.xml
    • modules.xml
  • app/src/main
    • AndroidManifest.xml
    • java/com/allen/androidcustomview
      • activity
        • MainActivity.kt
        • TranslateRotateCanvasActivity.java
      • widget
        • TranslateRotateView.java
    • res/layout
      • activity_tranlate_rotate.xml
  • build.gradle
  • gradle/wrapper
    • gradle-wrapper.properties
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.gitignore‎

Copy file name to clipboardExpand all lines: .gitignore
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
.idea
77
/captures
88
.externalNativeBuild
9+
/.idea
Collapse file

‎.idea/gradle.xml‎

Copy file name to clipboardExpand all lines: .idea/gradle.xml
+2Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎.idea/misc.xml‎

Copy file name to clipboardExpand all lines: .idea/misc.xml
+7-3Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎.idea/modules.xml‎

Copy file name to clipboardExpand all lines: .idea/modules.xml
+2Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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
@@ -39,6 +39,7 @@
3939
<activity android:name=".activity.RecyclerViewItemAnimActivity" />
4040
<activity android:name=".activity.PathActivity" />
4141
<activity android:name=".activity.SinaVoteActivity" />
42+
<activity android:name=".activity.TranslateRotateCanvasActivity" />
4243
</application>
4344

4445
</manifest>
Collapse file

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

Copy file name to clipboardExpand all lines: app/src/main/java/com/allen/androidcustomview/activity/MainActivity.kt
+20-17Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,28 @@ class MainActivity : AppCompatActivity(), BaseQuickAdapter.OnItemClickListener {
2222
private var adapter: MainAdapter? = null
2323

2424
private val typeBeans = ArrayList<TypeBean>()
25+
private var index : Int = 0;
2526

2627
private val data: List<TypeBean>
2728
get() {
28-
typeBeans.add(TypeBean("气泡漂浮动画", 0))
29-
typeBeans.add(TypeBean("波浪动画--贝塞尔曲线实现", 1))
30-
typeBeans.add(TypeBean("波浪动画--正余弦函数实现", 2))
31-
typeBeans.add(TypeBean("水波(雷达)扩散效果", 3))
32-
typeBeans.add(TypeBean("RecyclerView实现另类的Tag标签", 4))
33-
typeBeans.add(TypeBean("按钮自定义动画", 5))
34-
typeBeans.add(TypeBean("自定义支付密码输入框", 6))
35-
typeBeans.add(TypeBean("自定义进度条", 7))
36-
typeBeans.add(TypeBean("使用的带动画的view", 8))
37-
typeBeans.add(TypeBean("粘性小球", 9))
38-
typeBeans.add(TypeBean("banner", 10))
39-
typeBeans.add(TypeBean("吸顶效果--一行代码实现", 11))
40-
typeBeans.add(TypeBean("揭露动画", 12))
41-
typeBeans.add(TypeBean("支付宝首页效果", 13))
42-
typeBeans.add(TypeBean("RecyclerView的item动画", 14))
43-
typeBeans.add(TypeBean("路径path动画", 15))
44-
typeBeans.add(TypeBean("仿新浪投票控件", 16))
29+
typeBeans.add(TypeBean("气泡漂浮动画", index++))
30+
typeBeans.add(TypeBean("波浪动画--贝塞尔曲线实现", index++))
31+
typeBeans.add(TypeBean("波浪动画--正余弦函数实现", index++))
32+
typeBeans.add(TypeBean("水波(雷达)扩散效果", index++))
33+
typeBeans.add(TypeBean("RecyclerView实现另类的Tag标签", index++))
34+
typeBeans.add(TypeBean("按钮自定义动画", index++))
35+
typeBeans.add(TypeBean("自定义支付密码输入框", index++))
36+
typeBeans.add(TypeBean("自定义进度条", index++))
37+
typeBeans.add(TypeBean("使用的带动画的view", index++))
38+
typeBeans.add(TypeBean("粘性小球", index++))
39+
typeBeans.add(TypeBean("banner", index++))
40+
typeBeans.add(TypeBean("吸顶效果--一行代码实现", index++))
41+
typeBeans.add(TypeBean("揭露动画", index++))
42+
typeBeans.add(TypeBean("支付宝首页效果", index++))
43+
typeBeans.add(TypeBean("RecyclerView的item动画", index++))
44+
typeBeans.add(TypeBean("路径path动画", index++))
45+
typeBeans.add(TypeBean("仿新浪投票控件", index++))
46+
typeBeans.add(TypeBean("自定义控件", index++))
4547
return typeBeans
4648
}
4749

@@ -84,6 +86,7 @@ class MainActivity : AppCompatActivity(), BaseQuickAdapter.OnItemClickListener {
8486
14 -> startActivity(Intent(this@MainActivity, RecyclerViewItemAnimActivity::class.java))
8587
15 -> startActivity(Intent(this@MainActivity, PathActivity::class.java))
8688
16 -> startActivity(Intent(this@MainActivity, SinaVoteActivity::class.java))
89+
17 -> startActivity(Intent(this@MainActivity, TranslateRotateCanvasActivity::class.java))
8790
}
8891
}
8992
}
Collapse file

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

Copy file name to clipboard
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.allen.androidcustomview.activity;
2+
3+
import android.os.Bundle;
4+
import android.support.annotation.Nullable;
5+
import android.support.v7.app.AppCompatActivity;
6+
7+
import com.allen.androidcustomview.R;
8+
9+
public class TranslateRotateCanvasActivity extends AppCompatActivity {
10+
11+
@Override
12+
protected void onCreate(@Nullable Bundle savedInstanceState) {
13+
super.onCreate(savedInstanceState);
14+
setContentView(R.layout.activity_tranlate_rotate);
15+
}
16+
}
Collapse file

‎app/src/main/java/com/allen/androidcustomview/widget/TranslateRotateView.java‎

Copy file name to clipboard
+42Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.allen.androidcustomview.widget;
2+
3+
import android.content.Context;
4+
import android.graphics.Canvas;
5+
import android.graphics.Paint;
6+
import android.support.annotation.Nullable;
7+
import android.util.AttributeSet;
8+
import android.view.View;
9+
10+
public class TranslateRotateView extends View {
11+
public TranslateRotateView(Context context) {
12+
this(context, null);
13+
}
14+
15+
public TranslateRotateView(Context context, @Nullable AttributeSet attrs) {
16+
this(context, attrs, 0);
17+
}
18+
19+
public TranslateRotateView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
20+
super(context, attrs, defStyleAttr);
21+
22+
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
23+
}
24+
Paint mPaint;
25+
26+
@Override
27+
protected void onDraw(Canvas canvas) {
28+
super.onDraw(canvas);
29+
30+
mPaint.setColor(0xffff0000);
31+
canvas.translate(200, 100);
32+
canvas.rotate(45);
33+
canvas.drawRect(0,0,50,100, mPaint);
34+
35+
// canvas.save();
36+
mPaint.setColor(0xff00ff00);
37+
// canvas.rotate(45);
38+
// canvas.translate(200, 100);
39+
// canvas.drawRect(200,200,250,300, mPaint);
40+
// canvas.restore();
41+
}
42+
}
Collapse file

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

Copy file name to clipboard
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:orientation="vertical">
7+
8+
<com.allen.androidcustomview.widget.TranslateRotateView
9+
android:layout_width="match_parent"
10+
android:layout_height="match_parent" />
11+
12+
</android.support.design.widget.CoordinatorLayout>
Collapse file

‎build.gradle‎

Copy file name to clipboardExpand all lines: build.gradle
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
buildscript {
44
ext.kotlin_version = '1.3.20'
55
repositories {
6+
google()
67
jcenter()
78
maven {
89
url 'https://maven.google.com/'
910
name 'Google'
1011
}
1112
}
1213
dependencies {
13-
classpath 'com.android.tools.build:gradle:3.3.2'
14+
classpath 'com.android.tools.build:gradle:3.4.2'
1415
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1516

1617
// NOTE: Do not place your application dependencies here; they belong
@@ -20,6 +21,7 @@ buildscript {
2021

2122
allprojects {
2223
repositories {
24+
google()
2325
jcenter()
2426
maven { url "https://jitpack.io" }
2527
maven {

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.