diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index da3f107a..d97f75ee 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/dictionaries/Stardust.xml b/.idea/dictionaries/Stardust.xml index 30ec0d12..49fb13b7 100644 --- a/.idea/dictionaries/Stardust.xml +++ b/.idea/dictionaries/Stardust.xml @@ -1,11 +1,15 @@ + autojs capturer dismissable + fileprovider flowable + imgproc interruptible loopers + opencv prefill scriptable storages diff --git a/app/build.gradle b/app/build.gradle index 96527d7a..9dceffa8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,9 @@ apply plugin: 'com.android.application' -def AAVersion = '4.4.0' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' +apply plugin: 'com.jakewharton.butterknife' + +def AAVersion = '4.5.2' def SupportLibVersion = '28.0.0' configurations.all { @@ -18,7 +22,7 @@ android { targetSdkVersion versions.target versionCode versions.appVersionCode versionName versions.appVersionName - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true ndk { abiFilters 'armeabi-v7a', 'x86' @@ -79,7 +83,7 @@ repositories { } dependencies { - androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { + androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1-alpha01', { exclude group: 'com.android.support', module: 'support-annotations' }) testImplementation 'junit:junit:4.12' @@ -87,17 +91,17 @@ dependencies { annotationProcessor "org.androidannotations:androidannotations:$AAVersion" implementation "org.androidannotations:androidannotations-api:$AAVersion" // ButterKnife - implementation('com.jakewharton:butterknife:8.8.1', { + implementation('com.jakewharton:butterknife:9.0.0-rc2', { exclude group: 'com.android.support' }) - annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' + annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc2' // Android supports - implementation "com.android.support:appcompat-v7:${SupportLibVersion}" - implementation "com.android.support:cardview-v7:${SupportLibVersion}" - implementation "com.android.support:design:${SupportLibVersion}" - implementation 'com.android.support:multidex:1.0.3' + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'com.google.android.material:material:1.1.0-alpha01' + implementation 'androidx.multidex:multidex:2.0.0' // Personal libraries - implementation 'com.github.hyb1996:MutableTheme:0.2.2' + implementation 'com.github.hyb1996:MutableTheme:1.0.0' // Material Dialogs implementation('com.afollestad.material-dialogs:core:0.9.2.3', { exclude group: 'com.android.support' @@ -136,7 +140,7 @@ dependencies { implementation('com.github.bumptech.glide:glide:4.8.0', { exclude group: 'com.android.support' }) - annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0' + kapt 'com.github.bumptech.glide:compiler:4.8.0' //joda time implementation 'joda-time:joda-time:2.9.9' // Tasker Plugin @@ -156,5 +160,4 @@ dependencies { implementation project(':automator') implementation project(':common') implementation project(':autojs') - implementation (name: 'ads8', ext: 'aar') } \ No newline at end of file diff --git a/app/libs/ads8.aar b/app/libs/ads8.aar deleted file mode 100644 index 4bcbc834..00000000 Binary files a/app/libs/ads8.aar and /dev/null differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8b24cc0c..816de626 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,6 +14,8 @@ + + @@ -29,7 +31,7 @@ android:name=".App" android:allowBackup="false" android:icon="@drawable/autojs_material" - android:label="@string/_app_name" + android:label="@string/app_name" android:largeHeap="true" android:supportsRtl="true" android:theme="@style/AppTheme" @@ -43,7 +45,7 @@ @@ -54,7 +56,7 @@ @@ -115,6 +117,10 @@ + + + + @@ -269,23 +275,9 @@ - - - - - - - - - diff --git a/app/src/main/assets/sample/协程/ui中使用协程/main.js b/app/src/main/assets/sample/协程/ui中使用协程/main.js new file mode 100644 index 00000000..5baee904 --- /dev/null +++ b/app/src/main/assets/sample/协程/ui中使用协程/main.js @@ -0,0 +1,24 @@ +"ui"; + +ui.layout( + + + UI中使用协程 + + +); + +continuation.delay(5000); +if (!requestScreenCapture()) { + dialogs.alert("请授予软件截图权限").await(); +} + + +// 退出应用对话框 +ui.emitter.on("back_pressed", function (e) { + e.consumed = true; + let exit = dialogs.confirm("确定要退出程序").await(); + if (exit) { + ui.finish(); + } +}); \ No newline at end of file diff --git a/app/src/main/assets/sample/协程/ui中使用协程/project.json b/app/src/main/assets/sample/协程/ui中使用协程/project.json new file mode 100644 index 00000000..8afb2e9c --- /dev/null +++ b/app/src/main/assets/sample/协程/ui中使用协程/project.json @@ -0,0 +1,11 @@ +{ + "name": "协程UI示例", + "main": "main.js", + "ignore": [ + "build" + ], + "packageName": "com.example.cont.ui", + "versionName": "1.0.0", + "versionCode": 1, + "useFeatures": ["continuation"] +} \ No newline at end of file diff --git a/app/src/main/assets/sample/协程/协程HelloWorld/hello.txt b/app/src/main/assets/sample/协程/协程HelloWorld/hello.txt new file mode 100644 index 00000000..9be9bcf8 --- /dev/null +++ b/app/src/main/assets/sample/协程/协程HelloWorld/hello.txt @@ -0,0 +1 @@ +Nothing \ No newline at end of file diff --git a/app/src/main/assets/sample/协程/协程HelloWorld/main.js b/app/src/main/assets/sample/协程/协程HelloWorld/main.js new file mode 100644 index 00000000..9e93812a --- /dev/null +++ b/app/src/main/assets/sample/协程/协程HelloWorld/main.js @@ -0,0 +1,54 @@ +// 注意,要使用协程这个特性,必须使用项目功能,并且在project.json配置好features属性 + + +// delay不同于sleep,不会阻塞当前线程 +function delay(millis) { + var cont = continuation.create(); + setTimeout(()=>{ + cont.resume(); + }, millis); + cont.await(); +} + +// 异步IO例子,在另一个线程读取文件,读取完成后返回当前线程继续执行 +function read(path) { + var cont = continuation.create(); + threads.start(function(){ + try { + cont.resume(files.read(path)); + }catch(err){ + cont.resumeError(err); + } + }); + return cont.await(); +} + +// 使用Promise和协程的例子 +function add(a, b) { + return new Promise(function(resolve, reject) { + var sum = a + b; + resolve(sum); + }); +} + +toastLog("Hello, Continuation!"); + +//3秒后发出提示 +setTimeout(()=>{ + toastLog("3秒后...."); +}, 3000); + +// 你可以尝试把delay更换成sleep,看会发生什么! +delay(6000); +toastLog("6秒后..."); + +try { + toastLog("读取文件hello.txt: " + read("./hello.txt")); +}catch(err){ + console.error(err); +} + +var sum = add(1, 2).await(); +toastLog("1 + 2 = " + sum); + + diff --git a/app/src/main/assets/sample/协程/协程HelloWorld/project.json b/app/src/main/assets/sample/协程/协程HelloWorld/project.json new file mode 100644 index 00000000..dccfca87 --- /dev/null +++ b/app/src/main/assets/sample/协程/协程HelloWorld/project.json @@ -0,0 +1,11 @@ +{ + "name": "协程HelloWorld", + "main": "main.js", + "ignore": [ + "build" + ], + "packageName": "com.example.cont.helloworld", + "versionName": "1.0.0", + "versionCode": 1, + "useFeatures": ["continuation"] +} \ No newline at end of file diff --git a/app/src/main/assets/sample/图片与图色处理/图片处理.js b/app/src/main/assets/sample/图片与图色处理/图片处理.js new file mode 100644 index 00000000..654c56ad --- /dev/null +++ b/app/src/main/assets/sample/图片与图色处理/图片处理.js @@ -0,0 +1,142 @@ +"ui"; + +var url = "https://www.autojs.org/assets/uploads/files/1540386817060-918021-20160416200702191-185324559.jpg"; +var logo = null; +var currentImg = null; + +events.on("exit", function(){ + if(logo != null){ + logo.recycle(); + } + if(currentImg != null){ + currentImg.recycle(); + } +}); + +ui.layout( + + + + +