6.6.2 - Alpha6 - 修复 floaty.getClip 方法
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
"colors.pixel 方法无法接受单通道图像参数的问题 _[`issue #350`](http://issues.autojs6.com/350)_",
|
||||
"engines.execScript/execScriptFile 等方法执行脚本时默认工作路径异常",
|
||||
"floaty.window/floaty.rawWindow 无法在子线程执行的问题",
|
||||
"floaty.getClip 可能无法正常获取剪切板内容的问题",
|
||||
"ui.inflate 返回值丢失 attr/on/click 等原型方法的问题",
|
||||
"布局分析页面生成代码时可能导致应用崩溃的问题 _[`issue #288`](http://issues.autojs6.com/288)_",
|
||||
"打包应用无法正常使用 shizuku 模块的问题 _[`issue #227`](http://issues.autojs6.com/227)_ _[`issue #231`](http://issues.autojs6.com/231)_ _[`issue #284`](http://issues.autojs6.com/284)_ _[`issue #287`](http://issues.autojs6.com/287)_ _[`issue #304`](http://issues.autojs6.com/304)_" ,
|
||||
@@ -41,7 +42,8 @@
|
||||
"APK 文件类型信息对话框增加文件大小与签名方案信息",
|
||||
"APK 文件类型信息对话框增加点击监听器支持文本复制与应用详情跳转",
|
||||
"尝试恢复 com.stardust 前缀包以便提升代码兼容性 _[`issue #290`](http://issues.autojs6.com/290)_",
|
||||
"floaty.window/floaty.rawWindow 同时支持主线程和子线程执行"
|
||||
"floaty.window/floaty.rawWindow 同时支持主线程和子线程执行",
|
||||
"getClip 全局方法适时借助 floaty.getClip 方法以提升兼容性"
|
||||
],
|
||||
"dependency": [
|
||||
"升级 Gradle Compile 版本 34 -> 35",
|
||||
|
||||
@@ -172,6 +172,7 @@ AutoJs6 在 Auto.js 最终项目的基础上, 于 `2021/12/01` 进行二次开
|
||||
* `修复` colors.pixel 方法无法接受单通道图像参数的问题 _[`issue #350`](http://issues.autojs6.com/350)_
|
||||
* `修复` engines.execScript/execScriptFile 等方法执行脚本时默认工作路径异常
|
||||
* `修复` floaty.window/floaty.rawWindow 无法在子线程执行的问题
|
||||
* `修复` floaty.getClip 可能无法正常获取剪切板内容的问题
|
||||
* `修复` ui.inflate 返回值丢失 attr/on/click 等原型方法的问题
|
||||
* `修复` 布局分析页面生成代码时可能导致应用崩溃的问题 _[`issue #288`](http://issues.autojs6.com/288)_
|
||||
* `修复` 打包应用无法正常使用 shizuku 模块的问题 _[`issue #227`](http://issues.autojs6.com/227)_ _[`issue #231`](http://issues.autojs6.com/231)_ _[`issue #284`](http://issues.autojs6.com/284)_ _[`issue #287`](http://issues.autojs6.com/287)_ _[`issue #304`](http://issues.autojs6.com/304)_
|
||||
@@ -194,6 +195,7 @@ AutoJs6 在 Auto.js 最终项目的基础上, 于 `2021/12/01` 进行二次开
|
||||
* `优化` APK 文件类型信息对话框增加点击监听器支持文本复制与应用详情跳转
|
||||
* `优化` 尝试恢复 com.stardust 前缀包以便提升代码兼容性 _[`issue #290`](http://issues.autojs6.com/290)_
|
||||
* `优化` floaty.window/floaty.rawWindow 同时支持主线程和子线程执行
|
||||
* `优化` getClip 全局方法适时借助 floaty.getClip 方法以提升兼容性
|
||||
* `优化` 部分依赖或本地库版本调整 _[`CHANGELOG.md`](http://project.autojs6.com/blob/master/app/src/main/assets-app/doc/CHANGELOG.md#v662)_
|
||||
|
||||
# v6.6.1
|
||||
|
||||
@@ -172,6 +172,7 @@ AutoJs6 在 Auto.js 最终项目的基础上, 于 `2021/12/01` 进行二次开
|
||||
* `修复` colors.pixel 方法无法接受单通道图像参数的问题 _[`issue #350`](http://issues.autojs6.com/350)_
|
||||
* `修复` engines.execScript/execScriptFile 等方法执行脚本时默认工作路径异常
|
||||
* `修复` floaty.window/floaty.rawWindow 无法在子线程执行的问题
|
||||
* `修复` floaty.getClip 可能无法正常获取剪切板内容的问题
|
||||
* `修复` ui.inflate 返回值丢失 attr/on/click 等原型方法的问题
|
||||
* `修复` 布局分析页面生成代码时可能导致应用崩溃的问题 _[`issue #288`](http://issues.autojs6.com/288)_
|
||||
* `修复` 打包应用无法正常使用 shizuku 模块的问题 _[`issue #227`](http://issues.autojs6.com/227)_ _[`issue #231`](http://issues.autojs6.com/231)_ _[`issue #284`](http://issues.autojs6.com/284)_ _[`issue #287`](http://issues.autojs6.com/287)_ _[`issue #304`](http://issues.autojs6.com/304)_
|
||||
@@ -194,6 +195,7 @@ AutoJs6 在 Auto.js 最终项目的基础上, 于 `2021/12/01` 进行二次开
|
||||
* `优化` APK 文件类型信息对话框增加点击监听器支持文本复制与应用详情跳转
|
||||
* `优化` 尝试恢复 com.stardust 前缀包以便提升代码兼容性 _[`issue #290`](http://issues.autojs6.com/290)_
|
||||
* `优化` floaty.window/floaty.rawWindow 同时支持主线程和子线程执行
|
||||
* `优化` getClip 全局方法适时借助 floaty.getClip 方法以提升兼容性
|
||||
* `优化` 部分依赖或本地库版本调整 _[`CHANGELOG.md`](http://project.autojs6.com/blob/master/app/src/main/assets-app/doc/CHANGELOG.md#v662)_
|
||||
|
||||
# v6.6.1
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
* `修复` colors.pixel 方法无法接受单通道图像参数的问题 _[`issue #350`](http://issues.autojs6.com/350)_
|
||||
* `修复` engines.execScript/execScriptFile 等方法执行脚本时默认工作路径异常
|
||||
* `修复` floaty.window/floaty.rawWindow 无法在子线程执行的问题
|
||||
* `修复` floaty.getClip 可能无法正常获取剪切板内容的问题
|
||||
* `修复` ui.inflate 返回值丢失 attr/on/click 等原型方法的问题
|
||||
* `修复` 布局分析页面生成代码时可能导致应用崩溃的问题 _[`issue #288`](http://issues.autojs6.com/288)_
|
||||
* `修复` 打包应用无法正常使用 shizuku 模块的问题 _[`issue #227`](http://issues.autojs6.com/227)_ _[`issue #231`](http://issues.autojs6.com/231)_ _[`issue #284`](http://issues.autojs6.com/284)_ _[`issue #287`](http://issues.autojs6.com/287)_ _[`issue #304`](http://issues.autojs6.com/304)_
|
||||
@@ -43,6 +44,7 @@
|
||||
* `优化` APK 文件类型信息对话框增加点击监听器支持文本复制与应用详情跳转
|
||||
* `优化` 尝试恢复 com.stardust 前缀包以便提升代码兼容性 _[`issue #290`](http://issues.autojs6.com/290)_
|
||||
* `优化` floaty.window/floaty.rawWindow 同时支持主线程和子线程执行
|
||||
* `优化` getClip 全局方法适时借助 floaty.getClip 方法以提升兼容性
|
||||
* `依赖` 升级 Gradle Compile 版本 34 -> 35
|
||||
* `依赖` 升级 Gradle 版本 8.12 -> 8.14-rc-1
|
||||
* `依赖` 升级 Rhino 版本 1.8.0-SNAPSHOT -> 1.8.1-SNAPSHOT
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
* `修复` colors.pixel 方法无法接受单通道图像参数的问题 _[`issue #350`](http://issues.autojs6.com/350)_
|
||||
* `修复` engines.execScript/execScriptFile 等方法执行脚本时默认工作路径异常
|
||||
* `修复` floaty.window/floaty.rawWindow 无法在子线程执行的问题
|
||||
* `修复` floaty.getClip 可能无法正常获取剪切板内容的问题
|
||||
* `修复` ui.inflate 返回值丢失 attr/on/click 等原型方法的问题
|
||||
* `修复` 布局分析页面生成代码时可能导致应用崩溃的问题 _[`issue #288`](http://issues.autojs6.com/288)_
|
||||
* `修复` 打包应用无法正常使用 shizuku 模块的问题 _[`issue #227`](http://issues.autojs6.com/227)_ _[`issue #231`](http://issues.autojs6.com/231)_ _[`issue #284`](http://issues.autojs6.com/284)_ _[`issue #287`](http://issues.autojs6.com/287)_ _[`issue #304`](http://issues.autojs6.com/304)_
|
||||
@@ -43,6 +44,7 @@
|
||||
* `优化` APK 文件类型信息对话框增加点击监听器支持文本复制与应用详情跳转
|
||||
* `优化` 尝试恢复 com.stardust 前缀包以便提升代码兼容性 _[`issue #290`](http://issues.autojs6.com/290)_
|
||||
* `优化` floaty.window/floaty.rawWindow 同时支持主线程和子线程执行
|
||||
* `优化` getClip 全局方法适时借助 floaty.getClip 方法以提升兼容性
|
||||
* `依赖` 升级 Gradle Compile 版本 34 -> 35
|
||||
* `依赖` 升级 Gradle 版本 8.12 -> 8.14-rc-1
|
||||
* `依赖` 升级 Rhino 版本 1.8.0-SNAPSHOT -> 1.8.1-SNAPSHOT
|
||||
|
||||
@@ -5,8 +5,10 @@ import android.content.Intent
|
||||
import android.view.ContextThemeWrapper
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import kotlinx.coroutines.Runnable
|
||||
import org.autojs.autojs.annotation.ScriptInterface
|
||||
import org.autojs.autojs.concurrent.VolatileDispose
|
||||
import org.autojs.autojs.core.floaty.BaseResizableFloatyWindow
|
||||
import org.autojs.autojs.core.floaty.RawWindow
|
||||
import org.autojs.autojs.core.ui.JsViewHelper
|
||||
@@ -18,14 +20,12 @@ import org.autojs.autojs.runtime.exception.ScriptInterruptedException
|
||||
import org.autojs.autojs.tool.UiHandler
|
||||
import org.autojs.autojs.ui.enhancedfloaty.FloatyService
|
||||
import org.autojs.autojs.util.RhinoUtils.NOT_CONSTRUCTABLE
|
||||
import org.autojs.autojs.util.RhinoUtils.isMainThread
|
||||
import org.autojs.autojs.util.RhinoUtils.isUiThread
|
||||
import org.autojs.autojs.util.RhinoUtils.newBaseFunction
|
||||
import org.autojs.autojs.util.ViewUtils.setViewMeasure
|
||||
import org.autojs.autojs6.R
|
||||
import java.util.concurrent.CopyOnWriteArraySet
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.math.max
|
||||
|
||||
/**
|
||||
* Created by Stardust on Dec 5, 2017.
|
||||
@@ -47,7 +47,7 @@ class Floaty(private val uiHandler: UiHandler, private val scriptRuntime: Script
|
||||
return JsResizableWindow(supplier).also { addWindow(it) }
|
||||
}
|
||||
|
||||
fun window(view: View): JsResizableWindow = window(object : BaseResizableFloatyWindow.ViewSupplier {
|
||||
fun window(view: View) = window(object : BaseResizableFloatyWindow.ViewSupplier {
|
||||
override fun inflate(context: Context, parent: ViewGroup?) = view
|
||||
})
|
||||
|
||||
@@ -60,7 +60,7 @@ class Floaty(private val uiHandler: UiHandler, private val scriptRuntime: Script
|
||||
return JsRawWindow(supplier).also { addWindow(it) }
|
||||
}
|
||||
|
||||
fun rawWindow(view: View) = JsRawWindow(object : BaseResizableFloatyWindow.ViewSupplier {
|
||||
fun rawWindow(view: View) = rawWindow(object : BaseResizableFloatyWindow.ViewSupplier {
|
||||
override fun inflate(context: Context, parent: ViewGroup?) = view
|
||||
})
|
||||
|
||||
@@ -96,18 +96,37 @@ class Floaty(private val uiHandler: UiHandler, private val scriptRuntime: Script
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
fun getClip(delay: Long = 0L): String {
|
||||
fun getClip(maxDelayAfterWindowReady: Long = 500L): String {
|
||||
val start = System.currentTimeMillis()
|
||||
val timeoutForAttachedToWindowManager: Long = 2_000
|
||||
val latch = CountDownLatch(1)
|
||||
val win = window(View(mContext).apply { visibility = View.INVISIBLE })
|
||||
UI.postRhinoRuntime(scriptRuntime, newBaseFunction("action", {
|
||||
val timeoutForAttachedToWindowManager = 1000L
|
||||
val view = FrameLayout(mContext)
|
||||
val win = rawWindow(view)
|
||||
UI.runRhinoRuntime(scriptRuntime, newBaseFunction("action", {
|
||||
while (System.currentTimeMillis() - start < timeoutForAttachedToWindowManager) {
|
||||
if (runCatching { win.requestFocus() }.isSuccess) break
|
||||
}
|
||||
}, NOT_CONSTRUCTABLE))
|
||||
latch.await(max(0, delay - (System.currentTimeMillis() - start)), TimeUnit.MILLISECONDS)
|
||||
return scriptRuntime.clip.also { win.close() }
|
||||
val getClipboardData = {
|
||||
val getter = { scriptRuntime.clip.also { win.close() } }
|
||||
val startTime = System.currentTimeMillis()
|
||||
var result = getter()
|
||||
while (System.currentTimeMillis() - startTime < maxDelayAfterWindowReady) {
|
||||
if (result.isNotBlank()) break
|
||||
Thread.sleep(10)
|
||||
result = getter()
|
||||
}
|
||||
result
|
||||
}
|
||||
return when {
|
||||
isMainThread() -> {
|
||||
getClipboardData()
|
||||
}
|
||||
else -> {
|
||||
val result = VolatileDispose<String>()
|
||||
scriptRuntime.uiHandler.post { result.setAndNotify(getClipboardData()) }
|
||||
result.blockedGetOrThrow(ScriptInterruptedException::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface JsWindow {
|
||||
|
||||
@@ -85,10 +85,10 @@ class Floaty(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
|
||||
@JvmStatic
|
||||
@RhinoRuntimeFunctionInterface
|
||||
fun getClip(scriptRuntime: ScriptRuntime, args: Array<out Any?>): String = ensureArgumentsAtMost(args, 1) { argList ->
|
||||
val (delay) = argList
|
||||
val (maxDelayAfterWindowReady) = argList
|
||||
when {
|
||||
delay.isJsNullish() -> scriptRuntime.floaty.getClip()
|
||||
else -> scriptRuntime.floaty.getClip(coerceLongNumber(delay!!, 0L))
|
||||
maxDelayAfterWindowReady.isJsNullish() -> scriptRuntime.floaty.getClip()
|
||||
else -> scriptRuntime.floaty.getClip(coerceLongNumber(maxDelayAfterWindowReady!!, 0L))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ class Floaty(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun toXMLString(xml: Any) = when (xml) {
|
||||
fun toXMLString(xml: Any): String = when (xml) {
|
||||
is XML -> xml.toXMLString()
|
||||
else -> xml.toString()
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.autojs.autojs.runtime.api.augment.global
|
||||
|
||||
import android.os.Build
|
||||
import io.github.g00fy2.versioncompare.Version
|
||||
import org.autojs.autojs.annotation.RhinoFunctionBody
|
||||
import org.autojs.autojs.annotation.RhinoRuntimeFunctionInterface
|
||||
@@ -295,7 +296,14 @@ class Global(private val scriptRuntime: ScriptRuntime) : Augmentable(scriptRunti
|
||||
@JvmStatic
|
||||
@RhinoRuntimeFunctionInterface
|
||||
fun getClip(scriptRuntime: ScriptRuntime, args: Array<out Any?>): String = ensureArgumentsIsEmpty(args) {
|
||||
scriptRuntime.clip
|
||||
val legacyResult = scriptRuntime.clip
|
||||
when {
|
||||
legacyResult.isNotEmpty() -> legacyResult
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && scriptRuntime.floaty.hasPermission() -> {
|
||||
scriptRuntime.floaty.getClip()
|
||||
}
|
||||
else -> legacyResult
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#Sat Apr 12 12:49:14 CST 2025
|
||||
BUILD_TIME=1744433354412
|
||||
#Sat Apr 12 21:14:15 CST 2025
|
||||
BUILD_TIME=1744463655564
|
||||
COMPILE_SDK_VERSION=35
|
||||
JAVA_VERSION=23
|
||||
JAVA_VERSION_MIN_RADICAL=0
|
||||
@@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
|
||||
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
||||
TARGET_SDK_VERSION=35
|
||||
TARGET_SDK_VERSION_INRT=29
|
||||
VERSION_BUILD=3128
|
||||
VERSION_BUILD=3130
|
||||
VERSION_NAME=6.6.2 Alpha6
|
||||
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
||||
|
||||
Reference in New Issue
Block a user