// Path: app/src/main/java/com/icecream/snorlax/app/SnorlaxApp.java
// public class SnorlaxApp extends Application {
// 
// 	public static boolean isEnabled() {
// 		return false;
// 	}
// 
// 	@Override
// 	public void onCreate() {
// 		super.onCreate();
// 
// 		if (BuildConfig.DEBUG) {
// 			Timber.plant(new Timber.DebugTree());
// 		}
// 	}
// }
// 
// Path: app/src/main/java/com/icecream/snorlax/app/settings/SettingsFragment.java
// @SuppressWarnings({"unused", "FieldCanBeLocal", "WeakerAccess"})
// public class SettingsFragment extends PreferenceFragmentCompat {
// 
// 	private SettingsReadable mSettingsReadable;
// 
// 	@Override
// 	public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
// 		addPreferencesFromResource(preferences);
// 	}
// 
// 	@Override
// 	public void onActivityCreated(Bundle savedInstanceState) {
// 		super.onActivityCreated(savedInstanceState);
// 
// 		setDivider(new ColorDrawable(Color.TRANSPARENT));
// 		setDividerHeight(0);
// 
// 		getListView().setPadding(0, 0, 0, getActivity().getResources().getDimensionPixelSize(R.dimen.padding_list_bottom));
// 	}
// 
// 	@Override
// 	public void onPause() {
// 		super.onPause();
// 		SettingsReadable settingsReadable = new SettingsReadable(
// 			getActivity().getApplicationInfo(),
// 			getPreferenceManager()
// 		);
// 
// 		settingsReadable
// 			.setReadable()
// 			.subscribe(Timber::d, throwable -> {
// 				Timber.e(throwable);
// 				showReadableError();
// 			});
// 	}
// 
// 	private void showReadableError() {
// 		if (getActivity() != null) {
// 			Toast.makeText(getActivity(), R.string.error_readable, Toast.LENGTH_LONG).show();
// 		}
// 	}
// }


import java.util.concurrent.TimeUnit;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.preference.PreferenceManager;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.icecream.snorlax.BuildConfig;
import com.icecream.snorlax.R;
import com.icecream.snorlax.app.SnorlaxApp;
import com.icecream.snorlax.app.settings.SettingsFragment;
import com.jakewharton.rxbinding.view.RxView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import rx.Observable;
import static com.icecream.snorlax.R.xml.preferences;
						return Snackbar.make(mFab, R.string.error_xposed_missing, Snackbar.LENGTH_LONG);
					}
				})
				.subscribe(Snackbar::show);
		}

		RxView
			.clicks(mFab)
			.throttleFirst(3, TimeUnit.SECONDS)
			.map(click -> getPackageManager().getLaunchIntentForPackage(BuildConfig.POKEMON_GO_ID))
			.doOnNext(intent -> {
				if (intent == null) {
					Snackbar.make(mFab, R.string.error_pokemon_missing, Snackbar.LENGTH_LONG).show();
				}
			})
			.filter(intent -> intent != null)
			.subscribe(this::startActivity);

		checkIfFirstTime();
	}

	private void setupToolbar() {
		setSupportActionBar(mToolbar);
	}

	private void setupPreferences() {
		PreferenceManager.setDefaultValues(this, preferences, false);

		getSupportFragmentManager()
			.beginTransaction()
// Path: app/src/main/java/com/icecream/snorlax/app/SnorlaxApp.java
// public class SnorlaxApp extends Application {
// 
// 	public static boolean isEnabled() {
// 		return false;
// 	}
// 
// 	@Override
// 	public void onCreate() {
// 		super.onCreate();
// 
// 		if (BuildConfig.DEBUG) {
// 			Timber.plant(new Timber.DebugTree());
// 		}
// 	}
// }
// 
// Path: app/src/main/java/com/icecream/snorlax/app/settings/SettingsFragment.java
// @SuppressWarnings({"unused", "FieldCanBeLocal", "WeakerAccess"})
// public class SettingsFragment extends PreferenceFragmentCompat {
// 
// 	private SettingsReadable mSettingsReadable;
// 
// 	@Override
// 	public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
// 		addPreferencesFromResource(preferences);
// 	}
// 
// 	@Override
// 	public void onActivityCreated(Bundle savedInstanceState) {
// 		super.onActivityCreated(savedInstanceState);
// 
// 		setDivider(new ColorDrawable(Color.TRANSPARENT));
// 		setDividerHeight(0);
// 
// 		getListView().setPadding(0, 0, 0, getActivity().getResources().getDimensionPixelSize(R.dimen.padding_list_bottom));
// 	}
// 
// 	@Override
// 	public void onPause() {
// 		super.onPause();
// 		SettingsReadable settingsReadable = new SettingsReadable(
// 			getActivity().getApplicationInfo(),
// 			getPreferenceManager()
// 		);
// 
// 		settingsReadable
// 			.setReadable()
// 			.subscribe(Timber::d, throwable -> {
// 				Timber.e(throwable);
// 				showReadableError();
// 			});
// 	}
// 
// 	private void showReadableError() {
// 		if (getActivity() != null) {
// 			Toast.makeText(getActivity(), R.string.error_readable, Toast.LENGTH_LONG).show();
// 		}
// 	}
// }


// Path: app/src/main/java/com/icecream/snorlax/app/home/HomeActivity.java
import java.util.concurrent.TimeUnit;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.preference.PreferenceManager;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.icecream.snorlax.BuildConfig;
import com.icecream.snorlax.R;
import com.icecream.snorlax.app.SnorlaxApp;
import com.icecream.snorlax.app.settings.SettingsFragment;
import com.jakewharton.rxbinding.view.RxView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import rx.Observable;
import static com.icecream.snorlax.R.xml.preferences;

						return Snackbar.make(mFab, R.string.error_xposed_missing, Snackbar.LENGTH_LONG);
					}
				})
				.subscribe(Snackbar::show);
		}

		RxView
			.clicks(mFab)
			.throttleFirst(3, TimeUnit.SECONDS)
			.map(click -> getPackageManager().getLaunchIntentForPackage(BuildConfig.POKEMON_GO_ID))
			.doOnNext(intent -> {
				if (intent == null) {
					Snackbar.make(mFab, R.string.error_pokemon_missing, Snackbar.LENGTH_LONG).show();
				}
			})
			.filter(intent -> intent != null)
			.subscribe(this::startActivity);

		checkIfFirstTime();
	}

	private void setupToolbar() {
		setSupportActionBar(mToolbar);
	}

	private void setupPreferences() {
		PreferenceManager.setDefaultValues(this, preferences, false);

		getSupportFragmentManager()
			.beginTransaction()
			.replace(R.id.content, new SettingsFragment())