Skip to content

Commit

Permalink
fixed the ui hangup, stupid statics
Browse files Browse the repository at this point in the history
  • Loading branch information
kwatkins committed Jan 5, 2019
1 parent 56b0e3f commit bb16b0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "net.kwatts.android.droidcommandpro"
minSdkVersion 21
targetSdkVersion 27 //26
versionCode 59
versionName "5.9"
versionCode 60
versionName "6.0"
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.MainThread;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.NotificationCompat;
Expand Down Expand Up @@ -216,7 +217,7 @@ public static boolean isUserAdmin() {
private static final int MSG_NEWLINE = 1;
private static final int MSG_CMD_TERMINATED = 2;
private static final int MSG_CMD_COMPLETE = 3;
public static Handler mHandler = new Handler()
public Handler mHandler = new Handler()
{
public void handleMessage(Message msg)
{
Expand All @@ -241,7 +242,7 @@ public void handleMessage(Message msg)
};


private static void handleMessageNewline(Message msg)
private void handleMessageNewline(Message msg)
{
int cmd_state = msg.arg1;
String line = (String) msg.obj;
Expand Down Expand Up @@ -620,7 +621,7 @@ public void onComplete(@NonNull Task<AuthResult> task) {

static long startTime;
static int mExecState = 0;
public static void runCommand(Command c) {
public void runCommand(Command c) {
//clear window
mTopOutString.setLength(0);
mTopOutStringError.setLength(0);
Expand Down Expand Up @@ -708,6 +709,7 @@ public void onAddElement(String s) {

//https://github.com/topjohnwu/libsu/blob/master/superuser/src/main/java/com/topjohnwu/superuser/internal/PendingJob.java
Shell.ResultCallback runResultCallback = new Shell.ResultCallback() {
@MainThread
@Override
public void onResult(Shell.Result out) {
CharSequence l = "";
Expand All @@ -722,11 +724,14 @@ public void onResult(Shell.Result out) {
}
};


if (Shell.getShell().isRoot()) {
Shell.su(runCommand).to(consoleList, consoleListError).submit(runResultCallback);
com.topjohnwu.superuser.Shell.Job j = Shell.su(runCommand).to(consoleList, consoleListError);
j.submit(runResultCallback);
}
else {
Shell.sh(runCommand).to(consoleList, consoleListError).submit(runResultCallback);
com.topjohnwu.superuser.Shell.Job j2 = Shell.sh(runCommand).to(consoleList, consoleListError);
j2.submit(runResultCallback);
}

}
Expand Down

0 comments on commit bb16b0c

Please sign in to comment.