Skip to content

Commit

Permalink
修复配置文件有错误时,设置界面会卡死的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pansong291 committed Aug 18, 2019
1 parent 9d5bb6b commit c3c3e61
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ public static Config json2Config(String json)
{
Log.printStackTrace(TAG, e);
if(json != null)
Log.showDialogOrToastAndRecordLog("配置文件格式有误,已重置配置文件", "");
Log.showToastIgnoreConfig("配置文件格式有误,已重置配置文件", "");
config = defInit();
}
if(config.reInit)
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/pansong291/xposed/quickenergy/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,15 @@ public static void showDialogAndRecordLog(String str, String str2)
recordLog(str, str2);
}

public static void showToast(final String str, String str2)
public static void showToast(String str, String str2)
{
if(Config.showMode() != Config.ShowMode.TOAST)
return;
showToastIgnoreConfig(str, str2);
}

public static void showToastIgnoreConfig(final String str, String str2)
{
Log.i(TAG, str + str2);
final Activity activity = RpcCall.h5Activity;
if(activity != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th
protected void beforeHookedMethod(MethodHookParam param) throws Throwable
{
param.args[0] = true;
RpcCall.h5Activity = (Activity)param.thisObject;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.widget.Toast;
import pansong291.xposed.quickenergy.Config;
import pansong291.xposed.quickenergy.R;
import pansong291.xposed.quickenergy.RpcCall;

public class MainActivity extends Activity
{
Expand All @@ -30,6 +31,7 @@ protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setModuleActive(false);
RpcCall.h5Activity = this;

Config.shouldReloadConfig = true;

Expand Down

0 comments on commit c3c3e61

Please sign in to comment.