package ml.puredark.hviewer.activities;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.graphics.drawable.DrawerArrowDrawable;
import android.support.v7.widget.Toolbar;
import android.view.MotionEvent;
import android.widget.ImageView;

import com.nineoldandroids.animation.Animator;

import butterknife.BindView;
import ml.puredark.hviewer.R;
import ml.puredark.hviewer.customs.AnimationOnActivity;

public class AddFeedActivity extends AppCompatActivity {
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.btn_return)
    ImageView btnReturn;
    private DrawerArrowDrawable btnReturnIcon;
    //是否动画中
    private boolean animating = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_feed);

        /* 为返回按钮加载图标 */
        btnReturnIcon = new DrawerArrowDrawable(this);
        btnReturnIcon.setColor(getResources().getColor(R.color.white));
        btnReturn.setImageDrawable(btnReturnIcon);
        btnReturnIcon.setProgress(1f);
    }


    @Override
    public void onBackPressed() {
        if (animating)
            return;
        else
            AnimationOnActivity.reverse(btnReturnIcon, new Animator.AnimatorListener() {
                @Override
                public void onAnimationStart(Animator animation) {
                    animating = true;
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    animating = false;
                    finish();
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                    animating = false;
                }

                @Override
                public void onAnimationRepeat(Animator animation) {
                }
            });
        //super.onBackPressed();
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        if (animating) return false;
        return super.dispatchTouchEvent(event);
    }
}

@@ -360,16 +360,76 @@
 ndView;%0A
+import butterknife.ButterKnife;%0Aimport butterknife.OnClick;%0A
 import m
@@ -450,16 +450,16 @@
 ewer.R;%0A
-
 import m
@@ -934,16 +934,151 @@
 d_feed);
+%0A        ButterKnife.bind(this);%0A        setSupportActionBar(toolbar);%0A        getSupportActionBar().setDisplayShowTitleEnabled(false);
 %0A%0A      
@@ -1319,16 +1319,94 @@
 %0A    %7D%0A%0A
+    @OnClick(R.id.btn_return)%0A    void back()%7B%0A        onBackPressed();%0A    %7D%0A
 %0A    @Ov

Add an empty AddFeedActivity