diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000000000000000000000000000000000..ebe51d3bfa4701e67ca2c77b074ab814a7d506e3
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+# EditorConfig is awesome: https://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = false
+insert_final_newline = false
\ No newline at end of file
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 85e0d2c8df3ded51a4f2f07b826c2584b1091478..eae83d6fd83c391515a4f90751cf239d5ac55ebc 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -6,15 +6,14 @@
>
-
-
-
-
+
+
+
+
+
+
+
diff --git a/App.vue b/App.vue
index 50d83e88dfadd86f001984f4cfac4c6ea1827412..6399c949db89b718ade6e99567a93bc22fd74fd2 100644
--- a/App.vue
+++ b/App.vue
@@ -1,42 +1,44 @@
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index 3ca6c1402d91805fdb93a9f3547afb9a60901384..f84c511e1718babbfb79c581fbb1aeb25f52e4af 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,78 +1,67 @@
{
- "name": "HelloUTS",
- "appid": "__UNI__70BE9D0",
- "description": "",
- "versionName": "1.0.9",
- "versionCode": "109",
- "transformPx": false,
- /* 5+App特有相关 */
- "app-plus": {
- "usingComponents": true,
- "nvueStyleCompiler": "uni-app",
- "compilerVersion": 3,
- "splashscreen": {
- "alwaysShowBeforeRender": true,
- "waiting": true,
- "autoclose": true,
- "delay": 0
- },
- /* 模块配置 */
- "modules": {},
- /* 应用发布信息 */
- "distribute": {
- /* android打包配置 */
- "android": {
- "permissions": [
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- ""
- ],
- "minSdkVersion": 21,
- "abiFilters": ["armeabi-v7a"]
- },
- /* ios打包配置 */
- "ios": {
- "dSYMs": false
- },
- /* SDK配置 */
- "sdkConfigs": {
- "ad": {}
- }
- }
- },
- /* 快应用特有相关 */
- "quickapp": {},
- /* 小程序特有相关 */
- "mp-weixin": {
- "appid": "",
- "setting": {
- "urlCheck": false
- },
- "usingComponents": true
- },
- "mp-alipay": {
- "usingComponents": true
- },
- "mp-baidu": {
- "usingComponents": true
- },
- "mp-toutiao": {
- "usingComponents": true
- },
- "uniStatistics": {
- "enable": false
- },
- "vueVersion": "3"
-}
\ No newline at end of file
+ "name" : "HelloUTS",
+ "appid" : "__UNI__70BE9D0",
+ "description" : "",
+ "versionName" : "1.0.9",
+ "versionCode" : "109",
+ "transformPx" : false,
+ /* 5+App特有相关 */
+ "app-plus" : {
+ "usingComponents" : true,
+ "nvueStyleCompiler" : "uni-app",
+ "compilerVersion" : 3,
+ "splashscreen" : {
+ "alwaysShowBeforeRender" : true,
+ "waiting" : true,
+ "autoclose" : true,
+ "delay" : 0
+ },
+ /* 模块配置 */
+ "modules" : {},
+ /* 应用发布信息 */
+ "distribute" : {
+ /* android打包配置 */
+ "android" : {
+ "permissions" : [
+ "",
+ ""
+ ],
+ "minSdkVersion" : 21,
+ "abiFilters" : [ "arm64-v8a" ]
+ },
+ /* ios打包配置 */
+ "ios" : {
+ "dSYMs" : false
+ },
+ /* SDK配置 */
+ "sdkConfigs" : {
+ "ad" : {}
+ }
+ }
+ },
+ /* 快应用特有相关 */
+ "quickapp" : {},
+ /* 小程序特有相关 */
+ "mp-weixin" : {
+ "appid" : "",
+ "setting" : {
+ "urlCheck" : false
+ },
+ "usingComponents" : true
+ },
+ "mp-alipay" : {
+ "usingComponents" : true
+ },
+ "mp-baidu" : {
+ "usingComponents" : true
+ },
+ "mp-toutiao" : {
+ "usingComponents" : true
+ },
+ "uniStatistics" : {
+ "enable" : false
+ },
+ "vueVersion" : "3"
+}
+/* ios打包配置 *//* SDK配置 */
+
diff --git a/pages.json b/pages.json
index 0a211d1fa2cb222003bf6e699220e4f813e67765..2b4ec8dc2e4927812b7df07a9c8b5737475c92f6 100644
--- a/pages.json
+++ b/pages.json
@@ -91,13 +91,6 @@
"enablePullDownRefresh": false
}
},
- {
- "path": "pages/resource/fileRead",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
{
"path": "pages/advance/android/decorview",
"style": {
diff --git a/pages/SyntaxCase/utsAndroid.uvue b/pages/SyntaxCase/utsAndroid.uvue
index 2eb8636fb4ccfc5fcc0eee987f9aba0a2cce9b0e..10952251fbc4f69d1a521b7f470f0aff5f3d7c3f 100644
--- a/pages/SyntaxCase/utsAndroid.uvue
+++ b/pages/SyntaxCase/utsAndroid.uvue
@@ -39,6 +39,7 @@
获取设备信息,观察是否符合预期
+
@@ -62,6 +63,8 @@ import {
getDeviceInfoTest,
privacyStateTest,
} from '@/uni_modules/uts-platform-api'
+import File from 'java.io.File';
+import Intent from 'android.content.Intent';
/**
* 测试在页面生命周期之外,使用api
@@ -157,6 +160,15 @@ export default {
})
}
},
+ getFileProviderUriClick() {
+ let file = new File(UTSAndroid.getResourcePath("static/logo.png"))
+ const uri = UTSAndroid.getFileProviderUri(file)
+ console.log("uri",uri.toString())
+ const intent = new Intent(Intent.ACTION_VIEW, uri)
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) // 添加权限标志
+ const context = UTSAndroid.getUniActivity()!;
+ context.startActivity(intent);
+ },
getAppTempPathClick() {
if (getAppTempPathTest()) {
uni.showToast({
diff --git a/pages/advance/advance.vue b/pages/advance/advance.vue
index b8e961bfd5deb81fb1725ff03f565a6a41b03dc0..494e01a4c45043bc2965ef54db727b2e603d85e4 100644
--- a/pages/advance/advance.vue
+++ b/pages/advance/advance.vue
@@ -28,7 +28,7 @@
arrayConvert
} from "../../uni_modules/uts-advance";
- import {openFileWithProvider} from '../../uni_modules/uts-nativepage'
+ import {openFileWithProvider} from '../../uni_modules/uts-advance'
export default {
data() {
@@ -61,9 +61,6 @@
pages: [{
name: "图片加载示例",
url: "resource/resource"
- },{
- name: "文件读取示例",
- url: "resource/fileRead"
}]
},
{
@@ -85,7 +82,7 @@
url: "advance/android/assetaudio"
},
{
- name: "使用三方应用打开项目文件(需自定义基座)",
+ name: "使用三方应用打开项目文件",
function: "testOpenFileWithProvider"
},
{
diff --git a/pages/resource/fileRead.uvue b/pages/resource/fileRead.uvue
deleted file mode 100644
index 18c4fcf26631ca6780b8569fb121d377e0228f9d..0000000000000000000000000000000000000000
--- a/pages/resource/fileRead.uvue
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/pages/resource/fileRead.vue b/pages/resource/fileRead.vue
deleted file mode 100644
index b5b876973b037d3bab14b2a480257f3db134378b..0000000000000000000000000000000000000000
--- a/pages/resource/fileRead.vue
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/uni_modules/uts-advance/utssdk/app-android/index.uts b/uni_modules/uts-advance/utssdk/app-android/index.uts
index 17e7b568d0097e53a8e5cdf5657fc8cbaab319c2..9537af668eaf1984e387c1d0c0893f68c13b5d80 100644
--- a/uni_modules/uts-advance/utssdk/app-android/index.uts
+++ b/uni_modules/uts-advance/utssdk/app-android/index.uts
@@ -554,3 +554,13 @@ export function arrayConvert():boolean{
return true
}
+
+export function openFileWithProvider(url:String){
+ let file = new File(UTSAndroid.getResourcePath("static/logo.png"))
+ const uri = UTSAndroid.getFileProviderUri(file)
+ console.log("uri",uri.toString())
+ const intent = new Intent(Intent.ACTION_VIEW, uri)
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) // 添加权限标志
+ const context = UTSAndroid.getUniActivity()!;
+ context.startActivity(intent);
+}
diff --git a/uni_modules/uts-alert/utssdk/app-android/index.uts b/uni_modules/uts-alert/utssdk/app-android/index.uts
index c0b82d1c76e00ee7f42c8fe791984913a4e468a4..6a74a209df435de8f56b4ad894700c881d04c8cb 100644
--- a/uni_modules/uts-alert/utssdk/app-android/index.uts
+++ b/uni_modules/uts-alert/utssdk/app-android/index.uts
@@ -1,5 +1,3 @@
-
-
import Toast from 'android.widget.Toast';
import AlertDialog from 'android.app.AlertDialog';
import DialogInterface from 'android.content.DialogInterface';
diff --git a/uni_modules/uts-file-manager/changelog.md b/uni_modules/uts-file-manager/changelog.md
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/uni_modules/uts-file-manager/package.json b/uni_modules/uts-file-manager/package.json
deleted file mode 100644
index e69ed1a39539b73d3862a051c12bf630ea83c1c0..0000000000000000000000000000000000000000
--- a/uni_modules/uts-file-manager/package.json
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "id": "uts-file-manager",
- "displayName": "uts-file-manager",
- "version": "1.0.0",
- "description": "uts-file-manager",
- "keywords": [
- "uts-file-manager"
-],
- "repository": "",
- "engines": {
- "HBuilderX": "^3.6.8"
- },
- "dcloudext": {
- "type": "uts",
- "sale": {
- "regular": {
- "price": "0.00"
- },
- "sourcecode": {
- "price": "0.00"
- }
- },
- "contact": {
- "qq": ""
- },
- "declaration": {
- "ads": "",
- "data": "",
- "permissions": ""
- },
- "npmurl": ""
- },
- "uni_modules": {
- "dependencies": [],
- "encrypt": [],
- "platforms": {
- "cloud": {
- "tcb": "u",
- "aliyun": "u"
- },
- "client": {
- "Vue": {
- "vue2": "u",
- "vue3": "u"
- },
- "App": {
- "app-android": "u",
- "app-ios": "u"
- },
- "H5-mobile": {
- "Safari": "u",
- "Android Browser": "u",
- "微信浏览器(Android)": "u",
- "QQ浏览器(Android)": "u"
- },
- "H5-pc": {
- "Chrome": "u",
- "IE": "u",
- "Edge": "u",
- "Firefox": "u",
- "Safari": "u"
- },
- "小程序": {
- "微信": "u",
- "阿里": "u",
- "百度": "u",
- "字节跳动": "u",
- "QQ": "u",
- "钉钉": "u",
- "快手": "u",
- "飞书": "u",
- "京东": "u"
- },
- "快应用": {
- "华为": "u",
- "联盟": "u"
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/uni_modules/uts-file-manager/readme.md b/uni_modules/uts-file-manager/readme.md
deleted file mode 100644
index 71f9adf51afbff4c8b47dfd0155b0ceb7a1db2fc..0000000000000000000000000000000000000000
--- a/uni_modules/uts-file-manager/readme.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# uts-file-manager
-### 开发文档
-[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html)
-[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html)
-[UTS 组件插件](https://uniapp.dcloud.net.cn/plugin/uts-component.html)
-[Hello UTS](https://gitcode.net/dcloud/hello-uts)
\ No newline at end of file
diff --git a/uni_modules/uts-file-manager/utssdk/app-android/index.uts b/uni_modules/uts-file-manager/utssdk/app-android/index.uts
deleted file mode 100644
index d92f48fe4ba0c09e6dc3f167c51d5aa06d63b311..0000000000000000000000000000000000000000
--- a/uni_modules/uts-file-manager/utssdk/app-android/index.uts
+++ /dev/null
@@ -1,125 +0,0 @@
-import { ReadFileSuccessResult, ReadFile,ReadFileOptions } from "../interface.uts"
-import { WriteFileSuccessResult, WriteFile,WriteFileOptions } from "../interface.uts"
-import { GetFileSystemManager,FileSystemManager} from "../interface.uts"
-import { UniErrorSubject, UniErrors } from "../unierror.uts"
-
-import File from "java.io.File"
-import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
-import Base64 from "android.util.Base64"
-
-export { ReadFileOptions, WriteFileOptions } from "../interface.uts"
-
-
-class AndroidFileSystemManager implements FileSystemManager{
-
- public readFile(options : ReadFileOptions) {
-
- // 判断type 是否合法
- if(options.encoding != 'base64' && options.encoding != 'utf-8'){
- let err = new UniError(UniErrorSubject, 1200002, UniErrors.get(1200002)!);
- options.fail?.(err)
- options.complete?.(err)
- return
- }
-
- let filePath = UTSAndroid.convert2AbsFullPath(options.filePath)
- let targetFile = new File(filePath)
- if (!targetFile.exists()) {
- let err = new UniError(UniErrorSubject, 1300002, UniErrors.get(1300002)! + filePath);
- options.fail?.(err)
- options.complete?.(err)
- return
- }
-
- if (targetFile.isDirectory()) {
- let err = new UniError(UniErrorSubject,1301003,UniErrors.get(1301003)!);
- options.fail?.(err)
- options.complete?.(err)
- return
- }
-
- /**
- * 文件超过16M,会超过应用内存
- */
- if (targetFile.length() > 16 * 1024 * 1024) {
- let err = new UniError(UniErrorSubject,1300202,UniErrors.get(1300202)!);
- options.fail?.(err)
- options.complete?.(err)
- return
- }
-
- let currentDispatcher = UTSAndroid.getDispatcher()
- /**
- * 执行真正的加载行为,为了避免阻塞分发到 io任务序列
- */
- UTSAndroid.dispatchAsync('io',function(_){
-
- let ret : ReadFileSuccessResult = {
- data : ""
- }
-
- if(options.encoding == 'base64'){
- // base64
- let byteArray = targetFile.readBytes()
- let base64Content = Base64.encodeToString(byteArray,Base64.NO_WRAP)
- ret.data = base64Content
-
- }else{
- // text
- let text = targetFile.readText()
- ret.data = text
- }
-
- currentDispatcher.async(function(_){
- options.success?.(ret)
- options.complete?.(ret)
- })
-
- },null)
-
- }
-
-
- public writeFile(options : WriteFileOptions) {
- // 判断type 是否合法
- let nextFile = new File(UTSAndroid.getAppContext()?.getFilesDir(),options.filePath)
- if(nextFile.exists() && nextFile.isDirectory()){
- // 出错了,目标文件已存在,并且是个目录
- let err = new UniError(UniErrorSubject,1301003,UniErrors.get(1301003)!);
- options.fail?.(err)
- options.complete?.(err)
- return
- }
-
-
- let currentDispatcher = UTSAndroid.getDispatcher()
- UTSAndroid.dispatchAsync('io',function(_){
-
- /**
- * 如果上一级目录不存在,创建之
- */
- if(!nextFile.parentFile.exists()){
- nextFile.parentFile.mkdirs()
- }
-
- if(!nextFile.exists()){
- nextFile.createNewFile()
- }
- // 写入文本,暂时只支持覆盖写入
- nextFile.writeText(options.data)
-
- let ret : WriteFileSuccessResult = {
- filePath: nextFile.getPath()
- }
-
- currentDispatcher.async(function(_){
- options.success?.(ret)
- options.complete?.(ret)
- })
- },null)
- }
-}
-
-export const getFileSystemManager:GetFileSystemManager = function ():FileSystemManager {
- return new AndroidFileSystemManager()
-};
diff --git a/uni_modules/uts-file-manager/utssdk/app-ios/index.uts b/uni_modules/uts-file-manager/utssdk/app-ios/index.uts
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/uni_modules/uts-file-manager/utssdk/interface.uts b/uni_modules/uts-file-manager/utssdk/interface.uts
deleted file mode 100644
index 384a6294ee1ca75fbf87fadc1237660542ce3dfb..0000000000000000000000000000000000000000
--- a/uni_modules/uts-file-manager/utssdk/interface.uts
+++ /dev/null
@@ -1,106 +0,0 @@
-
-export type ReadFileSuccessResult = {
- data: string
-}
-
-
-export type ReadFileSuccessCallback = (res: ReadFileSuccessResult) => void
-
-export type ReadFileFailCallback = (res: UniError) => void
-
-export type ReadFileCompleteCallback = (res: any) => void
-
-
-
-export type ReadFileOptions = {
- /**
- * base64 / utf-8
- */
- encoding: string,
- /**
- * 文件路径,支持相对地址和绝对地址
- */
- filePath: string,
- /**
- * 接口调用的回调函数
- */
- success?: ReadFileSuccessCallback | null,
- /**
- * 接口调用失败的回调函数
- */
- fail?: ReadFileFailCallback | null,
- /**
- * 接口调用结束的回调函数(调用成功、失败都会执行)
- */
- complete?: ReadFileCompleteCallback | null
-}
-
-
-export type WriteFileSuccessResult = {
- filePath: string,
-}
-
-
-export type WriteFileSuccessCallback = (res: WriteFileSuccessResult) => void
-
-export type WriteFileFailCallback = (res: UniError) => void
-
-export type WriteFileCompleteCallback = (res: any) => void
-
-
-export type WriteFileOptions = {
- /**
- * 文件路径,只支持绝对地址
- */
- filePath: string,
- /**
- * 写入的文本内容
- */
- data: string,
- /**
- * 接口调用的回调函数
- */
- success?: WriteFileSuccessCallback | null,
- /**
- * 接口调用失败的回调函数
- */
- fail?: WriteFileFailCallback | null,
- /**
- * 接口调用结束的回调函数(调用成功、失败都会执行)
- */
- complete?: WriteFileCompleteCallback | null
-}
-
-
-export interface FileSystemManager {
- readFile(config: ReadFileOptions): void;
- writeFile(config: WriteFileOptions): void;
-}
-
-
-export type GetFileSystemManager = () => FileSystemManager;
-
-
-export interface Uni {
- /**
- * 获取文件管理器
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "4.4.4",
- * "uniVer": "√",
- * "unixVer": "3.9.0"
- * },
- * "ios": {
- * "osVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- * @uniVueVersion 2,3 //支持的vue版本
- */
- getFileSystemManager: GetFileSystemManager
-}
-
-
diff --git a/uni_modules/uts-file-manager/utssdk/unierror.uts b/uni_modules/uts-file-manager/utssdk/unierror.uts
deleted file mode 100644
index ca89a7af00111d7b94368cd451c1c492175bcb84..0000000000000000000000000000000000000000
--- a/uni_modules/uts-file-manager/utssdk/unierror.uts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * 错误主题
- */
-export const UniErrorSubject = 'uni-file-manager';
-
-
-/**
- * 错误码
- * @UniError
- */
-export const UniErrors:Map = new Map([
-
- [1200002, 'type error. only support base64 / utf-8'],
- [1300002, 'no such file or directory'],
- [1301003, 'illegal operation on a directory'],
- [1300202, 'the maximum size of the file storage limit is exceeded'],
-
-]);
diff --git a/uni_modules/uts-getbatteryinfo/utssdk/app-android/index.uts b/uni_modules/uts-getbatteryinfo/utssdk/app-android/index.uts
index b000819640a54caa421ea3b55d740061971d5f8f..ab4dac133bd83217235909530fc6b7e09d93c28b 100644
--- a/uni_modules/uts-getbatteryinfo/utssdk/app-android/index.uts
+++ b/uni_modules/uts-getbatteryinfo/utssdk/app-android/index.uts
@@ -1,7 +1,5 @@
import Context from "android.content.Context";
import BatteryManager from "android.os.BatteryManager";
-
-import { UTSAndroid } from "io.dcloud.uts";
import IntentFilter from 'android.content.IntentFilter';
import Intent from 'android.content.Intent';
diff --git a/uni_modules/uts-hello-component/utssdk/app-android/index.vue b/uni_modules/uts-hello-component/utssdk/app-android/index.vue
index 47fb09f896a94abf579ae0084579c24f4ce92775..2af780529273ee5306d7725fc243ffa656af4d95 100644
--- a/uni_modules/uts-hello-component/utssdk/app-android/index.vue
+++ b/uni_modules/uts-hello-component/utssdk/app-android/index.vue
@@ -1,5 +1,6 @@
+
-
+
@@ -7,11 +8,12 @@
import TextUtils from 'android.text.TextUtils'
import Button from 'android.widget.Button'
import LinearLayout from 'android.widget.LinearLayout'
- import Color from 'android.graphics.Color'
import View from 'android.view.View'
class ButtonClickListsner extends View.OnClickListener {
- constructor() {}
+ constructor() {
+ super()
+ }
override onClick(v ? : View) {
console.log(v)
}
@@ -19,21 +21,35 @@
//原生提供以下属性或方法的实现
export default {
-
+ /**
+ * 组件名称,也就是开发者使用的标签
+ */
name: "uts-hello-view",
-
+ /**
+ * 组件涉及的事件声明,只有声明过的事件,才能被正常发送
+ */
+ emits: ['buttonClick'],
+ /**
+ * 属性声明,组件的使用者会传递这些属性值到组件
+ */
props: {
-
+ /**
+ * 字符串类型 属性:buttonText 需要设置默认值
+ */
"buttonText": {
type: String,
default: "点击触发"
}
},
-
+ /**
+ * 组件内部变量声明
+ */
data() {
return {}
},
-
+ /**
+ * 属性变化监听器实现
+ */
watch: {
"buttonText": {
/**
@@ -47,26 +63,105 @@
}
}
},
- immediate: false
+ immediate: false //创建时是否通过此方法更新属性,默认值为false
+ },
+ },
+ /**
+ * 规则:如果没有配置expose,则methods中的方法均对外暴露,如果配置了expose,则以expose的配置为准向外暴露
+ * ['publicMethod'] 含义为:只有 `publicMethod` 在实例上可用
+ */
+ expose: ['doSth'],
+ methods: {
+ /**
+ * 对外公开的组件方法
+ */
+ doSth(paramA: string) {
+ // 这是组件的自定义方法
+ console.log("paramA",paramA)
},
+ /**
+ * 内部使用的组件方法
+ */
+ privateMethod() {
+
+ }
+ },
+
+ /**
+ * 组件被创建,组件第一个生命周期,
+ * 在内存中被占用的时候被调用,开发者可以在这里执行一些需要提前执行的初始化逻辑
+ * [可选实现]
+ */
+ created() {
+
},
+ /**
+ * 对应平台的view载体即将被创建,对应前端beforeMount
+ * [可选实现]
+ */
+ NVBeforeLoad() {
+ },
+ /**
+ * 创建原生View,必须定义返回值类型
+ * 开发者需要重点实现这个函数,声明原生组件被创建出来的过程,以及最终生成的原生组件类型
+ * (Android需要明确知道View类型,需特殊校验)
+ * todo 补充IOS平台限制
+ * [必须实现]
+ */
NVLoad(): LinearLayout {
//必须实现
- let contentLayout = new LinearLayout($androidContext)
- let button = new Button($androidContext)
+ let contentLayout = new LinearLayout(this.$androidContext)
+ let button = new Button(this.$androidContext)
button.setText("点击触发");
button.setTag("centerButton");
- contentLayout.addView(button, LinearLayout.LayoutParams(500, 500));
+ contentLayout.addView(button, new LinearLayout.LayoutParams(500, 500));
button.setOnClickListener(new ButtonClickListsner())
return contentLayout
+ },
+
+ /**
+ * 原生View已创建
+ * [可选实现]
+ */
+ NVLoaded() {
+
+ },
+ /**
+ * 原生View布局完成
+ * [可选实现]
+ */
+ NVLayouted() {
+
+ },
+ /**
+ * 原生View将释放
+ * [可选实现]
+ */
+ NVBeforeUnload() {},
+ /**
+ * 原生View已释放,这里可以做释放View之后的操作
+ * [可选实现]
+ */
+ NVUnloaded() {
+
+ },
+ /**
+ * 组件销毁
+ * [可选实现]
+ */
+ unmounted() {},
+ /**
+ * 自定组件布局尺寸
+ * [可选实现]
+ */
+ NVMeasure(size: UTSSize): UTSSize {
+ size.width = 120.0.toFloat()
+ size.height = 800.0.toFloat()
+ return size
}
}
+
+
\ No newline at end of file
diff --git a/uni_modules/uts-nativepage/utssdk/app-android/DoAppWidget.uts b/uni_modules/uts-nativepage/utssdk/app-android/DoAppWidget.uts
index 555b57c84d0d310b0504d93e8274f59f74216242..29ec6e3623bb6bd27379ad8298f7be6d4e90b9a1 100644
--- a/uni_modules/uts-nativepage/utssdk/app-android/DoAppWidget.uts
+++ b/uni_modules/uts-nativepage/utssdk/app-android/DoAppWidget.uts
@@ -2,7 +2,6 @@ import AppWidgetProvider from 'android.appwidget.AppWidgetProvider';
import Context from 'android.content.Context';
import AppWidgetManager from 'android.appwidget.AppWidgetManager';
import RemoteViews from 'android.widget.RemoteViews';
-import Handler from 'android.os.Handler';
import R from 'io.dcloud.uni_modules.uts_nativepage.R';
export class DoAppWidget extends AppWidgetProvider {
diff --git a/uni_modules/uts-nativepage/utssdk/app-android/index.uts b/uni_modules/uts-nativepage/utssdk/app-android/index.uts
index 4191d8f290a3e208984d3a85a7d0a7950c1765d8..5820a8c23992de108a62ba31d43aeca0ba49f9cd 100644
--- a/uni_modules/uts-nativepage/utssdk/app-android/index.uts
+++ b/uni_modules/uts-nativepage/utssdk/app-android/index.uts
@@ -20,7 +20,6 @@ import Toast from 'android.widget.Toast';
import Service from 'android.app.Service';
import System from 'java.lang.System';
import Exception from 'java.lang.Exception';
-import ResolveInfo from 'android.content.pm.ResolveInfo';
import RecyclerView from 'androidx.recyclerview.widget.RecyclerView';
import TextView from 'android.widget.TextView';
import ViewGroup from 'android.view.ViewGroup';
@@ -185,6 +184,21 @@ class ActivityFinishListener extends OnClickListener{
}
}
+class RootActivityStartListener extends OnClickListener{
+
+ host:Activity
+
+ constructor(activity:Activity){
+ super()
+ this.host = activity
+ }
+
+ override onClick(v?: View):void{
+ let intent = Intent("uni.UNI70BE9D0.RootPackageActivity")
+ host.startActivity(intent)
+ }
+}
+
/**
* 自定义异步线程
*/
@@ -263,12 +277,13 @@ class DemoActivity extends Activity{
let btn_finish_activity = this.findViewById