package com.andyiac.talkischeap.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.ImageView;
import android.widget.Toast;

import com.andyiac.talkischeap.R;

/**
 * Created by andyiac on 16/4/5.
 */
public class ScaleAnimationActivity extends AppCompatActivity {

    private ImageView imageView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.scale_animation_activity);
        initView();
    }

    private void initView() {
        imageView = (ImageView) findViewById(R.id.image_view);
    }


    public void onClickBegin(View view) {
        Toast.makeText(ScaleAnimationActivity.this, "begin", Toast.LENGTH_SHORT).show();

        scaleView(imageView, 0.5f, 0.5f);


    }

    public void onClickStop(View view) {
        Toast.makeText(ScaleAnimationActivity.this, "stop show", Toast.LENGTH_SHORT).show();
        scaleView(imageView, 1.0f, 1.0f);
    }


    // 居中 等比 缩放
    public void scaleView(View v, float startScale, float endScale) {
        Animation anim = new ScaleAnimation(
                startScale, endScale, // Start and end values for the X axis scaling
                startScale, endScale, // Start and end values for the Y axis scaling
                Animation.RELATIVE_TO_SELF, 0.5f, // Pivot point of X scaling
                Animation.RELATIVE_TO_SELF, 0.5f); // Pivot point of Y scaling
        anim.setFillAfter(true); // Needed to keep the result of the animation
        anim.setDuration(2000);
        v.startAnimation(anim);
    }

}

@@ -1555,32 +1555,45 @@
 int of X scaling
+  // %E4%B8%AD%E5%BF%83%E7%82%B9 of X
 %0A               
@@ -1647,32 +1647,44 @@
 int of Y scaling
+ // %E4%B8%AD%E5%BF%83%E7%82%B9 of Y
 %0A        anim.se
@@ -1811,17 +1811,339 @@
 (anim);%0A
-
     %7D%0A%0A
+%0A    /**%0A%0A     fromX%EF%BC%9A%E8%B5%B7%E5%A7%8BX%E5%9D%90%E6%A0%87%E4%B8%8A%E7%9A%84%E4%BC%B8%E7%BC%A9%E5%B0%BA%E5%AF%B8%E3%80%82%0A%0A     toX%EF%BC%9A%E7%BB%93%E6%9D%9FX%E5%9D%90%E6%A0%87%E4%B8%8A%E7%9A%84%E4%BC%B8%E7%BC%A9%E5%B0%BA%E5%AF%B8%E3%80%82%0A%0A     fromY%EF%BC%9A%E8%B5%B7%E5%A7%8BY%E5%9D%90%E6%A0%87%E4%B8%8A%E7%9A%84%E4%BC%B8%E7%BC%A9%E5%B0%BA%E5%AF%B8%E3%80%82%0A%0A     toY%EF%BC%9A%E7%BB%93%E6%9D%9FY%E5%9D%90%E6%A0%87%E4%B8%8A%E7%9A%84%E4%BC%B8%E7%BC%A9%E5%B0%BA%E5%AF%B8%E3%80%82%0A%0A     pivotXType%EF%BC%9AX%E8%BD%B4%E7%9A%84%E4%BC%B8%E7%BC%A9%E6%A8%A1%E5%BC%8F%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%8F%96%E5%80%BC%E4%B8%BAABSOLUTE%E3%80%81RELATIVE_TO_SELF%E3%80%81RELATIVE_TO_PARENT%E3%80%82%0A%0A     pivotXValue%EF%BC%9AX%E5%9D%90%E6%A0%87%E7%9A%84%E4%BC%B8%E7%BC%A9%E5%80%BC%E3%80%82%0A%0A     pivotYType%EF%BC%9AY%E8%BD%B4%E7%9A%84%E4%BC%B8%E7%BC%A9%E6%A8%A1%E5%BC%8F%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%8F%96%E5%80%BC%E4%B8%BAABSOLUTE%E3%80%81RELATIVE_TO_SELF%E3%80%81RELATIVE_TO_PARENT%E3%80%82%0A%0A     pivotYValue%EF%BC%9AY%E5%9D%90%E6%A0%87%E7%9A%84%E4%BC%B8%E7%BC%A9%E5%80%BC%E3%80%82%0A%0A     */%0A%0A%0A
 %7D%0A

scale image view