GeezerVison is showing github.com — animated vector drawable update · CoderGuoy/Coder@5463c71
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 +9-11Lines changed: 9 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 15 | 15 | * @Descrpiton:AnimateVectorDrawables|矢量图片动画 | 16 | 16 | */ | 17 | 17 | public class PlayAnimateVectorDrawables extends MvvmBaseActivity<ActivityPlayAnimateVectorDrawablesBinding> implements View.OnClickListener { | 18 | | - private boolean isFirst = true; | 19 | 18 |
| 20 | 19 | @Override | 21 | 20 | protected void onCreate(Bundle savedInstanceState) { | @@ -24,9 +23,7 @@ protected void onCreate(Bundle savedInstanceState) { | 24 | 23 | showContentView(); | 25 | 24 | bindingView.animatevectordrawable.textviewTitle.setText("Animate Vector Drawables|矢量图片动画"); | 26 | 25 | bindingView.animatevectordrawable.toolbarBack.setOnClickListener(this); | 27 | | - bindingView.imageSmile.setOnClickListener(this); | 28 | | - bindingView.btnGiveheart.setOnClickListener(this); | 29 | | - bindingView.imageRedheart.setOnClickListener(this); | | 26 | + bindingView.btnSuprise.setOnClickListener(this); | 30 | 27 | } | 31 | 28 |
| 32 | 29 | @Override | @@ -35,16 +32,17 @@ public void onClick(View v) { | 35 | 32 | case R.id.toolbar_back: | 36 | 33 | finish(); | 37 | 34 | break; | 38 | | - case R.id.image_smile://笑脸 | | 35 | + case R.id.btn_suprise: | | 36 | + //笑脸 | 39 | 37 | ((Animatable) bindingView.imageSmile.getDrawable()).start(); | 40 | | - break; | 41 | | - case R.id.image_redheart://红心 | | 38 | + //红心 | 42 | 39 | ((Animatable) bindingView.imageRedheart.getDrawable()).start(); | 43 | | - break; | 44 | | - case R.id.btn_giveheart: | | 40 | + //bonc | | 41 | + bindingView.imageBonc.setVisibility(View.VISIBLE); | | 42 | + ((Animatable) bindingView.imageBonc.getDrawable()).start(); | | 43 | + //线性心 | 45 | 44 | bindingView.imageHeart.setVisibility(View.VISIBLE); | 46 | | - Animatable animatable = (Animatable) bindingView.imageHeart.getDrawable(); | 47 | | - animatable.start(); | | 45 | + ((Animatable) bindingView.imageHeart.getDrawable()).start(); | 48 | 46 | break; | 49 | 47 | } | 50 | 48 | } | |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/animator/animator_heart_line.xml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> | 2 | 2 | <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" | 3 | | - android:duration="2000" | | 3 | + android:duration="3000" | 4 | 4 | android:interpolator="@android:anim/decelerate_interpolator" | 5 | 5 | android:propertyName="trimPathEnd" | 6 | 6 | android:valueFrom="0" | |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/animator/animator_heart_rotate.xml -6Lines changed: 0 additions & 6 deletions 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_bonc"> | | 4 | + <target | | 5 | + android:animation="@animator/animator_heart_line" | | 6 | + android:name="bonc"/> | | 7 | + | | 8 | +</animated-vector> |
Collapse file Copy file name to clipboard +20Lines changed: 20 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:height="200dp" | | 4 | + android:width="400dp" | | 5 | + android:viewportHeight="100" | | 6 | + android:viewportWidth="200" | | 7 | + > | | 8 | + | | 9 | + <path | | 10 | + android:name="rect" | | 11 | + android:fillColor="@color/red" | | 12 | + android:pathData="M 0,0 L 0,100 L 200,100 L 200,0 "/> | | 13 | + | | 14 | + <path | | 15 | + android:name="bonc" | | 16 | + android:pathData="@string/path_bonc" | | 17 | + android:strokeColor="@color/colorWrite" | | 18 | + android:strokeLineCap="round" | | 19 | + android:strokeWidth="1"/> | | 20 | +</vector> |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/drawable/vector_heart1.xml -13Lines changed: 0 additions & 13 deletions Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/layout/activity_play_animate_vector_drawables.xml +12-10Lines changed: 12 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 13 | 13 | android:id="@+id/animatevectordrawable" | 14 | 14 | layout="@layout/toolbar"/> | 15 | 15 |
| | 16 | + <Button | | 17 | + android:id="@+id/btn_suprise" | | 18 | + android:layout_width="match_parent" | | 19 | + android:layout_height="wrap_content" | | 20 | + android:text="点我有惊喜^_^"/> | | 21 | + | 16 | 22 | <LinearLayout | 17 | 23 | android:layout_width="match_parent" | 18 | 24 | android:layout_height="wrap_content" | | 32 | 38 | </LinearLayout> | 33 | 39 |
| 34 | 40 | <ImageView | 35 | | - android:id="@+id/image_heart" | | 41 | + android:id="@+id/image_bonc" | 36 | 42 | android:layout_width="wrap_content" | 37 | 43 | android:layout_height="wrap_content" | 38 | 44 | android:layout_gravity="center" | 39 | | - android:src="@drawable/animated_heart" | | 45 | + android:src="@drawable/animated_bonc" | 40 | 46 | android:visibility="invisible"/> | 41 | 47 |
| 42 | 48 | <ImageView | 43 | | - android:id="@+id/image_bonc" | | 49 | + android:id="@+id/image_heart" | 44 | 50 | android:layout_width="wrap_content" | 45 | 51 | android:layout_height="wrap_content" | 46 | | - android:layout_gravity="center"/> | 47 | | - | 48 | | - <Button | 49 | | - android:id="@+id/btn_giveheart" | 50 | | - android:layout_width="match_parent" | 51 | | - android:layout_height="wrap_content" | 52 | | - android:text="点我有惊喜^_^"/> | | 52 | + android:layout_gravity="center" | | 53 | + android:src="@drawable/animated_heart" | | 54 | + android:visibility="invisible"/> | 53 | 55 |
| 54 | 56 | </LinearLayout> | 55 | 57 |
| |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/values/strings.xml +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 44 | 44 | L 50,85 L 15,50 | 45 | 45 | A 17.5,17.5,0,1,1,50,15 | 46 | 46 | </string> | | 47 | + <!--bonc--> | | 48 | + <string name="path_bonc">M 12,25 L 42,25 A 12.5,12.5,90,1,1,42,50 L 56,50 A 24,24,0,1,1,104,50 L 108,50 L 108,25 L 118,25 133,50 L 133,25 L 143,25 L 143,50 L 148,50 A 25,25 -90,0,1,178,25 L 178,35 A 15,15,-90,0,0,158,50 A 15,15,90,0,0,178,65 L 178,75 A 25,25,90,0,1,148,50 L 143,50 L 143,75 L 133,75,118,50 L 118,75 L 108 75 L 108,50 L 104,50 A 24,24,180,1,1,56,50 L 42,50 A 12.5,12.5,90,1,1,42,75 L 12,75 L 12 ,25</string> | 47 | 49 |
| 48 | 50 | </resources> |
|