diff --git a/uni_modules/uni-native-button/utssdk/app-android/index.uts b/uni_modules/uni-native-button/utssdk/app-android/index.uts index 449b7c173c8d3a048c39cc7ab1fa6db5b934bd97..88d1ba62288f93bef4abb5646de50d923fa7ebad 100644 --- a/uni_modules/uni-native-button/utssdk/app-android/index.uts +++ b/uni_modules/uni-native-button/utssdk/app-android/index.uts @@ -5,13 +5,13 @@ export class NativeButton { constructor(element : UniNativeViewElement) { this.$element = element; - bindView(); + this.bindView(); } button : Button | null = null; bindView() { //通过UniElement.getAndroidActivity()获取android平台activity 用于创建view的上下文 - this.button = new Button($element.getAndroidActivity()!); //构建原生view + this.button = new Button(this.$element.getAndroidActivity()!); //构建原生view //限制原生Button 文案描述不自动大写 this.button?.setAllCaps(false) //监听原生Button点击事件 @@ -20,10 +20,10 @@ export class NativeButton { //构建自定义UniNativeViewEvent返回对象 const event = new UniNativeViewEvent("customClick", detail) //响应分发原生Button的点击事件 - $element.dispatchEvent(event) + this.$element.dispatchEvent(event) }) //UniNativeViewEvent 绑定 安卓原生view - $element.bindAndroidView(button!); + this.$element.bindAndroidView(button!); } updateText(text: string) { diff --git a/uni_modules/uni-time-picker/utssdk/app-android/index.uts b/uni_modules/uni-time-picker/utssdk/app-android/index.uts index 4fdd2f7b088fb03868bddfe2a3ff79153dbbd052..6b4d9e9f7729abbf5d385e995623396ed3dcdcea 100644 --- a/uni_modules/uni-time-picker/utssdk/app-android/index.uts +++ b/uni_modules/uni-time-picker/utssdk/app-android/index.uts @@ -1,24 +1,23 @@ import { TimePicker } from "android.widget" -import { View } from "android.view" export class NativeTimePicker { $element : UniNativeViewElement; constructor(element : UniNativeViewElement, hour: number, minute: number) { this.$element = element; - bindView(hour, minute); + this.bindView(hour, minute); } picker : TimePicker | null = null; bindView(hour: number, minute: number) { - this.picker = new TimePicker($element.getAndroidActivity()!); //构建原生view - $element.bindAndroidView(picker!); - setHour(hour) - setMinute(minute) + this.picker = new TimePicker(this.$element.getAndroidActivity()!); //构建原生view + this.$element.bindAndroidView(this.picker!); + this.setHour(hour) + this.setMinute(minute) this.picker?.setOnTimeChangedListener((_, hourOfDay, minute) => { const detail = {"hour": hourOfDay, "minute": minute} const event = new UniNativeViewEvent("timechanged", detail) - $element.dispatchEvent(event) + this.$element.dispatchEvent(event) }) }