package com.example.butterknife.library;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import butterknife.BindString;
import butterknife.BindView;
import butterknife.BindViews;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnItemClick;
import butterknife.OnLongClick;
import com.example.butterknife.R;

import java.util.List;

import static android.widget.Toast.LENGTH_SHORT;

public class SimpleActivity extends Activity {
  private static final ButterKnife.Action<View> ALPHA_FADE = new ButterKnife.Action<View>() {
    @Override public void apply(@NonNull View view, int index) {
      AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
      alphaAnimation.setFillBefore(true);
      alphaAnimation.setDuration(500);
      alphaAnimation.setStartOffset(index * 100);
      view.startAnimation(alphaAnimation);
    }
  };

  @BindView(R.id.title) TextView title;
  @BindView(R.id.subtitle) TextView subtitle;
  @BindView(R.id.hello) Button hello;
  @BindView(R.id.list_of_things) ListView listOfThings;
  @BindView(R.id.footer) TextView footer;
  @BindString(R.string.app_name) String butterKnife;
  @BindString(R.string.field_method) String fieldMethod;
  @BindString(R.string.by_jake_wharton) String byJakeWharton;
  @BindString(R.string.say_hello) String sayHello;

  @BindViews({ R.id.title, R.id.subtitle, R.id.hello }) List<View> headerViews;

  private SimpleAdapter adapter;

  @OnClick(R.id.hello) void sayHello() {
    Toast.makeText(this, "Hello, views!", LENGTH_SHORT).show();
    ButterKnife.apply(headerViews, ALPHA_FADE);
  }

  @OnLongClick(R.id.hello) boolean sayGetOffMe() {
    Toast.makeText(this, "Let go of me!", LENGTH_SHORT).show();
    return true;
  }

  @OnItemClick(R.id.list_of_things) void onItemClick(int position) {
    Toast.makeText(this, "You clicked: " + adapter.getItem(position), LENGTH_SHORT).show();
  }

  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.simple_activity);
    ButterKnife.bind(this);

    // Contrived code to use the bound fields.
    title.setText(butterKnife);
    subtitle.setText(fieldMethod);
    footer.setText(byJakeWharton);
    hello.setText(sayHello);

    adapter = new SimpleAdapter(this);
    listOfThings.setAdapter(adapter);
  }
}

@@ -328,16 +328,43 @@
 .Toast;%0A
+import butterknife.Action;%0A
 import b
@@ -386,16 +386,16 @@
 String;%0A
-
 import b
@@ -565,24 +565,60 @@
 nLongClick;%0A
+import butterknife.ViewCollections;%0A
 import com.e
@@ -639,17 +639,16 @@
 nife.R;%0A
-%0A
 import j
@@ -783,28 +783,16 @@
 c final 
-ButterKnife.
 Action%3CV
@@ -813,28 +813,16 @@
 E = new 
-ButterKnife.
 Action%3CV
@@ -1819,25 +1819,27 @@
     
-ButterKnife.apply
+ViewCollections.run
 (hea

Switch to ViewCollections in IT