Some cleanups
This commit is contained in:
parent
b067a5bb13
commit
48879df2da
@ -12,6 +12,7 @@ import android.preference.PreferenceManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
|
||||
import com.topjohnwu.magisk.components.BaseActivity;
|
||||
import com.topjohnwu.magisk.database.MagiskDB;
|
||||
@ -36,6 +37,7 @@ public class App extends Application implements Application.ActivityLifecycleCal
|
||||
private volatile BaseActivity foreground;
|
||||
|
||||
static {
|
||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
|
||||
Shell.Config.setFlags(Shell.FLAG_MOUNT_MASTER | Shell.FLAG_USE_MAGISK_BUSYBOX);
|
||||
Shell.Config.verboseLogging(BuildConfig.DEBUG);
|
||||
Shell.Config.addInitializers(RootUtils.class);
|
||||
|
@ -79,7 +79,6 @@ public class Const {
|
||||
public static final String LINK_KEY = "Link";
|
||||
public static final String IF_NONE_MATCH = "If-None-Match";
|
||||
// intents
|
||||
public static final String FROM_SPLASH = "splash";
|
||||
public static final String OPEN_SECTION = "section";
|
||||
public static final String INTENT_SET_NAME = "filename";
|
||||
public static final String INTENT_SET_LINK = "link";
|
||||
|
@ -50,7 +50,7 @@ public class MainActivity extends BaseActivity
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
if (!getIntent().getBooleanExtra(Const.Key.FROM_SPLASH, false)) {
|
||||
if (!SplashActivity.DONE) {
|
||||
startActivity(new Intent(this, ClassMap.get(SplashActivity.class)));
|
||||
finish();
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ import com.topjohnwu.superuser.Shell;
|
||||
|
||||
public class SplashActivity extends BaseActivity {
|
||||
|
||||
public static boolean DONE = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -83,8 +85,7 @@ public class SplashActivity extends BaseActivity {
|
||||
|
||||
Intent intent = new Intent(this, ClassMap.get(MainActivity.class));
|
||||
intent.putExtra(Const.Key.OPEN_SECTION, getIntent().getStringExtra(Const.Key.OPEN_SECTION));
|
||||
intent.putExtra(Const.Key.FROM_SPLASH, true);
|
||||
intent.putExtra(BaseActivity.INTENT_PERM, getIntent().getStringExtra(BaseActivity.INTENT_PERM));
|
||||
DONE = true;
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StyleRes;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.collection.SparseArrayCompat;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
@ -28,7 +27,6 @@ import com.topjohnwu.magisk.utils.LocaleManager;
|
||||
|
||||
public abstract class BaseActivity extends AppCompatActivity implements Event.AutoListener {
|
||||
|
||||
public static final String INTENT_PERM = "perm_dialog";
|
||||
private static Runnable grantCallback;
|
||||
|
||||
static int[] EMPTY_INT_ARRAY = new int[0];
|
||||
@ -36,10 +34,6 @@ public abstract class BaseActivity extends AppCompatActivity implements Event.Au
|
||||
private SparseArrayCompat<ActivityResultListener> resultListeners = new SparseArrayCompat<>();
|
||||
public App app = App.self;
|
||||
|
||||
static {
|
||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getListeningEvents() {
|
||||
return EMPTY_INT_ARRAY;
|
||||
@ -65,9 +59,6 @@ public abstract class BaseActivity extends AppCompatActivity implements Event.Au
|
||||
setTheme(getDarkTheme());
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
String[] perms = getIntent().getStringArrayExtra(INTENT_PERM);
|
||||
if (perms != null)
|
||||
ActivityCompat.requestPermissions(this, perms, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user