From 1c469f10017fd770b0b2db991fa477422c855950 Mon Sep 17 00:00:00 2001 From: ShirosakiMio <852468399@qq.com> Date: Tue, 4 Apr 2023 09:36:31 +0800 Subject: [PATCH] Update ShellActivity.java --- .../com/tungsten/fcl/activity/ShellActivity.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/FCL/src/main/java/com/tungsten/fcl/activity/ShellActivity.java b/FCL/src/main/java/com/tungsten/fcl/activity/ShellActivity.java index aaef0a3c2..2598cccef 100644 --- a/FCL/src/main/java/com/tungsten/fcl/activity/ShellActivity.java +++ b/FCL/src/main/java/com/tungsten/fcl/activity/ShellActivity.java @@ -29,12 +29,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { editText = findViewById(R.id.shell_input); logWindow.appendLog("Welcome to use Fold Craft Launcher!\n"); logWindow.appendLog("Here is the shell command line!\n"); - shellUtil = new ShellUtil(new File(FCLPath.FILES_DIR).getParent(), new ShellUtil.Callback() { - @Override - public void output(String output) { - logWindow.appendLog("\t" + output + "\n"); - } - }); + shellUtil = new ShellUtil(new File(FCLPath.FILES_DIR).getParent(), output -> logWindow.appendLog("\t" + output + "\n")); shellUtil.start(); editText.addTextChangedListener(new TextWatcher() { @Override @@ -77,4 +72,10 @@ public void afterTextChanged(Editable editable) { } }); } + + @Override + protected void onDestroy() { + super.onDestroy(); + shellUtil.interrupt(); + } }