From 7063149f3914dfc03961b5bd40a53d3d3b279eb4 Mon Sep 17 00:00:00 2001 From: clock <1084991652clock@gmail.com> Date: Wed, 22 Jun 2016 12:03:10 +0800 Subject: [PATCH 01/36] =?UTF-8?q?=E6=B7=BB=E5=8A=A0RecyclerView=E5=A4=A7?= =?UTF-8?q?=E5=85=A8.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...erView \344\275\277\347\224\250\345\244\247\345\205\250.md" | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 "notes/RecyclerView \344\275\277\347\224\250\345\244\247\345\205\250.md" diff --git "a/notes/RecyclerView \344\275\277\347\224\250\345\244\247\345\205\250.md" "b/notes/RecyclerView \344\275\277\347\224\250\345\244\247\345\205\250.md" new file mode 100644 index 0000000..2712705 --- /dev/null +++ "b/notes/RecyclerView \344\275\277\347\224\250\345\244\247\345\205\250.md" @@ -0,0 +1,3 @@ +# RecyclerView 使用大全 + +整理罗列想要写的知识点 \ No newline at end of file From 307275224a3615631ef027ab56e93d97e660fd18 Mon Sep 17 00:00:00 2001 From: clock <1084991652clock@gmail.com> Date: Fri, 1 Jul 2016 21:30:31 +0800 Subject: [PATCH 02/36] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=A4=E7=AF=87?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=96=87=E7=AB=A0md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...47\232\204\345\217\221\345\261\225\346\274\224\350\277\233.md" | 0 ...6\267\261\345\205\245\344\275\277\347\224\250 RecyclerView.md" | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 "notes/Android\345\212\250\347\224\273\347\232\204\345\217\221\345\261\225\346\274\224\350\277\233.md" rename "notes/RecyclerView \344\275\277\347\224\250\345\244\247\345\205\250.md" => "notes/\346\267\261\345\205\245\344\275\277\347\224\250 RecyclerView.md" (100%) diff --git "a/notes/Android\345\212\250\347\224\273\347\232\204\345\217\221\345\261\225\346\274\224\350\277\233.md" "b/notes/Android\345\212\250\347\224\273\347\232\204\345\217\221\345\261\225\346\274\224\350\277\233.md" new file mode 100644 index 0000000..e69de29 diff --git "a/notes/RecyclerView \344\275\277\347\224\250\345\244\247\345\205\250.md" "b/notes/\346\267\261\345\205\245\344\275\277\347\224\250 RecyclerView.md" similarity index 100% rename from "notes/RecyclerView \344\275\277\347\224\250\345\244\247\345\205\250.md" rename to "notes/\346\267\261\345\205\245\344\275\277\347\224\250 RecyclerView.md" From 74dc69bdb80c0319b315d004ac958c337f33cc49 Mon Sep 17 00:00:00 2001 From: clock <1084991652clock@gmail.com> Date: Mon, 4 Jul 2016 18:15:48 +0800 Subject: [PATCH 03/36] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Android=20Animation?= =?UTF-8?q?=20=E4=BD=BF=E7=94=A8=E6=A0=97=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/AndroidManifest.xml | 1 + .../study/activity/AndroidAnimActivity.java | 97 +++++++++++++++++++ .../clock/study/activity/MainActivity.java | 4 + src/main/res/layout/activity_android_anim.xml | 40 ++++++++ src/main/res/layout/activity_main.xml | 9 +- 5 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/clock/study/activity/AndroidAnimActivity.java create mode 100644 src/main/res/layout/activity_android_anim.xml diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 794c2b8..a270a85 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -29,6 +29,7 @@ android:name=".activity.PhotoPreviewActivity" android:label="@string/photo_preview" android:screenOrientation="portrait" /> + \ No newline at end of file diff --git a/src/main/java/com/clock/study/activity/AndroidAnimActivity.java b/src/main/java/com/clock/study/activity/AndroidAnimActivity.java new file mode 100644 index 0000000..32608e1 --- /dev/null +++ b/src/main/java/com/clock/study/activity/AndroidAnimActivity.java @@ -0,0 +1,97 @@ +package com.clock.study.activity; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; +import android.view.animation.AnimationSet; +import android.view.animation.RotateAnimation; +import android.view.animation.ScaleAnimation; +import android.view.animation.TranslateAnimation; +import android.widget.Button; + +import com.clock.study.R; + +/** + * Android动画效果实现复习 + */ +public class AndroidAnimActivity extends AppCompatActivity implements View.OnClickListener { + + private Button mBtnTranslate; + private Button mBtnScale; + private Button mBtnRotate; + private Button mBtnAlpha; + private Button mBtnSet; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_android_anim); + + mBtnTranslate = (Button) findViewById(R.id.btn_translate); + mBtnTranslate.setOnClickListener(this); + + mBtnScale = (Button) findViewById(R.id.btn_scale); + mBtnScale.setOnClickListener(this); + + mBtnRotate = (Button) findViewById(R.id.btn_rotate); + mBtnRotate.setOnClickListener(this); + + mBtnAlpha = (Button) findViewById(R.id.btn_alpha); + mBtnAlpha.setOnClickListener(this); + + mBtnSet = (Button) findViewById(R.id.btn_set); + mBtnSet.setOnClickListener(this); + + } + + @Override + public void onClick(View v) { + int viewId = v.getId(); + if (viewId == R.id.btn_translate) {//偏移动画 + //TranslateAnimation translateAnim = new TranslateAnimation(0, 500, 0, 500); + /*TranslateAnimation translateAnim = new TranslateAnimation(Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 500, Animation.ABSOLUTE, 0, + Animation.ABSOLUTE, 500);*/ + TranslateAnimation translateAnim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 1.0f, Animation.RELATIVE_TO_PARENT, 0, + Animation.RELATIVE_TO_PARENT, 1.0f); + translateAnim.setDuration(2000); + mBtnTranslate.startAnimation(translateAnim); + //translateAnim.setFillAfter(true);//保持动画效果 + + } else if (viewId == R.id.btn_scale) {//缩放动画 + + //ScaleAnimation scaleAnim = new ScaleAnimation(0.5f, 1, 0.5f, 1); + //ScaleAnimation scaleAnim = new ScaleAnimation(0.5f, 1, 0.5f, 1, 300, 300); + ScaleAnimation scaleAnim = new ScaleAnimation(0.5f, 1, 0.5f, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); + scaleAnim.setDuration(1000); + mBtnScale.startAnimation(scaleAnim); + + } else if (viewId == R.id.btn_rotate) {//旋转动画 + + //RotateAnimation rotateAnim = new RotateAnimation(0, 360); + //RotateAnimation rotateAnim = new RotateAnimation(0, 360, 100, 100); + RotateAnimation rotateAnim = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); + rotateAnim.setDuration(2000); + mBtnRotate.startAnimation(rotateAnim); + + } else if (viewId == R.id.btn_alpha) {//透明度动画 + + AlphaAnimation alphaAnim = new AlphaAnimation(0, 1); + alphaAnim.setDuration(2000); + mBtnAlpha.startAnimation(alphaAnim); + + } else if (viewId == R.id.btn_set) {//动画合集 + + AnimationSet animSet = new AnimationSet(true); + animSet.setDuration(2000); + RotateAnimation rotateAnim = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); + animSet.addAnimation(rotateAnim); + AlphaAnimation alphaAnim = new AlphaAnimation(0, 1); + animSet.addAnimation(alphaAnim); + mBtnSet.startAnimation(animSet); + + } + + } +} diff --git a/src/main/java/com/clock/study/activity/MainActivity.java b/src/main/java/com/clock/study/activity/MainActivity.java index 0637f11..3c26506 100644 --- a/src/main/java/com/clock/study/activity/MainActivity.java +++ b/src/main/java/com/clock/study/activity/MainActivity.java @@ -15,6 +15,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); findViewById(R.id.btn_camera_take_photo).setOnClickListener(this); + findViewById(R.id.btn_android_anim).setOnClickListener(this); } @Override @@ -23,6 +24,9 @@ public void onClick(View v) { if (viewId == R.id.btn_camera_take_photo) { Intent takePhotoIntent = new Intent(this, CapturePhotoActivity.class); startActivity(takePhotoIntent); + } else if (viewId == R.id.btn_android_anim) { + Intent androidAnimIntent = new Intent(this, AndroidAnimActivity.class); + startActivity(androidAnimIntent); } } } diff --git a/src/main/res/layout/activity_android_anim.xml b/src/main/res/layout/activity_android_anim.xml new file mode 100644 index 0000000..1804f66 --- /dev/null +++ b/src/main/res/layout/activity_android_anim.xml @@ -0,0 +1,40 @@ + + + +