// Path: app/src/main/java/com/luciofm/ifican/app/util/ActivityFinishEvent.java
// public class ActivityFinishEvent {
// }
// 
// Path: app/src/main/java/com/luciofm/ifican/app/util/Utils.java
// public class Utils {
// 
//     private static final int ANIM_DURATION = 800;
// 
//     private Utils() {
//     }
// 
//     public static void startGif(GifImageView view) {
//         GifDrawable drawable = (GifDrawable) view.getDrawable();
//         if (!drawable.isPlaying()) {
//             drawable.reset();
//             drawable.start();
//         }
//     }
// 
//     public static void stopGif(GifImageView view) {
//         GifDrawable drawable = (GifDrawable) view.getDrawable();
//         if (drawable.isPlaying())
//             drawable.stop();
//     }
// 
//     public static void dispatchTouch(View view) {
//         dispatchTouch(view, 200);
//     }
// 
//     public static void dispatchTouch(final View view, final long duration) {
//         final long downTime = SystemClock.uptimeMillis();
//         final long eventTime = SystemClock.uptimeMillis();
//         final float x = 0.0f;
//         final float y = 0.0f;
//         // List of meta states found here: developer.android.com/reference/android/view/KeyEvent.html#getMetaState()
//         final int metaState = 0;
//         MotionEvent motionEvent = MotionEvent.obtain(downTime,
//                                                      eventTime,
//                                                      MotionEvent.ACTION_DOWN,
//                                                      x,
//                                                      y,
//                                                      metaState);
// 
//         // Dispatch touch event to view
//         view.dispatchTouchEvent(motionEvent);
// 
//         new Handler().postDelayed(new Runnable() {
//             @Override
//             public void run() {
//                 MotionEvent motionEvent = MotionEvent.obtain(downTime + duration,
//                                                              eventTime + duration,
//                                                              MotionEvent.ACTION_UP,
//                                                              x,
//                                                              y,
//                                                              metaState);
//                 view.dispatchTouchEvent(motionEvent);
//             }
//         }, duration);
//     }
// 
//     public static long calcDuration(int position) {
//         int pos = position;
//         if (pos >= 4)
//             pos -= 4;
//         switch (pos) {
//             case 1:
//                 return (long) (ANIM_DURATION + (ANIM_DURATION * 0.2f));
//             case 2:
//                 return (long) (ANIM_DURATION + (ANIM_DURATION * 0.3f));
//             case 3:
//                 return (long) (ANIM_DURATION + (ANIM_DURATION * 0.4f));
//             default:
//                 return ANIM_DURATION;
//         }
//     }
// }


import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import com.luciofm.ifican.app.BaseFragment;
import com.luciofm.ifican.app.IfICan;
import com.luciofm.ifican.app.R;
import com.luciofm.ifican.app.anim.XFractionProperty;
import com.luciofm.ifican.app.anim.YFractionProperty;
import com.luciofm.ifican.app.util.ActivityFinishEvent;
import com.luciofm.ifican.app.util.Dog;
import com.luciofm.ifican.app.util.Utils;
import com.luciofm.ifican.app.util.ViewInfo;
import com.squareup.otto.Subscribe;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
        switch (++currentStep) {
            case 2:
                //Utils.dispatchTouch(grid.getChildAt(grid.getChildCount() - 1));
                int position = new Random().nextInt(grid.getChildCount());
                clickListener.onItemClick(grid, grid.getChildAt(position), position, 0);
                break;
            case 3:
                ((MainActivity) getActivity()).nextFragment();
                break;
        }
    }

    AdapterView.OnItemClickListener clickListener = new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Dog dog = (Dog) view.getTag();
            ViewInfo info = new ViewInfo(view, position);
            currentView = view;
            currentView.animate().alpha(0f).setDuration(50);
            currentPosition = position;

            Intent intent = new Intent(getActivity(), TransitionActivity.class);
            intent.putExtra("DOG", dog);
            intent.putExtra("INFO", info);
            startActivityForResult(intent, REQUEST_CODE);
            getActivity().overridePendingTransition(0, 0);
        }
    };

    @Subscribe
// Path: app/src/main/java/com/luciofm/ifican/app/util/ActivityFinishEvent.java
// public class ActivityFinishEvent {
// }
// 
// Path: app/src/main/java/com/luciofm/ifican/app/util/Utils.java
// public class Utils {
// 
//     private static final int ANIM_DURATION = 800;
// 
//     private Utils() {
//     }
// 
//     public static void startGif(GifImageView view) {
//         GifDrawable drawable = (GifDrawable) view.getDrawable();
//         if (!drawable.isPlaying()) {
//             drawable.reset();
//             drawable.start();
//         }
//     }
// 
//     public static void stopGif(GifImageView view) {
//         GifDrawable drawable = (GifDrawable) view.getDrawable();
//         if (drawable.isPlaying())
//             drawable.stop();
//     }
// 
//     public static void dispatchTouch(View view) {
//         dispatchTouch(view, 200);
//     }
// 
//     public static void dispatchTouch(final View view, final long duration) {
//         final long downTime = SystemClock.uptimeMillis();
//         final long eventTime = SystemClock.uptimeMillis();
//         final float x = 0.0f;
//         final float y = 0.0f;
//         // List of meta states found here: developer.android.com/reference/android/view/KeyEvent.html#getMetaState()
//         final int metaState = 0;
//         MotionEvent motionEvent = MotionEvent.obtain(downTime,
//                                                      eventTime,
//                                                      MotionEvent.ACTION_DOWN,
//                                                      x,
//                                                      y,
//                                                      metaState);
// 
//         // Dispatch touch event to view
//         view.dispatchTouchEvent(motionEvent);
// 
//         new Handler().postDelayed(new Runnable() {
//             @Override
//             public void run() {
//                 MotionEvent motionEvent = MotionEvent.obtain(downTime + duration,
//                                                              eventTime + duration,
//                                                              MotionEvent.ACTION_UP,
//                                                              x,
//                                                              y,
//                                                              metaState);
//                 view.dispatchTouchEvent(motionEvent);
//             }
//         }, duration);
//     }
// 
//     public static long calcDuration(int position) {
//         int pos = position;
//         if (pos >= 4)
//             pos -= 4;
//         switch (pos) {
//             case 1:
//                 return (long) (ANIM_DURATION + (ANIM_DURATION * 0.2f));
//             case 2:
//                 return (long) (ANIM_DURATION + (ANIM_DURATION * 0.3f));
//             case 3:
//                 return (long) (ANIM_DURATION + (ANIM_DURATION * 0.4f));
//             default:
//                 return ANIM_DURATION;
//         }
//     }
// }


// Path: app/src/main/java/com/luciofm/ifican/app/ui/ActivityTransitionsCodeFragment.java
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import com.luciofm.ifican.app.BaseFragment;
import com.luciofm.ifican.app.IfICan;
import com.luciofm.ifican.app.R;
import com.luciofm.ifican.app.anim.XFractionProperty;
import com.luciofm.ifican.app.anim.YFractionProperty;
import com.luciofm.ifican.app.util.ActivityFinishEvent;
import com.luciofm.ifican.app.util.Dog;
import com.luciofm.ifican.app.util.Utils;
import com.luciofm.ifican.app.util.ViewInfo;
import com.squareup.otto.Subscribe;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

        switch (++currentStep) {
            case 2:
                //Utils.dispatchTouch(grid.getChildAt(grid.getChildCount() - 1));
                int position = new Random().nextInt(grid.getChildCount());
                clickListener.onItemClick(grid, grid.getChildAt(position), position, 0);
                break;
            case 3:
                ((MainActivity) getActivity()).nextFragment();
                break;
        }
    }

    AdapterView.OnItemClickListener clickListener = new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Dog dog = (Dog) view.getTag();
            ViewInfo info = new ViewInfo(view, position);
            currentView = view;
            currentView.animate().alpha(0f).setDuration(50);
            currentPosition = position;

            Intent intent = new Intent(getActivity(), TransitionActivity.class);
            intent.putExtra("DOG", dog);
            intent.putExtra("INFO", info);
            startActivityForResult(intent, REQUEST_CODE);
            getActivity().overridePendingTransition(0, 0);
        }
    };

    @Subscribe
    public void onActivityFinishedEvent(ActivityFinishEvent event) {