fix: ConsoleView ConcurrentModifiationException
This commit is contained in:
@@ -9,8 +9,8 @@ android {
|
|||||||
applicationId "com.stardust.scriptdroid"
|
applicationId "com.stardust.scriptdroid"
|
||||||
minSdkVersion 17
|
minSdkVersion 17
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 155
|
versionCode 156
|
||||||
versionName "2.0.15 Alpha3"
|
versionName "2.0.15 Alpha4"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
ndk {
|
ndk {
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ import com.stardust.autojs.runtime.console.StardustConsole;
|
|||||||
import com.stardust.enhancedfloaty.ResizableExpandableFloatyWindow;
|
import com.stardust.enhancedfloaty.ResizableExpandableFloatyWindow;
|
||||||
import com.stardust.util.SparseArrayEntries;
|
import com.stardust.util.SparseArrayEntries;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Stardust on 2017/5/2.
|
* Created by Stardust on 2017/5/2.
|
||||||
*/
|
*/
|
||||||
@@ -155,9 +158,19 @@ public class ConsoleView extends FrameLayout implements StardustConsole.LogListe
|
|||||||
private void refreshLog() {
|
private void refreshLog() {
|
||||||
if (mConsole != null) {
|
if (mConsole != null) {
|
||||||
mTextView.setText("");
|
mTextView.setText("");
|
||||||
for (StardustConsole.Log log : mConsole.getLogs()) {
|
final List<StardustConsole.Log> logs = new ArrayList<>(mConsole.getLogs());
|
||||||
onNewLog(log);
|
post(new Runnable() {
|
||||||
}
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (StardustConsole.Log log : logs) {
|
||||||
|
int color = getColorForLevel(log.level);
|
||||||
|
final Spannable spannable = buildColorSpannable(log.content, color);
|
||||||
|
mTextView.append(spannable);
|
||||||
|
}
|
||||||
|
mContentContainer.fullScroll(View.FOCUS_DOWN);
|
||||||
|
mEditText.requestFocus();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user