mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-13 05:17:37 -08:00
Initial Refactor of WelcomeActivity, Set up Basic Splash Elements
This commit is contained in:
69
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
Normal file
69
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package com.topjohnwu.magisk;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import com.topjohnwu.magisk.services.MonitorService;
|
||||
import com.topjohnwu.magisk.utils.Async;
|
||||
import com.topjohnwu.magisk.utils.Logger;
|
||||
import com.topjohnwu.magisk.utils.PrefHelper;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
//setups go here
|
||||
|
||||
// Set up default preferences,make sure we add "extra" blacklist entries.
|
||||
|
||||
PreferenceManager.setDefaultValues(this, R.xml.defaultpref, false);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplication());
|
||||
|
||||
if (!prefs.contains("auto_blacklist")) {
|
||||
Logger.dh("AutoRootFragment: Setting default preferences for application");
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
Set<String> set = new HashSet<>();
|
||||
set.add("com.google.android.apps.walletnfcrel");
|
||||
set.add("com.google.android.gms");
|
||||
set.add("com.google.commerce.tapandpay");
|
||||
editor.putStringSet("auto_blacklist", set);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
// Set up toggle states based on preferences, start services, disable root if set
|
||||
|
||||
if (Utils.autoToggleEnabled(getApplicationContext())) {
|
||||
if (!Utils.isMyServiceRunning(MonitorService.class, getApplicationContext())) {
|
||||
Intent myIntent = new Intent(getApplication(), MonitorService.class);
|
||||
getApplication().startService(myIntent);
|
||||
}
|
||||
} else {
|
||||
if (PrefHelper.CheckBool("keep_root_off", getApplication())) {
|
||||
Utils.toggleRoot(false, getApplication());
|
||||
}
|
||||
}
|
||||
|
||||
// Set up quick settings tile
|
||||
Utils.SetupQuickSettingsTile(getApplicationContext());
|
||||
|
||||
// Initialize
|
||||
|
||||
new Async.CheckUpdates(this).execute();
|
||||
new Async.LoadModules(this).execute();
|
||||
new Async.LoadRepos(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
// Start main activity
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user