Release 19: Properly show toast when config changing
diff --git a/app/build.gradle b/app/build.gradle
index 16fed32..b87ef9f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "masquerade.substratum"
minSdkVersion 21
targetSdkVersion 23
- versionCode 18
- versionName "eighteen"
+ versionCode 19
+ versionName "nineteen"
}
buildTypes {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 7a8cdb0..5804f57 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="masquerade.substratum"
- android:versionCode="18"
- android:versionName="eighteen">
+ android:versionCode="19"
+ android:versionName="nineteen">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
diff --git a/app/src/main/java/masquerade/substratum/util/Helper.java b/app/src/main/java/masquerade/substratum/util/Helper.java
index 70117e1..0b65cb0 100644
--- a/app/src/main/java/masquerade/substratum/util/Helper.java
+++ b/app/src/main/java/masquerade/substratum/util/Helper.java
@@ -35,7 +35,7 @@
String main_delay = intent.getStringArrayListExtra("icon-handler").get(2);
String delay_one = intent.getStringArrayListExtra("icon-handler").get(3);
String delay_two = intent.getStringArrayListExtra("icon-handler").get(4);
- String bypass = intent.getStringArrayListExtra("icon-handler").get(5);
+ final String bypass = intent.getStringArrayListExtra("icon-handler").get(5);
if (bypass == null) {
if (intent.getStringArrayListExtra("icon-handler").get(1).contains("pm") ||
intent.getStringArrayListExtra("icon-handler").get(1).contains("om") ||
@@ -54,7 +54,7 @@
@Override
public void run() {
new IconPackApplicator().apply(
- mContext, icon_pack, delay_one_time, delay_two_time);
+ mContext, icon_pack, delay_one_time, delay_two_time, bypass == null);
}
}, Integer.parseInt(main_delay));
} else if (intent.getStringExtra("om-commands") != null) {
diff --git a/app/src/main/java/masquerade/substratum/util/IconPackApplicator.java b/app/src/main/java/masquerade/substratum/util/IconPackApplicator.java
index 2c2a077..3bf5507 100644
--- a/app/src/main/java/masquerade/substratum/util/IconPackApplicator.java
+++ b/app/src/main/java/masquerade/substratum/util/IconPackApplicator.java
@@ -16,16 +16,19 @@
private String iconPackName;
private String toast_text = null;
private int delayOne, delayTwo;
+ private Boolean bypass;
private static void grantPermission(final String packager, final String permission) {
Root.runCommand("pm grant " + packager + " " + permission);
}
- void apply(Context mContext, String iconPackName, String delayOne, String delayTwo) {
+ void apply(Context mContext, String iconPackName, String delayOne, String delayTwo,
+ Boolean bypass) {
this.mContext = mContext;
this.iconPackName = iconPackName;
this.delayOne = Integer.parseInt(delayOne);
this.delayTwo = Integer.parseInt(delayTwo);
+ this.bypass = bypass;
iconInjector();
}
@@ -71,9 +74,15 @@
try {
Context otherContext = mContext.createPackageContext("projekt.substratum", 0);
Resources resources = otherContext.getResources();
- int toast = resources.getIdentifier("studio_applied_toast", "string",
- "projekt.substratum");
- toast_text = String.format(resources.getString(toast), iconPackName);
+ if (bypass) {
+ int toast = resources.getIdentifier("studio_applied_toast", "string",
+ "projekt.substratum");
+ toast_text = String.format(resources.getString(toast), iconPackName);
+ } else {
+ int toast = resources.getIdentifier("studio_configuration_changed", "string",
+ "projekt.substratum");
+ toast_text = resources.getString(toast);
+ }
} catch (Exception e) {
// Suppress warning
}
@@ -107,7 +116,7 @@
android.content.res.Configuration
.class).invoke(am, config);
- if (toast_text != null)
+ if (toast_text != null && !bypass)
Toast.makeText(
mContext, toast_text, Toast.LENGTH_SHORT).show();
} catch (Exception e) {