fix: floaty.closeAll()
This commit is contained in:
@@ -8,8 +8,8 @@ android {
|
||||
applicationId "com.stardust.scriptdroid"
|
||||
minSdkVersion 17
|
||||
targetSdkVersion 23
|
||||
versionCode 245
|
||||
versionName "3.0.0 Alpha45"
|
||||
versionCode 246
|
||||
versionName "3.0.0 Alpha46"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
ndk {
|
||||
|
||||
@@ -1 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":34},"path":"inrt-release.apk","properties":{"packageId":"com.stardust.auojs.inrt","split":"","minSdkVersion":"17"}}]
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":246},"path":"release-3.0.0 Alpha46.apk","properties":{"packageId":"com.stardust.scriptdroid","split":"","minSdkVersion":"17"}}]
|
||||
@@ -5,7 +5,6 @@ import android.content.Intent;
|
||||
import android.os.Looper;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.stardust.autojs.R;
|
||||
import com.stardust.autojs.core.floaty.FloatyWindow;
|
||||
@@ -19,11 +18,8 @@ import com.stardust.enhancedfloaty.FloatyService;
|
||||
import com.stardust.util.UiHandler;
|
||||
import com.stardust.util.ViewUtil;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import ezy.assist.compat.SettingsCompat;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/12/5.
|
||||
*/
|
||||
@@ -54,10 +50,18 @@ public class Floaty {
|
||||
throw new ScriptInterruptedException();
|
||||
}
|
||||
JsFloatyWindow window = new JsFloatyWindow(view);
|
||||
mWindows.add(window);
|
||||
addWindow(window);
|
||||
return window;
|
||||
}
|
||||
|
||||
private synchronized void addWindow(JsFloatyWindow window) {
|
||||
mWindows.add(window);
|
||||
}
|
||||
|
||||
private synchronized boolean removeWindow(JsFloatyWindow window) {
|
||||
return mWindows.remove(window);
|
||||
}
|
||||
|
||||
private View inflate(String xml) {
|
||||
if (Looper.getMainLooper() == Looper.myLooper()) {
|
||||
return mJsLayoutInflater.inflate(mContext, xml);
|
||||
@@ -68,13 +72,11 @@ public class Floaty {
|
||||
}
|
||||
}
|
||||
|
||||
public void closeAll() {
|
||||
Iterator<JsFloatyWindow> iterator = mWindows.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
JsFloatyWindow window = iterator.next();
|
||||
iterator.remove();
|
||||
public synchronized void closeAll() {
|
||||
for (JsFloatyWindow window : mWindows) {
|
||||
window.close(false);
|
||||
}
|
||||
mWindows.clear();
|
||||
}
|
||||
|
||||
public class JsFloatyWindow {
|
||||
@@ -154,7 +156,7 @@ public class Floaty {
|
||||
}
|
||||
|
||||
void close(boolean removeFromWindows) {
|
||||
if (removeFromWindows && !mWindows.remove(this)) {
|
||||
if (removeFromWindows && !removeWindow(this)) {
|
||||
return;
|
||||
}
|
||||
runWithWindow(() -> {
|
||||
|
||||
Reference in New Issue
Block a user