GeezerVison is showing github.com — animated vector drawable add · AndroidLu/Coder@3e1fd08
File treeExpand file treeCollapse file tree Open diff view settings java/com/coder/guoy/recyclerview/ui
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: app/src/main/AndroidManifest.xml +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 135 | 135 | <activity | 136 | 136 | android:name=".ui.PlayActivityTransitions" | 137 | 137 | android:screenOrientation="portrait"/> | | 138 | + <activity android:name=".ui.PlayAnimateVectorDrawables"> | | 139 | + </activity> | 138 | 140 | </application> | 139 | 141 |
| 140 | 142 | </manifest> |
Collapse file Copy file name to clipboard +33Lines changed: 33 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +package com.coder.guoy.recyclerview.ui; | | 2 | + | | 3 | +import android.graphics.drawable.Animatable; | | 4 | +import android.os.Bundle; | | 5 | +import android.view.View; | | 6 | + | | 7 | +import com.coder.guoy.recyclerview.R; | | 8 | +import com.coder.guoy.recyclerview.base.MvvmBaseActivity; | | 9 | +import com.coder.guoy.recyclerview.databinding.ActivityPlayAnimateVectorDrawablesBinding; | | 10 | + | | 11 | +public class PlayAnimateVectorDrawables extends MvvmBaseActivity<ActivityPlayAnimateVectorDrawablesBinding> implements View.OnClickListener { | | 12 | + | | 13 | + @Override | | 14 | + protected void onCreate(Bundle savedInstanceState) { | | 15 | + super.onCreate(savedInstanceState); | | 16 | + setContentView(R.layout.activity_play_animate_vector_drawables); | | 17 | + showContentView(); | | 18 | + bindingView.animatevectordrawable.textviewTitle.setText("Animate Vector Drawables|矢量图片动画"); | | 19 | + bindingView.animatevectordrawable.toolbarBack.setOnClickListener(this); | | 20 | + bindingView.imageSmile.setOnClickListener(this); | | 21 | + } | | 22 | + | | 23 | + @Override | | 24 | + public void onClick(View v) { | | 25 | + switch (v.getId()) { | | 26 | + case R.id.toolbar_back: | | 27 | + finish(); | | 28 | + break; | | 29 | + case R.id.image_smile: | | 30 | + ((Animatable) bindingView.imageSmile.getDrawable()).start(); | | 31 | + } | | 32 | + } | | 33 | +} |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/com/coder/guoy/recyclerview/ui/holder/MaterialDesignHolder.java +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 8 | 8 | import com.coder.guoy.recyclerview.base.MvvmBaseActivity; | 9 | 9 | import com.coder.guoy.recyclerview.databinding.ActivityMaterialDesignHolderBinding; | 10 | 10 | import com.coder.guoy.recyclerview.ui.PlayActivityTransitions; | | 11 | +import com.coder.guoy.recyclerview.ui.PlayAnimateVectorDrawables; | 11 | 12 | import com.coder.guoy.recyclerview.ui.PlayCurvedMotion; | 12 | 13 | import com.coder.guoy.recyclerview.ui.PlayFloatingActionButton; | 13 | 14 | import com.coder.guoy.recyclerview.ui.PlayRevealEffect; | @@ -52,6 +53,7 @@ protected void onCreate(Bundle savedInstanceState) { | 52 | 53 | bindingView.btnCurved.setOnClickListener(this); | 53 | 54 | bindingView.btnViewstate.setOnClickListener(this); | 54 | 55 | bindingView.btnActivitytransition.setOnClickListener(this); | | 56 | + bindingView.btnVectordrawable.setOnClickListener(this); | 55 | 57 | } | 56 | 58 |
| 57 | 59 | @Override | @@ -108,6 +110,9 @@ public void onClick(View v) { | 108 | 110 | case R.id.btn_activitytransition: | 109 | 111 | startActivity(new Intent(MaterialDesignHolder.this, PlayActivityTransitions.class)); | 110 | 112 | break; | | 113 | + case R.id.btn_vectordrawable: | | 114 | + startActivity(new Intent(MaterialDesignHolder.this, PlayAnimateVectorDrawables.class)); | | 115 | + break; | 111 | 116 | } | 112 | 117 | } | 113 | 118 | } |
Collapse file Copy file name to clipboard +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<?xml version="1.0" encoding="utf-8"?> | | 2 | +<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" | | 3 | + android:duration="1000" | | 4 | + android:interpolator="@android:anim/accelerate_interpolator" | | 5 | + android:propertyName="pathData" | | 6 | + android:valueFrom="@string/path_face_mouth_sad" | | 7 | + android:valueTo="@string/path_face_mouth_happy" | | 8 | + android:valueType="pathType"/> | | 9 | + |
Collapse file Copy file name to clipboard +8Lines changed: 8 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<?xml version="1.0" encoding="utf-8"?> | | 2 | +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" | | 3 | + android:drawable="@drawable/vector_smile"> | | 4 | + <target | | 5 | + android:name="smile" | | 6 | + android:animation="@animator/smile"/> | | 7 | + | | 8 | +</animated-vector> |
Collapse file Copy file name to clipboard +26Lines changed: 26 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<?xml version="1.0" encoding="utf-8"?> | | 2 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | | 3 | + android:width="200dp" | | 4 | + android:height="200dp" | | 5 | + android:viewportHeight="100" | | 6 | + android:viewportWidth="100"> | | 7 | + | | 8 | + <path | | 9 | + android:fillColor="@color/yello" | | 10 | + android:pathData="m 50,50 m -48 ,0 a 48,48 0 1,0 96,0 a 48,48 0 1,0 -96,0"/> | | 11 | + | | 12 | + <path | | 13 | + android:fillColor="@color/colorBlack" | | 14 | + android:pathData="m 35 ,40 m -7,0 a 7,7 0 1,0 14,0 a 7,7 0 1,0 -14 ,0"/> | | 15 | + <path | | 16 | + android:fillColor="@color/colorBlack" | | 17 | + android:pathData="m 65 ,40 m -7,0 a 7,7 0 1,0 14,0 a 7,7 0 1,0 -14 ,0"/> | | 18 | + | | 19 | + <path | | 20 | + android:name="smile" | | 21 | + android:pathData="m 30,75 Q 50,55 70,75" | | 22 | + android:strokeColor="@color/colorBlack" | | 23 | + android:strokeLineCap="round" | | 24 | + android:strokeWidth="4"/> | | 25 | + | | 26 | +</vector> |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/layout/activity_material_design_holder.xml +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 111 | 111 | android:layout_height="wrap_content" | 112 | 112 | android:text="Activity Transitions|转场动画" | 113 | 113 | android:textAllCaps="false"/> | | 114 | + <Button | | 115 | + android:id="@+id/btn_vectordrawable" | | 116 | + android:layout_width="match_parent" | | 117 | + android:layout_height="wrap_content" | | 118 | + android:text="Animate Vector Drawables|矢量图片动画" | | 119 | + android:textAllCaps="false"/> | 114 | 120 |
| 115 | 121 | </LinearLayout> | 116 | 122 | </android.support.v4.widget.NestedScrollView> | |
Collapse file Copy file name to clipboard +22Lines changed: 22 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +<?xml version="1.0" encoding="utf-8"?> | | 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android" | | 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | | 4 | + xmlns:tools="http://schemas.android.com/tools"> | | 5 | + | | 6 | + <LinearLayout | | 7 | + android:layout_width="match_parent" | | 8 | + android:layout_height="match_parent" | | 9 | + android:orientation="vertical"> | | 10 | + | | 11 | + <include | | 12 | + android:id="@+id/animatevectordrawable" | | 13 | + layout="@layout/toolbar"/> | | 14 | + | | 15 | + <ImageView | | 16 | + android:id="@+id/image_smile" | | 17 | + android:layout_width="wrap_content" | | 18 | + android:layout_height="wrap_content" | | 19 | + android:src="@drawable/animated_smile"/> | | 20 | + </LinearLayout> | | 21 | + | | 22 | +</layout> |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/values/strings.xml +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 20 | 20 | <string name="CoordinatorLayout">折叠布局的嵌套</string> | 21 | 21 | <string name="FAILE">加载失败,点击重试</string> | 22 | 22 | <string name="LOADING">努力加载中...</string> | | 23 | + | | 24 | + <string name="path_face_mouth_sad"> | | 25 | + M 30,75 | | 26 | + Q 50,55 70,75 | | 27 | + </string> | | 28 | + <string name="path_face_mouth_happy"> | | 29 | + M 30,65 | | 30 | + Q 50,85 70,65 | | 31 | + </string> | 23 | 32 | </resources> |
|