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