<commit_before>package com.bedrock.padder.activity;

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.media.AudioManager;
import android.media.SoundPool;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.Toast;

import com.afollestad.materialdialogs.MaterialDialog;
import com.bedrock.padder.R;
import com.bedrock.padder.fragment.AboutFragment;
import com.bedrock.padder.fragment.SettingsFragment;
import com.bedrock.padder.helper.AdmobHelper;
import com.bedrock.padder.helper.AnimateHelper;
import com.bedrock.padder.helper.FabHelper;
import com.bedrock.padder.helper.FileHelper;
import com.bedrock.padder.helper.IntentHelper;
import com.bedrock.padder.helper.SoundHelper;
import com.bedrock.padder.helper.ToolbarHelper;
import com.bedrock.padder.helper.TutorialHelper;
import com.bedrock.padder.helper.WindowHelper;
import com.bedrock.padder.model.FirebaseMetadata;
import com.bedrock.padder.model.about.About;
import com.bedrock.padder.model.about.Bio;
import com.bedrock.padder.model.about.Detail;
import com.bedrock.padder.model.about.Item;
import com.bedrock.padder.model.app.theme.ColorData;
import com.bedrock.padder.model.preset.Music;
import com.bedrock.padder.model.preset.Preset;
import com.google.gson.Gson;

import java.io.File;

import static com.bedrock.padder.helper.FirebaseHelper.PROJECT_LOCATION_PRESETS;
import static com.bedrock.padder.helper.WindowHelper.APPLICATION_ID;

@TargetApi(14)
@SuppressWarnings("deprecation")

public class MainActivity
        extends AppCompatActivity
        implements AboutFragment.OnFragmentInteractionListener, SettingsFragment.OnFragmentInteractionListener {

    public static final String TAG = "MainActivity";
    public static final String PRESET_KEY = "savedPreset";
    public static boolean isPresetLoading = false;
    public static boolean isPresetVisible = false;
    public static boolean isPresetChanged = false;
    public static boolean isTutorialVisible = false;
    public static boolean isAboutVisible = false;
    public static boolean isSettingVisible = false;
    public static boolean isDeckShouldCleared = false;
    public static Preset preset;
    public static Preset currentPreset = null;
    // Used for circularReveal
    // End two is for settings coordination
    public static int coord[] = {0, 0, 0, 0};
    final AppCompatActivity a = this;
    final String qs = "quickstart";
    public boolean tgl1 = false;
    public boolean tgl2 = false;
    public boolean tgl3 = false;
    public boolean tgl4 = false;
    public boolean tgl5 = false;
    public boolean tgl6 = false;
    public boolean tgl7 = false;
    public boolean tgl8 = false;
    int currentVersionCode;
    int themeColor = R.color.hello;
    int color = R.color.cyan_400;
    int toggleSoundId = 0;
    int togglePatternId = 0;
    private SharedPreferences prefs = null;
    private AnimateHelper anim = new AnimateHelper();
    private SoundHelper sound = new SoundHelper();
    private WindowHelper w = new WindowHelper();
    private FabHelper fab = new FabHelper();
    private ToolbarHelper toolbar = new ToolbarHelper();
    private TutorialHelper tut = new TutorialHelper();
    private IntentHelper intent = new IntentHelper();
    private AdmobHelper ad = new AdmobHelper();
    private FileHelper file = new FileHelper();
    private boolean doubleBackToExitPressedOnce = false;
    private boolean isToolbarVisible = false;
    private boolean isSettingsFromMenu = false;
    private int circularRevealDuration = 400;
    private int fadeAnimDuration = 200;
//    private MaterialTapTargetPrompt promptToggle;   // 1
//    private MaterialTapTargetPrompt promptButton;   // 2
//    private MaterialTapTargetPrompt promptSwipe;    // 3
//    private MaterialTapTargetPrompt promptLoop;     // 4
//    private MaterialTapTargetPrompt promptPattern;  // 5
//    private MaterialTapTargetPrompt promptFab;      // 6
//    private MaterialTapTargetPrompt promptPreset;   // 7
//    private MaterialTapTargetPrompt promptInfo;     // 8
//    private MaterialTapTargetPrompt promptTutorial; // 9

    private Gson gson = new Gson();

    // TODO TAP launch
    //IabHelper mHelper;
    //IabBroadcastReceiver mBroadcastReceiver;

    public static void largeLog(String tag, String content) {
        if (content.length() > 4000) {
            Log.d(tag, content.substring(0, 4000));
            largeLog(tag, content.substring(4000));
        } else {
            Log.d(tag, content);
        }
    }

    public static void showSettingsFragment(AppCompatActivity a) {
        a.getSupportFragmentManager()
                .beginTransaction()
                .add(R.id.fragment_settings_container, new SettingsFragment())
                .commit();
        WindowHelper w = new WindowHelper();
        w.getView(R.id.fragment_settings_container, a).setVisibility(View.VISIBLE);
        setSettingVisible(true);
        w.setRecentColor(R.string.settings, 0, R.color.colorAccent, a);
    }

    public static void setSettingVisible(boolean isVisible) {
        isSettingVisible = isVisible;
        Log.d("SettingVisible", String.valueOf(isSettingVisible));
    }

    public static void setAboutVisible(boolean isVisible) {
        isAboutVisible = isVisible;
        Log.d("AboutVisible", String.valueOf(isAboutVisible));
    }

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

        // TODO remove
        intent.intent(a, "activity.PresetStoreActivity");

        makeJson();

        // TODO IAP launch<commit_msg>Removed quickmove<commit_after>package com.bedrock.padder.activity;

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.media.AudioManager;
import android.media.SoundPool;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.Toast;

import com.afollestad.materialdialogs.MaterialDialog;
import com.bedrock.padder.R;
import com.bedrock.padder.fragment.AboutFragment;
import com.bedrock.padder.fragment.SettingsFragment;
import com.bedrock.padder.helper.AdmobHelper;
import com.bedrock.padder.helper.AnimateHelper;
import com.bedrock.padder.helper.FabHelper;
import com.bedrock.padder.helper.FileHelper;
import com.bedrock.padder.helper.IntentHelper;
import com.bedrock.padder.helper.SoundHelper;
import com.bedrock.padder.helper.ToolbarHelper;
import com.bedrock.padder.helper.TutorialHelper;
import com.bedrock.padder.helper.WindowHelper;
import com.bedrock.padder.model.FirebaseMetadata;
import com.bedrock.padder.model.about.About;
import com.bedrock.padder.model.about.Bio;
import com.bedrock.padder.model.about.Detail;
import com.bedrock.padder.model.about.Item;
import com.bedrock.padder.model.app.theme.ColorData;
import com.bedrock.padder.model.preset.Music;
import com.bedrock.padder.model.preset.Preset;
import com.google.gson.Gson;

import java.io.File;

import static com.bedrock.padder.helper.FirebaseHelper.PROJECT_LOCATION_PRESETS;
import static com.bedrock.padder.helper.WindowHelper.APPLICATION_ID;

@TargetApi(14)
@SuppressWarnings("deprecation")

public class MainActivity
        extends AppCompatActivity
        implements AboutFragment.OnFragmentInteractionListener, SettingsFragment.OnFragmentInteractionListener {

    public static final String TAG = "MainActivity";
    public static final String PRESET_KEY = "savedPreset";
    public static boolean isPresetLoading = false;
    public static boolean isPresetVisible = false;
    public static boolean isPresetChanged = false;
    public static boolean isTutorialVisible = false;
    public static boolean isAboutVisible = false;
    public static boolean isSettingVisible = false;
    public static boolean isDeckShouldCleared = false;
    public static Preset preset;
    public static Preset currentPreset = null;
    // Used for circularReveal
    // End two is for settings coordination
    public static int coord[] = {0, 0, 0, 0};
    final AppCompatActivity a = this;
    final String qs = "quickstart";
    public boolean tgl1 = false;
    public boolean tgl2 = false;
    public boolean tgl3 = false;
    public boolean tgl4 = false;
    public boolean tgl5 = false;
    public boolean tgl6 = false;
    public boolean tgl7 = false;
    public boolean tgl8 = false;
    int currentVersionCode;
    int themeColor = R.color.hello;
    int color = R.color.cyan_400;
    int toggleSoundId = 0;
    int togglePatternId = 0;
    private SharedPreferences prefs = null;
    private AnimateHelper anim = new AnimateHelper();
    private SoundHelper sound = new SoundHelper();
    private WindowHelper w = new WindowHelper();
    private FabHelper fab = new FabHelper();
    private ToolbarHelper toolbar = new ToolbarHelper();
    private TutorialHelper tut = new TutorialHelper();
    private IntentHelper intent = new IntentHelper();
    private AdmobHelper ad = new AdmobHelper();
    private FileHelper file = new FileHelper();
    private boolean doubleBackToExitPressedOnce = false;
    private boolean isToolbarVisible = false;
    private boolean isSettingsFromMenu = false;
    private int circularRevealDuration = 400;
    private int fadeAnimDuration = 200;
//    private MaterialTapTargetPrompt promptToggle;   // 1
//    private MaterialTapTargetPrompt promptButton;   // 2
//    private MaterialTapTargetPrompt promptSwipe;    // 3
//    private MaterialTapTargetPrompt promptLoop;     // 4
//    private MaterialTapTargetPrompt promptPattern;  // 5
//    private MaterialTapTargetPrompt promptFab;      // 6
//    private MaterialTapTargetPrompt promptPreset;   // 7
//    private MaterialTapTargetPrompt promptInfo;     // 8
//    private MaterialTapTargetPrompt promptTutorial; // 9

    private Gson gson = new Gson();

    // TODO TAP launch
    //IabHelper mHelper;
    //IabBroadcastReceiver mBroadcastReceiver;

    public static void largeLog(String tag, String content) {
        if (content.length() > 4000) {
            Log.d(tag, content.substring(0, 4000));
            largeLog(tag, content.substring(4000));
        } else {
            Log.d(tag, content);
        }
    }

    public static void showSettingsFragment(AppCompatActivity a) {
        a.getSupportFragmentManager()
                .beginTransaction()
                .add(R.id.fragment_settings_container, new SettingsFragment())
                .commit();
        WindowHelper w = new WindowHelper();
        w.getView(R.id.fragment_settings_container, a).setVisibility(View.VISIBLE);
        setSettingVisible(true);
        w.setRecentColor(R.string.settings, 0, R.color.colorAccent, a);
    }

    public static void setSettingVisible(boolean isVisible) {
        isSettingVisible = isVisible;
        Log.d("SettingVisible", String.valueOf(isSettingVisible));
    }

    public static void setAboutVisible(boolean isVisible) {
        isAboutVisible = isVisible;
        Log.d("AboutVisible", String.valueOf(isAboutVisible));
    }

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

        makeJson();

        // TODO IAP launch
{'fraction_non_alphanumeric': 0.0876117919841007, 'fraction_numerical': 0.008115269956939383, 'mean_word_length': 3.7697472353870456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2495749', 'n_tokens_mistral': 3496, 'n_tokens_neox': 3378, 'n_words': 834}