diff --git a/uni_modules/uts-alert/utssdk/app-android/index.uts b/uni_modules/uts-alert/utssdk/app-android/index.uts
index e221cc86068505fed94255a730ad3501ecd5e339..6a74a209df435de8f56b4ad894700c881d04c8cb 100644
--- a/uni_modules/uts-alert/utssdk/app-android/index.uts
+++ b/uni_modules/uts-alert/utssdk/app-android/index.uts
@@ -1,8 +1,3 @@
-
-import {
- UTSAndroid
-} from "io.dcloud.uts";
-
import Toast from 'android.widget.Toast';
import AlertDialog from 'android.app.AlertDialog';
import DialogInterface from 'android.content.DialogInterface';
diff --git a/uni_modules/uts-animation-view/utssdk/app-android/index.vue b/uni_modules/uts-animation-view/utssdk/app-android/index.vue
index d47fe8869eeb86032e1dba8b07db993615c712f8..a298254b1fa8abde48f0a7edf7ed67dbf2d5f2cf 100644
--- a/uni_modules/uts-animation-view/utssdk/app-android/index.vue
+++ b/uni_modules/uts-animation-view/utssdk/app-android/index.vue
@@ -10,7 +10,6 @@
import LottieAnimationView from 'com.airbnb.lottie.LottieAnimationView'
import LottieDrawable from 'com.airbnb.lottie.LottieDrawable'
import FileInputStream from 'java.io.FileInputStream'
- import { UTSAndroid } from "io.dcloud.uts";
class CustomAnimListener extends Animator.AnimatorListener {
diff --git a/uni_modules/uts-file-manager/utssdk/app-android/index.uts b/uni_modules/uts-file-manager/utssdk/app-android/index.uts
index d92f48fe4ba0c09e6dc3f167c51d5aa06d63b311..1d0c5ceb3c6c9d3066ed86ffacdd6253cdc90e56 100644
--- a/uni_modules/uts-file-manager/utssdk/app-android/index.uts
+++ b/uni_modules/uts-file-manager/utssdk/app-android/index.uts
@@ -1,10 +1,9 @@
-import { ReadFileSuccessResult, ReadFile,ReadFileOptions } from "../interface.uts"
-import { WriteFileSuccessResult, WriteFile,WriteFileOptions } from "../interface.uts"
+import { ReadFileSuccessResult, ReadFileOptions } from "../interface.uts"
+import { WriteFileSuccessResult, 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"
diff --git a/uni_modules/uts-getbatteryinfo/utssdk/app-android/index.uts b/uni_modules/uts-getbatteryinfo/utssdk/app-android/index.uts
index 4207108493c4be15d0dcfa3da5703dd37c7f240a..ab4dac133bd83217235909530fc6b7e09d93c28b 100644
--- a/uni_modules/uts-getbatteryinfo/utssdk/app-android/index.uts
+++ b/uni_modules/uts-getbatteryinfo/utssdk/app-android/index.uts
@@ -1,6 +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 446dc719ca31f92f1e5715cb8350b68d08a4ca14..29ec6e3623bb6bd27379ad8298f7be6d4e90b9a1 100644
--- a/uni_modules/uts-nativepage/utssdk/app-android/DoAppWidget.uts
+++ b/uni_modules/uts-nativepage/utssdk/app-android/DoAppWidget.uts
@@ -2,8 +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 UTSAndroid from 'io.dcloud.uts.UTSAndroid';
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 c218484230afe1a0d40c64772e65fa7efbb8ac13..9912b0bbae4929155bcdfea05b805a4521fafb25 100644
--- a/uni_modules/uts-nativepage/utssdk/app-android/index.uts
+++ b/uni_modules/uts-nativepage/utssdk/app-android/index.uts
@@ -17,14 +17,9 @@ import IBinder from 'android.os.IBinder';
import Toast from 'android.widget.Toast';
-import {
- UTSAndroid
-} from "io.dcloud.uts";
-
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';
diff --git a/uni_modules/uts-platform-api/utssdk/app-android/index.uts b/uni_modules/uts-platform-api/utssdk/app-android/index.uts
index 11b6663316b848b4b5ef9244b3e5967210a264fb..7ea5c1bc49897589d8b17f2856e98467d305ac6a 100644
--- a/uni_modules/uts-platform-api/utssdk/app-android/index.uts
+++ b/uni_modules/uts-platform-api/utssdk/app-android/index.uts
@@ -2,7 +2,6 @@ import MediaStore from "android.provider.MediaStore";
import Activity from "android.app.Activity";
import Bitmap from "android.graphics.Bitmap";
import FileOutputStream from "java.io.FileOutputStream";
-import File from "java.io.File";
import Intent from 'android.content.Intent';
/**
diff --git a/uni_modules/uts-screenshot-listener/utssdk/app-android/index.uts b/uni_modules/uts-screenshot-listener/utssdk/app-android/index.uts
index db836a2aa85624f1e52dc93d21ebb1040491e819..37f4a5656e01ad39a2a3045a002accfcffcc63ab 100644
--- a/uni_modules/uts-screenshot-listener/utssdk/app-android/index.uts
+++ b/uni_modules/uts-screenshot-listener/utssdk/app-android/index.uts
@@ -1,10 +1,6 @@
-import {
- UTSAndroid
-} from "io.dcloud.uts";
-
-import { OnUserCaptureScreen, OffUserCaptureScreen, UserCaptureScreenCallback, OnUserCaptureScreenResult } from "../interface.uts"
+import { UserCaptureScreenCallback, OnUserCaptureScreenResult } from "../interface.uts"
import ActivityCompat from "androidx.core.app.ActivityCompat";
@@ -14,7 +10,6 @@ import Build from "android.os.Build";
import FileObserver from "android.os.FileObserver";
import File from "java.io.File";
import Environment from "android.os.Environment";
-import System from 'java.lang.System';
diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts b/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts
index c446df373affc3ec3088d183298af805829b2a02..17b5d63f8b52c979e0d440426c2a449ab235b2d1 100644
--- a/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts
+++ b/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts
@@ -1,8 +1,4 @@
-import {
- UTSAndroid
-} from "io.dcloud.uts";
-import ActivityCompat from "androidx.core.app.ActivityCompat";
import Manifest from "android.Manifest";
import Looper from "android.os.Looper";
import TencentLocationManager from "com.tencent.map.geolocation.TencentLocationManager";
@@ -10,8 +6,6 @@ import TencentLocationListener from "com.tencent.map.geolocation.TencentLocation
import TencentLocation from "com.tencent.map.geolocation.TencentLocation";
import TencentLocationRequest from "com.tencent.map.geolocation.TencentLocationRequest";
import PackageManager from "android.content.pm.PackageManager";
-import Class from 'java.lang.Class';
-import Exception from 'java.lang.Exception';
diff --git a/uni_modules/uts-toast/utssdk/app-android/index.uts b/uni_modules/uts-toast/utssdk/app-android/index.uts
index 847a27fdd7821b157879343efdb025f37f793b8d..217fafa9ddf9b993292d1a10c576e476dc4a2811 100644
--- a/uni_modules/uts-toast/utssdk/app-android/index.uts
+++ b/uni_modules/uts-toast/utssdk/app-android/index.uts
@@ -1,12 +1,7 @@
-import {
- UTSAndroid
-} from "io.dcloud.uts";
import XToast from "com.hjq.xtoast.XToast";
import R from "io.dcloud.uni_modules.uts_toast.R";
-import Runnable from 'java.lang.Runnable';
-import Class from 'java.lang.Class';
-import Exception from 'java.lang.Exception';
+
class UIRunnable extends Runnable {