mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-28 04:25:27 +00:00
Potentially fix Samsung crash and change colors
This commit is contained in:
parent
2f78155723
commit
8eba05ed4a
@ -25,6 +25,7 @@ public class MagiskManager extends Application {
|
|||||||
public static final String MAGISK_HIDE_PATH = "/magisk/.core/magiskhide/";
|
public static final String MAGISK_HIDE_PATH = "/magisk/.core/magiskhide/";
|
||||||
public static final String TMP_FOLDER_PATH = "/dev/tmp";
|
public static final String TMP_FOLDER_PATH = "/dev/tmp";
|
||||||
public static final String MAGISK_PATH = "/magisk";
|
public static final String MAGISK_PATH = "/magisk";
|
||||||
|
public static final String INTENT_SECTION = "section";
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
public final CallbackEvent<Void> blockDetectionDone = new CallbackEvent<>();
|
public final CallbackEvent<Void> blockDetectionDone = new CallbackEvent<>();
|
||||||
|
@ -29,8 +29,6 @@ import butterknife.ButterKnife;
|
|||||||
public class MainActivity extends Activity
|
public class MainActivity extends Activity
|
||||||
implements NavigationView.OnNavigationItemSelectedListener, CallbackEvent.Listener<Void> {
|
implements NavigationView.OnNavigationItemSelectedListener, CallbackEvent.Listener<Void> {
|
||||||
|
|
||||||
public static final String SECTION = "section";
|
|
||||||
|
|
||||||
private final Handler mDrawerHandler = new Handler();
|
private final Handler mDrawerHandler = new Handler();
|
||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
private int mDrawerItem;
|
private int mDrawerItem;
|
||||||
@ -79,7 +77,7 @@ public class MainActivity extends Activity
|
|||||||
toggle.syncState();
|
toggle.syncState();
|
||||||
|
|
||||||
if (savedInstanceState == null)
|
if (savedInstanceState == null)
|
||||||
navigate(getIntent().getStringExtra(SECTION));
|
navigate(getIntent().getStringExtra(MagiskManager.INTENT_SECTION));
|
||||||
|
|
||||||
navigationView.setNavigationItemSelectedListener(this);
|
navigationView.setNavigationItemSelectedListener(this);
|
||||||
getApplicationContext().reloadMainActivity.register(this);
|
getApplicationContext().reloadMainActivity.register(this);
|
||||||
@ -95,13 +93,13 @@ public class MainActivity extends Activity
|
|||||||
@Override
|
@Override
|
||||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||||
super.onRestoreInstanceState(savedInstanceState);
|
super.onRestoreInstanceState(savedInstanceState);
|
||||||
navigate(savedInstanceState.getInt(SECTION, R.id.status));
|
navigate(savedInstanceState.getInt(MagiskManager.INTENT_SECTION, R.id.status));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
outState.putInt(SECTION, mDrawerItem);
|
outState.putInt(MagiskManager.INTENT_SECTION, mDrawerItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -146,9 +146,8 @@ public class SettingsActivity extends Activity {
|
|||||||
enabled = prefs.getBoolean("dark_theme", false);
|
enabled = prefs.getBoolean("dark_theme", false);
|
||||||
if (getApplication().isDarkTheme != enabled) {
|
if (getApplication().isDarkTheme != enabled) {
|
||||||
getApplication().isDarkTheme = enabled;
|
getApplication().isDarkTheme = enabled;
|
||||||
getApplication().reloadMainActivity.trigger();
|
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
getActivity().recreate();
|
getApplication().reloadMainActivity.trigger();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "disable":
|
case "disable":
|
||||||
|
@ -31,7 +31,7 @@ public class SplashActivity extends Activity{
|
|||||||
magiskManager.init();
|
magiskManager.init();
|
||||||
|
|
||||||
// Initialize the update check service, notify every 3 hours
|
// Initialize the update check service, notify every 3 hours
|
||||||
if (!"install".equals(getIntent().getStringExtra(MainActivity.SECTION))) {
|
if (!"install".equals(getIntent().getStringExtra(MagiskManager.INTENT_SECTION))) {
|
||||||
ComponentName service = new ComponentName(magiskManager, UpdateCheckService.class);
|
ComponentName service = new ComponentName(magiskManager, UpdateCheckService.class);
|
||||||
JobInfo jobInfo = new JobInfo.Builder(UPDATE_SERVICE_ID, service)
|
JobInfo jobInfo = new JobInfo.Builder(UPDATE_SERVICE_ID, service)
|
||||||
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
|
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
|
||||||
@ -60,8 +60,11 @@ public class SplashActivity extends Activity{
|
|||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void v) {
|
protected void onPostExecute(Void v) {
|
||||||
super.onPostExecute(v);
|
super.onPostExecute(v);
|
||||||
Intent intent = getIntent().setClass(magiskManager, MainActivity.class)
|
String section = getIntent().getStringExtra(MagiskManager.INTENT_SECTION);
|
||||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
Intent intent = new Intent(magiskManager, MainActivity.class);
|
||||||
|
if (section != null) {
|
||||||
|
intent.putExtra(MagiskManager.INTENT_SECTION, section);
|
||||||
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import android.content.Intent;
|
|||||||
import android.support.v4.app.TaskStackBuilder;
|
import android.support.v4.app.TaskStackBuilder;
|
||||||
import android.support.v7.app.NotificationCompat;
|
import android.support.v7.app.NotificationCompat;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.MainActivity;
|
import com.topjohnwu.magisk.MagiskManager;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.SplashActivity;
|
import com.topjohnwu.magisk.SplashActivity;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
@ -56,7 +56,7 @@ public class CheckUpdates extends ParallelTask<Void, Void, Void> {
|
|||||||
.setVibrate(new long[]{0, 100, 100, 100})
|
.setVibrate(new long[]{0, 100, 100, 100})
|
||||||
.setAutoCancel(true);
|
.setAutoCancel(true);
|
||||||
Intent intent = new Intent(magiskManager, SplashActivity.class);
|
Intent intent = new Intent(magiskManager, SplashActivity.class);
|
||||||
intent.putExtra(MainActivity.SECTION, "install");
|
intent.putExtra(MagiskManager.INTENT_SECTION, "install");
|
||||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(magiskManager);
|
TaskStackBuilder stackBuilder = TaskStackBuilder.create(magiskManager);
|
||||||
stackBuilder.addParentStack(SplashActivity.class);
|
stackBuilder.addParentStack(SplashActivity.class);
|
||||||
stackBuilder.addNextIntent(intent);
|
stackBuilder.addNextIntent(intent);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<color name="blue500">#2196F3</color>
|
<color name="blue500">#2196F3</color>
|
||||||
<color name="yellow500">#FFC107</color>
|
<color name="yellow500">#FFC107</color>
|
||||||
|
|
||||||
<color name="dark_primary">#1a237e</color>
|
<color name="dark_primary">#bf360c</color>
|
||||||
<color name="dark_primary_dark">#000000</color>
|
<color name="dark_primary_dark">#000000</color>
|
||||||
|
|
||||||
<color name="dark_secondary_text">#dedede</color>
|
<color name="dark_secondary_text">#dedede</color>
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.Dark" parent="Theme.AppCompat.NoActionBar">
|
<style name="AppTheme.Dark" parent="Theme.AppCompat.NoActionBar">
|
||||||
<item name="colorPrimary">@color/dark_primary</item>
|
|
||||||
<item name="colorPrimaryDark">@color/dark_primary_dark</item>
|
|
||||||
<item name="colorAccent">@color/accent</item>
|
<item name="colorAccent">@color/accent</item>
|
||||||
<item name="colorAccentFallback">@color/accentFallback</item>
|
<item name="colorAccentFallback">@color/accentFallback</item>
|
||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user