Update ShellActivity.java

This commit is contained in:
ShirosakiMio 2023-04-04 09:36:31 +08:00
parent 4abd2a0c25
commit 1c469f1001
1 changed files with 7 additions and 6 deletions

View File

@ -29,12 +29,7 @@ public class ShellActivity extends AppCompatActivity {
editText = findViewById(R.id.shell_input); editText = findViewById(R.id.shell_input);
logWindow.appendLog("Welcome to use Fold Craft Launcher!\n"); logWindow.appendLog("Welcome to use Fold Craft Launcher!\n");
logWindow.appendLog("Here is the shell command line!\n"); logWindow.appendLog("Here is the shell command line!\n");
shellUtil = new ShellUtil(new File(FCLPath.FILES_DIR).getParent(), new ShellUtil.Callback() { shellUtil = new ShellUtil(new File(FCLPath.FILES_DIR).getParent(), output -> logWindow.appendLog("\t" + output + "\n"));
@Override
public void output(String output) {
logWindow.appendLog("\t" + output + "\n");
}
});
shellUtil.start(); shellUtil.start();
editText.addTextChangedListener(new TextWatcher() { editText.addTextChangedListener(new TextWatcher() {
@Override @Override
@ -77,4 +72,10 @@ public class ShellActivity extends AppCompatActivity {
} }
}); });
} }
@Override
protected void onDestroy() {
super.onDestroy();
shellUtil.interrupt();
}
} }