Skip to content

Commit

Permalink
修复启动时死循环问题
Browse files Browse the repository at this point in the history
  • Loading branch information
constanline committed Sep 18, 2023
1 parent b6e0f30 commit d78683c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdk 21
//noinspection ExpiredTargetSdkVersion
targetSdk 29
versionCode 65
versionCode 66
versionName "1.2.1"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ public class AntForestToast {
public static Context context;

public static void show(CharSequence cs) {
show(cs, false);
}

public static void show(CharSequence cs, boolean force) {
try {
if (context != null && Config.showToast()) {
if (context != null && (force || Config.showToast())) {
XposedHook.handler.post(
new Runnable() {
CharSequence cs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ public static File getBackupFile(File f) {
}

public static String readFromFile(File f) {
if (!f.canRead()) {
AntForestToast.show(f.getName() + "没有读取权限!");
if (f.exists() && !f.canRead()) {
AntForestToast.show(f.getName() + "没有读取权限!", true);
return "";
}
StringBuilder result = new StringBuilder();
Expand Down Expand Up @@ -327,8 +327,8 @@ public synchronized static void append2RuntimeLogFile(String s) {
}

public static boolean write2File(String s, File f) {
if (!f.canWrite()) {
AntForestToast.show(f.getName() + "没有写入权限!");
if (f.exists() && !f.canWrite()) {
AntForestToast.show(f.getName() + "没有写入权限!", true);
return false;
}
boolean success = false;
Expand All @@ -347,8 +347,8 @@ public static boolean write2File(String s, File f) {
}

public static boolean append2File(String s, File f) {
if (!f.canWrite()) {
AntForestToast.show(f.getName() + "没有写入权限!");
if (f.exists() && !f.canWrite()) {
AntForestToast.show(f.getName() + "没有写入权限!", true);
return false;
}
boolean success = false;
Expand Down

0 comments on commit d78683c

Please sign in to comment.