// Path: app/src/main/java/com/bedrock/padder/helper/WindowHelper.java
// public static int getId(String id) {
//     try {
//         Class res = R.id.class;
//         Field field = res.getField(id);
//         return field.getInt(null);
//     } catch (Exception e) {
//         Log.e("getId", "Failure to get id.", e);
//         return -1;
//     }
//     //from : https://daniel-codes.blogspot.com/2009/12/dynamically-retrieving-resources-in.html
// }
// 
// Path: app/src/main/java/com/bedrock/padder/model/tutorial/TimingListener.java
// public static ArrayList<Timing> timings = new ArrayList<>();


import android.app.Activity;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.view.animation.LinearOutSlowInInterpolator;
import android.util.Log;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import com.google.gson.GsonBuilder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import static com.bedrock.padder.helper.WindowHelper.getId;
import static com.bedrock.padder.model.tutorial.TimingListener.timings;
                } else {
                    view = new TutorialView(pads[pad], new Timing(deck, pad));
                    view.setAnimation(animations[0]);
                }
            } else {
                view = new TutorialView(decks[deck - 1], new Timing(deck));
                view.setAnimation(animations[0]);
            }
            view.setDuration(duration);
            view.start();
        }
        Log.d("TUTORIAL", "show [" + deck + ", " + pad + ", " + gesture + "]");
    }

    private void init(Tutorial tutorial) {
        if (tutorial != null) {
            this.bpm = tutorial.bpm;
            this.syncs = tutorial.syncs;
            Log.i(this.getClass().getSimpleName(), "tutorial.syncs.size = " + tutorial.syncs.size());
            Log.i(this.getClass().getSimpleName(), "syncs.size = " + syncs.size());
            init();
        } else {
            Log.e(this.getClass().getSimpleName(), ".init: tutorial is null");
        }
    }

    private void init() {
        handler = new Handler(Looper.getMainLooper());

        for (int i = 0; i < decks.length; i++) {
// Path: app/src/main/java/com/bedrock/padder/helper/WindowHelper.java
// public static int getId(String id) {
//     try {
//         Class res = R.id.class;
//         Field field = res.getField(id);
//         return field.getInt(null);
//     } catch (Exception e) {
//         Log.e("getId", "Failure to get id.", e);
//         return -1;
//     }
//     //from : https://daniel-codes.blogspot.com/2009/12/dynamically-retrieving-resources-in.html
// }
// 
// Path: app/src/main/java/com/bedrock/padder/model/tutorial/TimingListener.java
// public static ArrayList<Timing> timings = new ArrayList<>();


// Path: app/src/main/java/com/bedrock/padder/model/tutorial/Tutorial.java
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.view.animation.LinearOutSlowInInterpolator;
import android.util.Log;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import com.google.gson.GsonBuilder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import static com.bedrock.padder.helper.WindowHelper.getId;
import static com.bedrock.padder.model.tutorial.TimingListener.timings;

                } else {
                    view = new TutorialView(pads[pad], new Timing(deck, pad));
                    view.setAnimation(animations[0]);
                }
            } else {
                view = new TutorialView(decks[deck - 1], new Timing(deck));
                view.setAnimation(animations[0]);
            }
            view.setDuration(duration);
            view.start();
        }
        Log.d("TUTORIAL", "show [" + deck + ", " + pad + ", " + gesture + "]");
    }

    private void init(Tutorial tutorial) {
        if (tutorial != null) {
            this.bpm = tutorial.bpm;
            this.syncs = tutorial.syncs;
            Log.i(this.getClass().getSimpleName(), "tutorial.syncs.size = " + tutorial.syncs.size());
            Log.i(this.getClass().getSimpleName(), "syncs.size = " + syncs.size());
            init();
        } else {
            Log.e(this.getClass().getSimpleName(), ".init: tutorial is null");
        }
    }

    private void init() {
        handler = new Handler(Looper.getMainLooper());

        for (int i = 0; i < decks.length; i++) {
            decks[i] = activity.findViewById(getId("tgl" + String.valueOf(i + 1) + "_tutorial"));