2016-09-24 11:54:12 -05: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 11:13:48 +08:00
|
|
|
|
2016-09-24 11:54:12 -05:00
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
2016-09-25 21:31:38 +08:00
|
|
|
|
2016-09-26 13:16:11 -05:00
|
|
|
super.onCreate(savedInstanceState);
|
2016-12-25 15:11:59 +08:00
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplication());
|
2017-01-04 23:11:09 +01:00
|
|
|
if (Utils.isDarkTheme(prefs.getString("theme", null), this)) {
|
2016-09-25 00:16:28 -05:00
|
|
|
setTheme(R.style.AppTheme_dh);
|
|
|
|
}
|
2016-09-24 11:54:12 -05:00
|
|
|
|
2016-10-01 05:21:24 +08:00
|
|
|
Logger.devLog = prefs.getBoolean("developer_logging", false);
|
|
|
|
Logger.logShell = prefs.getBoolean("shell_logging", false);
|
2016-09-30 11:35:46 +08:00
|
|
|
|
2016-11-07 23:59:10 +08:00
|
|
|
// Initialize prefs
|
2016-10-01 05:21:24 +08:00
|
|
|
prefs.edit()
|
2016-11-07 23:59:10 +08:00
|
|
|
.putBoolean("magiskhide", Utils.itemExist(false, "/magisk/.core/magiskhide/enable"))
|
2016-11-09 05:17:50 +08:00
|
|
|
.putBoolean("busybox", Utils.commandExists("busybox"))
|
|
|
|
.putBoolean("hosts", Utils.itemExist(false, "/magisk/.core/hosts"))
|
2016-09-27 22:57:20 +08:00
|
|
|
.apply();
|
2016-09-28 18:05:55 +08:00
|
|
|
|
2016-12-25 22:36:51 +08:00
|
|
|
// Start all async tasks
|
|
|
|
new Async.GetBootBlocks().exec();
|
2016-12-25 15:11:59 +08:00
|
|
|
new Async.CheckUpdates().exec();
|
|
|
|
Async.checkSafetyNet(getApplicationContext());
|
|
|
|
new Async.LoadModules() {
|
2016-10-01 05:21:24 +08:00
|
|
|
@Override
|
|
|
|
protected void onPostExecute(Void v) {
|
|
|
|
super.onPostExecute(v);
|
2016-11-07 21:06:18 +08:00
|
|
|
new Async.LoadRepos(getApplicationContext()).exec();
|
2016-10-01 05:21:24 +08:00
|
|
|
}
|
2016-11-07 21:06:18 +08:00
|
|
|
}.exec();
|
2016-09-24 13:46:42 -05:00
|
|
|
|
2016-12-25 22:36:51 +08:00
|
|
|
// Start main activity
|
|
|
|
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
|
|
|
|
startActivity(intent);
|
|
|
|
finish();
|
2016-09-24 11:54:12 -05:00
|
|
|
}
|
|
|
|
}
|