// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/adapter/TutorialAdapter.java
// public class TutorialAdapter extends PagerAdapter {
// 
//     private final Activity mActivity;
//     private final Tutorial[] mTutorials;
//     private final ListColor[] colors = ListColor.values();
//     private final boolean mStartActivity;
// 
//     public TutorialAdapter(Activity activity, boolean startActivity) {
//         mActivity = activity;
//         mTutorials = Tutorial.values();
//         this.mStartActivity = startActivity;
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public int getCount() {
//         return mTutorials.length;
//     }
// 
// 
//     private Tutorial getItem(int position) {
//         return mTutorials[position];
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public Object instantiateItem(ViewGroup container, final int position) {
// 
//         SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mActivity);
//         boolean SkipTutorial = prefs.getBoolean("SkipTutorial",false);
// 
//         LayoutInflater inflater = (LayoutInflater) container.getContext()
//                 .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// 
//         Tutorial tutorial = getItem(position);
// 
// 
//         View convertView;
//         if (tutorial.isLastScreen()) {
//             convertView = inflater.inflate(R.layout.tutorial_layout_finish, null);
// 
//             convertView.findViewById(R.id.finish_tutorial_button).setOnClickListener(new View.OnClickListener() {
//                 @Override
//                 public void onClick(View v) {
//                     if (mStartActivity) {
//                         mActivity.startActivity(new Intent(mActivity, HomeActivity.class));
//                     }
//                     mActivity.finish();
//                 }
//             });
//         } else {
//             convertView = inflater.inflate(R.layout.tutorial_layout, null);
//             View skip_button = convertView.findViewById(R.id.skip_button);
//             skip_button.setVisibility(View.GONE);
//             ImageView deviceImage = (ImageView) convertView
//                     .findViewById(R.id.device_image);
//             TextView title = (TextView) convertView
//                     .findViewById(R.id.tutorial_title);
//             TextView description = (TextView) convertView
//                     .findViewById(R.id.tutorial_desc);
// 
//             int color = colors[position % colors.length].getColor();
// 
//             convertView.findViewById(R.id.tutorial_layout).setBackgroundColor(color);
// 
//             deviceImage.setImageResource(tutorial.getImage());
//             title.setText(tutorial.getTitle());
//             description.setText(tutorial.getDescription());
//             if(!SkipTutorial) {
//                 skip_button.setVisibility(View.VISIBLE);
//             }
//             convertView.findViewById(R.id.skip_button).setOnClickListener(new View.OnClickListener() {
//                 @Override
//                 public void onClick(View v) {
//                     if (mStartActivity) {
//                         mActivity.startActivity(new Intent(mActivity, HomeActivity.class));
//                     }
//                     mActivity.finish();
//                 }
//             });
//         }
//         container.addView(convertView, 0);
// 
//         return convertView;
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public boolean isViewFromObject(View view, Object object) {
//         return view.equals(object);
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public void destroyItem(ViewGroup container, int position, Object object) {
//         container.removeView((ViewGroup) object);
//     }
// 
//     private enum ListColor {
//         BLUE("#29A6D4"),
//         GREEN("#1C7D6C"),
//         ORANGE("#F77400"),
//         RED("#F53B3C"),
//         GRAYISH("#78909C"),
//         PURPLE("#AB47BC"),
//         YELLOW("#F9A01E");
// 
//         private
//         @ColorRes
//         final
//         int color;
// 
//         ListColor(String colorCode) {
//             this.color = Color.parseColor(colorCode);
//         }
// 
//         public int getColor() {
//             return color;
//         }
//     }
// 
// }
// 
// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/constant/Constants.java
// public class
// Constants {
// 
//     public final static String BUILD_M_LEARN_PATH = "/BuildmLearn/";
//     public final static String UNZIP = BUILD_M_LEARN_PATH + "unzipped/";
//     public final static String APK_DIR = BUILD_M_LEARN_PATH + "apk/";
//     public final static String SAVED_DIR = BUILD_M_LEARN_PATH + "saved/";
//     public final static String DRAFT_DIR = BUILD_M_LEARN_PATH + "draft/";
//     public final static String TEMPLATE_ID = "TEMPLATE_ID";
//     public final static String TEMPLATE_OBJECT = "TEMPLATE_OBJECT";
//     public final static String SIMULATOR_FILE_PATH = "SIMULATOR_FILE_PATH";
//     public final static String PROJECT_FILE_PATH = "PROJECT_FILE_PATH";
//     public final static String START_ACTIVITY = "START_ACTIVITY";
//     public final static String START_FRAGMENT = "START_FRAGMENT";
// 
// 
// }


import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.util.TypedValue;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.buildmlearn.toolkit.R;
import org.buildmlearn.toolkit.adapter.TutorialAdapter;
import org.buildmlearn.toolkit.constant.Constants;
import org.buildmlearn.toolkit.model.Tutorial;
package org.buildmlearn.toolkit.activity;





/**
 * @brief Shows the tutorial related to BuildmLearn toolkit usage.
 */
public class TutorialActivity extends AppCompatActivity {


    private LinearLayout indicatingDotsContainer;

    /**
     * {@inheritDoc}
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tutorial);

// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/adapter/TutorialAdapter.java
// public class TutorialAdapter extends PagerAdapter {
// 
//     private final Activity mActivity;
//     private final Tutorial[] mTutorials;
//     private final ListColor[] colors = ListColor.values();
//     private final boolean mStartActivity;
// 
//     public TutorialAdapter(Activity activity, boolean startActivity) {
//         mActivity = activity;
//         mTutorials = Tutorial.values();
//         this.mStartActivity = startActivity;
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public int getCount() {
//         return mTutorials.length;
//     }
// 
// 
//     private Tutorial getItem(int position) {
//         return mTutorials[position];
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public Object instantiateItem(ViewGroup container, final int position) {
// 
//         SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mActivity);
//         boolean SkipTutorial = prefs.getBoolean("SkipTutorial",false);
// 
//         LayoutInflater inflater = (LayoutInflater) container.getContext()
//                 .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// 
//         Tutorial tutorial = getItem(position);
// 
// 
//         View convertView;
//         if (tutorial.isLastScreen()) {
//             convertView = inflater.inflate(R.layout.tutorial_layout_finish, null);
// 
//             convertView.findViewById(R.id.finish_tutorial_button).setOnClickListener(new View.OnClickListener() {
//                 @Override
//                 public void onClick(View v) {
//                     if (mStartActivity) {
//                         mActivity.startActivity(new Intent(mActivity, HomeActivity.class));
//                     }
//                     mActivity.finish();
//                 }
//             });
//         } else {
//             convertView = inflater.inflate(R.layout.tutorial_layout, null);
//             View skip_button = convertView.findViewById(R.id.skip_button);
//             skip_button.setVisibility(View.GONE);
//             ImageView deviceImage = (ImageView) convertView
//                     .findViewById(R.id.device_image);
//             TextView title = (TextView) convertView
//                     .findViewById(R.id.tutorial_title);
//             TextView description = (TextView) convertView
//                     .findViewById(R.id.tutorial_desc);
// 
//             int color = colors[position % colors.length].getColor();
// 
//             convertView.findViewById(R.id.tutorial_layout).setBackgroundColor(color);
// 
//             deviceImage.setImageResource(tutorial.getImage());
//             title.setText(tutorial.getTitle());
//             description.setText(tutorial.getDescription());
//             if(!SkipTutorial) {
//                 skip_button.setVisibility(View.VISIBLE);
//             }
//             convertView.findViewById(R.id.skip_button).setOnClickListener(new View.OnClickListener() {
//                 @Override
//                 public void onClick(View v) {
//                     if (mStartActivity) {
//                         mActivity.startActivity(new Intent(mActivity, HomeActivity.class));
//                     }
//                     mActivity.finish();
//                 }
//             });
//         }
//         container.addView(convertView, 0);
// 
//         return convertView;
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public boolean isViewFromObject(View view, Object object) {
//         return view.equals(object);
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public void destroyItem(ViewGroup container, int position, Object object) {
//         container.removeView((ViewGroup) object);
//     }
// 
//     private enum ListColor {
//         BLUE("#29A6D4"),
//         GREEN("#1C7D6C"),
//         ORANGE("#F77400"),
//         RED("#F53B3C"),
//         GRAYISH("#78909C"),
//         PURPLE("#AB47BC"),
//         YELLOW("#F9A01E");
// 
//         private
//         @ColorRes
//         final
//         int color;
// 
//         ListColor(String colorCode) {
//             this.color = Color.parseColor(colorCode);
//         }
// 
//         public int getColor() {
//             return color;
//         }
//     }
// 
// }
// 
// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/constant/Constants.java
// public class
// Constants {
// 
//     public final static String BUILD_M_LEARN_PATH = "/BuildmLearn/";
//     public final static String UNZIP = BUILD_M_LEARN_PATH + "unzipped/";
//     public final static String APK_DIR = BUILD_M_LEARN_PATH + "apk/";
//     public final static String SAVED_DIR = BUILD_M_LEARN_PATH + "saved/";
//     public final static String DRAFT_DIR = BUILD_M_LEARN_PATH + "draft/";
//     public final static String TEMPLATE_ID = "TEMPLATE_ID";
//     public final static String TEMPLATE_OBJECT = "TEMPLATE_OBJECT";
//     public final static String SIMULATOR_FILE_PATH = "SIMULATOR_FILE_PATH";
//     public final static String PROJECT_FILE_PATH = "PROJECT_FILE_PATH";
//     public final static String START_ACTIVITY = "START_ACTIVITY";
//     public final static String START_FRAGMENT = "START_FRAGMENT";
// 
// 
// }


// Path: source-code/app/src/main/java/org/buildmlearn/toolkit/activity/TutorialActivity.java
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.util.TypedValue;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.buildmlearn.toolkit.R;
import org.buildmlearn.toolkit.adapter.TutorialAdapter;
import org.buildmlearn.toolkit.constant.Constants;
import org.buildmlearn.toolkit.model.Tutorial;

package org.buildmlearn.toolkit.activity;





/**
 * @brief Shows the tutorial related to BuildmLearn toolkit usage.
 */
public class TutorialActivity extends AppCompatActivity {


    private LinearLayout indicatingDotsContainer;

    /**
     * {@inheritDoc}
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tutorial);

        TutorialAdapter mAdapter = new TutorialAdapter(this, getIntent().getBooleanExtra(Constants.START_ACTIVITY, false));