GeezerVison is showing github.com — animated vector drawable update · CoderGuoy/Coder@5c8e798
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/java/com/coder/guoy/recyclerview/ui/PlayAnimateVectorDrawables.java +13-4Lines changed: 13 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package com.coder.guoy.recyclerview.ui; | 2 | 2 |
| 3 | | -import android.animation.ObjectAnimator; | 4 | 3 | import android.graphics.drawable.Animatable; | 5 | 4 | import android.os.Bundle; | 6 | 5 | import android.view.View; | | 9 | 8 | import com.coder.guoy.recyclerview.base.MvvmBaseActivity; | 10 | 9 | import com.coder.guoy.recyclerview.databinding.ActivityPlayAnimateVectorDrawablesBinding; | 11 | 10 |
| | 11 | +/** | | 12 | + * @Version:v1.0 | | 13 | + * @Author:Guoy | | 14 | + * @CreateTime:2017年6月21日 | | 15 | + * @Descrpiton:AnimateVectorDrawables|矢量图片动画 | | 16 | + */ | 12 | 17 | public class PlayAnimateVectorDrawables extends MvvmBaseActivity<ActivityPlayAnimateVectorDrawablesBinding> implements View.OnClickListener { | | 18 | + private boolean isFirst = true; | 13 | 19 |
| 14 | 20 | @Override | 15 | 21 | protected void onCreate(Bundle savedInstanceState) { | @@ -20,6 +26,7 @@ protected void onCreate(Bundle savedInstanceState) { | 20 | 26 | bindingView.animatevectordrawable.toolbarBack.setOnClickListener(this); | 21 | 27 | bindingView.imageSmile.setOnClickListener(this); | 22 | 28 | bindingView.btnGiveheart.setOnClickListener(this); | | 29 | + bindingView.imageRedheart.setOnClickListener(this); | 23 | 30 | } | 24 | 31 |
| 25 | 32 | @Override | @@ -28,15 +35,17 @@ public void onClick(View v) { | 28 | 35 | case R.id.toolbar_back: | 29 | 36 | finish(); | 30 | 37 | break; | 31 | | - case R.id.image_smile: | | 38 | + case R.id.image_smile://笑脸 | 32 | 39 | ((Animatable) bindingView.imageSmile.getDrawable()).start(); | 33 | 40 | break; | | 41 | + case R.id.image_redheart://红心 | | 42 | + ((Animatable) bindingView.imageRedheart.getDrawable()).start(); | | 43 | + break; | 34 | 44 | case R.id.btn_giveheart: | 35 | 45 | bindingView.imageHeart.setVisibility(View.VISIBLE); | 36 | 46 | Animatable animatable = (Animatable) bindingView.imageHeart.getDrawable(); | 37 | 47 | animatable.start(); | 38 | | - ObjectAnimator rotation = ObjectAnimator.ofFloat(bindingView.imageHeart, "rotation", 0, -45); | 39 | | - rotation.start(); | | 48 | + break; | 40 | 49 | } | 41 | 50 | } | 42 | 51 | } |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/animator/animator_eye_left.xml +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | android:valueFrom="@string/path_left_eye_sad" | 7 | 7 | android:valueTo="@string/path_left_eye_happy" | 8 | 8 | android:valueType="pathType"> | 9 | | -</objectAnimator> | 10 | | - | | 9 | +</objectAnimator> |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/animator/animator_heart.xml -21Lines changed: 0 additions & 21 deletions Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/animator/animator_heart_ring.xml -7Lines changed: 0 additions & 7 deletions Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/animator/animator_heart_ring2.xml -7Lines changed: 0 additions & 7 deletions Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/animator/animator_heart_ring3.xml -7Lines changed: 0 additions & 7 deletions Collapse file Copy file name to clipboard +7Lines changed: 7 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:propertyName="fillColor" | | 5 | + android:valueFrom="@color/colorWrite" | | 6 | + android:valueTo="@color/red" | | 7 | + android:valueType="colorType"/> |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/drawable/animated_heart.xml -16Lines changed: 0 additions & 16 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | android:name="line1" | 7 | 7 | android:animation="@animator/animator_heart_line"/> | 8 | 8 |
| 9 | | -<!-- <target | 10 | | - android:name="ring1" | 11 | | - android:animation="@animator/animator_heart_ring"/> | 12 | | -
| 13 | | - <target | 14 | | - android:name="ring2" | 15 | | - android:animation="@animator/animator_heart_ring"/>--> | 16 | | - | 17 | | -<!-- <target | 18 | | - android:name="ring1" | 19 | | - android:animation="@animator/animator_heart_ring2"/> | 20 | | -
| 21 | | - <target | 22 | | - android:name="ring2" | 23 | | - android:animation="@animator/animator_heart_ring3"/>--> | 24 | | - | 25 | 9 | </animated-vector> |
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 | +<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" | | 3 | + android:drawable="@drawable/vector_red_heart"> | | 4 | + | | 5 | + <target | | 6 | + android:name="red_heart" | | 7 | + android:animation="@animator/animator_red_heart_color"/> | | 8 | + | | 9 | +</animated-vector> |
Collapse file Copy file name to clipboard +5-22Lines changed: 5 additions & 22 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> | 2 | 2 | <vector xmlns:android="http://schemas.android.com/apk/res/android" | 3 | | - android:width="300dp" | 4 | | - android:height="300dp" | 5 | | - android:viewportHeight="150" | 6 | | - android:viewportWidth="150"> | | 3 | + android:width="200dp" | | 4 | + android:height="200dp" | | 5 | + android:viewportHeight="100" | | 6 | + android:viewportWidth="100"> | 7 | 7 | <path | 8 | 8 | android:name="line1" | 9 | | - android:pathData="M 40,40 | 10 | | - L 40,90 L 90,90 L 90,65 | 11 | | - A 25,25 0,1,1,40,65 A 25,25 0,0,1,90,65 | 12 | | - L 90,40 L 40,40 | 13 | | - A 25,25 0,0,1,90,40 | 14 | | - A 25,25 0,0,1,90,90" | | 9 | + android:pathData="@string/path_heart_lin1" | 15 | 10 | android:strokeColor="@color/colorTabText" | 16 | 11 | android:strokeLineCap="round" | 17 | 12 | android:strokeWidth="1"/> | 18 | | - <!-- <path | 19 | | - android:name="ring1" | 20 | | - android:pathData="@string/path_heart_ring1" | 21 | | - android:strokeColor="@color/colorTabText" | 22 | | - android:strokeLineCap="round" | 23 | | - android:strokeWidth="1"/> | 24 | | - <path | 25 | | - android:name="ring2" | 26 | | - android:pathData="@string/path_heart_ring1" | 27 | | - android:strokeColor="@color/colorTabText" | 28 | | - android:strokeLineCap="round" | 29 | | - android:strokeWidth="1"/>--> | 30 | 13 | </vector> |
|