2016-09-24 18:54:12 +02:00
|
|
|
package com.topjohnwu.magisk;
|
|
|
|
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.preference.PreferenceManager;
|
|
|
|
import android.support.v7.app.AppCompatActivity;
|
|
|
|
|
|
|
|
import com.topjohnwu.magisk.utils.Async;
|
|
|
|
import com.topjohnwu.magisk.utils.Logger;
|
|
|
|
import com.topjohnwu.magisk.utils.Utils;
|
|
|
|
|
|
|
|
public class SplashActivity extends AppCompatActivity {
|
2016-10-31 04:13:48 +01:00
|
|
|
|
|
|
|
private SharedPreferences prefs;
|
|
|
|
|
2016-09-24 18:54:12 +02:00
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
2016-09-25 15:31:38 +02:00
|
|
|
|
2016-09-26 20:16:11 +02:00
|
|
|
super.onCreate(savedInstanceState);
|
2016-10-26 00:51:34 +02:00
|
|
|
prefs = PreferenceManager.getDefaultSharedPreferences(getApplication());
|
2016-10-22 20:04:58 +02:00
|
|
|
if (prefs.getString("theme", "").equals("Dark")) {
|
2016-09-25 07:16:28 +02:00
|
|
|
setTheme(R.style.AppTheme_dh);
|
|
|
|
}
|
2016-09-24 18:54:12 +02:00
|
|
|
|
2016-09-30 23:21:24 +02:00
|
|
|
Logger.devLog = prefs.getBoolean("developer_logging", false);
|
|
|
|
Logger.logShell = prefs.getBoolean("shell_logging", false);
|
2016-09-30 05:35:46 +02:00
|
|
|
|
2016-11-07 16:59:10 +01:00
|
|
|
// Initialize prefs
|
2016-09-30 23:21:24 +02:00
|
|
|
prefs.edit()
|
2016-09-27 16:57:20 +02:00
|
|
|
.putBoolean("module_done", false)
|
|
|
|
.putBoolean("repo_done", false)
|
2016-09-28 12:05:55 +02:00
|
|
|
.putBoolean("update_check_done", false)
|
2016-11-07 16:59:10 +01:00
|
|
|
.putBoolean("magiskhide", Utils.itemExist(false, "/magisk/.core/magiskhide/enable"))
|
2016-11-08 22:17:50 +01:00
|
|
|
.putBoolean("busybox", Utils.commandExists("busybox"))
|
|
|
|
.putBoolean("hosts", Utils.itemExist(false, "/magisk/.core/hosts"))
|
2016-09-27 16:57:20 +02:00
|
|
|
.apply();
|
2016-09-28 12:05:55 +02:00
|
|
|
|
2016-11-07 14:06:18 +01:00
|
|
|
new Async.CheckUpdates(prefs).exec();
|
2016-11-07 16:59:10 +01:00
|
|
|
new Async.ConstructEnv(getApplicationInfo()).exec();
|
2016-09-30 23:21:24 +02:00
|
|
|
|
|
|
|
new Async.LoadModules(prefs) {
|
|
|
|
@Override
|
|
|
|
protected void onPostExecute(Void v) {
|
|
|
|
super.onPostExecute(v);
|
2016-11-07 14:06:18 +01:00
|
|
|
new Async.LoadRepos(getApplicationContext()).exec();
|
2016-09-30 23:21:24 +02:00
|
|
|
// Start main activity
|
|
|
|
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
|
|
|
|
startActivity(intent);
|
|
|
|
finish();
|
|
|
|
}
|
2016-11-07 14:06:18 +01:00
|
|
|
}.exec();
|
2016-09-24 20:46:42 +02:00
|
|
|
|
2016-09-24 18:54:12 +02:00
|
|
|
}
|
|
|
|
}
|