修复 一些崩溃问题
This commit is contained in:
@@ -52,7 +52,10 @@ public class AutoJs extends com.stardust.autojs.AutoJs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void initInstance(Application application) {
|
public synchronized static void initInstance(Application application) {
|
||||||
|
if (instance != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
instance = new AutoJs(application);
|
instance = new AutoJs(application);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class JavaScriptHighlighter implements SimpleTextWatcher.AfterTextChanged
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addToken(int tokenStart, int tokenEnd, int color) {
|
public void addToken(int tokenStart, int tokenEnd, int color) {
|
||||||
if(mCount < tokenStart){
|
if (mCount < tokenStart) {
|
||||||
int c = mCount > 0 ? colors[mCount - 1] : color;
|
int c = mCount > 0 ? colors[mCount - 1] : color;
|
||||||
for (int i = mCount; i < tokenStart; i++) {
|
for (int i = mCount; i < tokenStart; i++) {
|
||||||
colors[i] = c;
|
colors[i] = c;
|
||||||
@@ -93,10 +93,13 @@ public class JavaScriptHighlighter implements SimpleTextWatcher.AfterTextChanged
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateTokens(String sourceString) {
|
public void updateTokens(String sourceString) {
|
||||||
if(mTheme == null){
|
if (mTheme == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int id = mRunningHighlighterId.incrementAndGet();
|
final int id = mRunningHighlighterId.incrementAndGet();
|
||||||
|
if (mExecutorService.isShutdown() || mExecutorService.isTerminated() || mExecutorService.isTerminating()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mExecutorService.execute(() -> {
|
mExecutorService.execute(() -> {
|
||||||
try {
|
try {
|
||||||
mLogger.reset();
|
mLogger.reset();
|
||||||
|
|||||||
@@ -168,6 +168,9 @@ public class ExplorerView extends ThemeColorSwipeRefreshLayout implements SwipeR
|
|||||||
Stack<ScriptFile> dirs = new Stack<>();
|
Stack<ScriptFile> dirs = new Stack<>();
|
||||||
while (!dir.equals(root)) {
|
while (!dir.equals(root)) {
|
||||||
dir = dir.getParentFile();
|
dir = dir.getParentFile();
|
||||||
|
if (dir == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
dirs.push(dir);
|
dirs.push(dir);
|
||||||
}
|
}
|
||||||
ExplorerDirPage parent = null;
|
ExplorerDirPage parent = null;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class CommunityFragment extends ViewPagerFragment implements BackPressedH
|
|||||||
|
|
||||||
private boolean isInPostsPage() {
|
private boolean isInPostsPage() {
|
||||||
String url = mWebView.getUrl();
|
String url = mWebView.getUrl();
|
||||||
return url.matches(POSTS_PAGE_PATTERN);
|
return url != null && url.matches(POSTS_PAGE_PATTERN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -70,7 +70,12 @@ public class ScreenCapturer {
|
|||||||
int orientation = mContext.getResources().getConfiguration().orientation;
|
int orientation = mContext.getResources().getConfiguration().orientation;
|
||||||
if (mOrientation == ORIENTATION_AUTO && mDetectedOrientation != orientation) {
|
if (mOrientation == ORIENTATION_AUTO && mDetectedOrientation != orientation) {
|
||||||
mDetectedOrientation = orientation;
|
mDetectedOrientation = orientation;
|
||||||
refreshVirtualDisplay(orientation);
|
try {
|
||||||
|
refreshVirtualDisplay(orientation);
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
mException = e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,8 +153,8 @@ public class ScreenCapturer {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Image capture() {
|
public Image capture() {
|
||||||
if (mException != null) {
|
Exception e = mException;
|
||||||
Exception e = mException;
|
if (e != null) {
|
||||||
mException = null;
|
mException = null;
|
||||||
throw new ScriptException(e);
|
throw new ScriptException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"appVersionCode": 439,
|
"appVersionCode": 440,
|
||||||
"appVersionName": "4.0.4 Alpha10",
|
"appVersionName": "4.0.4 Alpha11",
|
||||||
"target": 28,
|
"target": 28,
|
||||||
"mini": 17,
|
"mini": 17,
|
||||||
"compile": 28,
|
"compile": 28,
|
||||||
|
|||||||
Reference in New Issue
Block a user