From 428f257c75b92e943d22f23f75827bf54e7096a9 Mon Sep 17 00:00:00 2001 From: duqingquan-jpc Date: Fri, 23 Dec 2022 12:35:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dlottie=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/SDKIntegration/Lottie/index.nvue | 2 +- .../utssdk/app-android/index.vue | 35 ++++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/pages/SDKIntegration/Lottie/index.nvue b/pages/SDKIntegration/Lottie/index.nvue index 1b7b2ac..e3d1899 100644 --- a/pages/SDKIntegration/Lottie/index.nvue +++ b/pages/SDKIntegration/Lottie/index.nvue @@ -29,7 +29,7 @@ widthNum: 375, heightNum: 200, comShow: true, - animUrl: "AndroidWave.json" + animUrl: "anim_a.json" } }, 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 423ed85..310ad08 100644 --- a/uni_modules/uts-animation-view/utssdk/app-android/index.vue +++ b/uni_modules/uts-animation-view/utssdk/app-android/index.vue @@ -88,7 +88,7 @@ if(this.$el != null){ - let lottieAnimationView = this.$el + let lottieAnimationView = this.$el! if (!TextUtils.isEmpty(newPath)) { if (newPath.startsWith("http://") || newPath.startsWith("https://")) { lottieAnimationView.setAnimationFromUrl(newPath) @@ -108,14 +108,14 @@ handler(newLoop: Boolean) { if(this.$el != null){ if (newLoop) { - this.$el.repeatCount = Int.MAX_VALUE + this.$el!.repeatCount = Int.MAX_VALUE } else { // 不循环则设置成1次 - this.$el.repeatCount = 0 + this.$el!.repeatCount = 0 } if (this.autoplay) { - this.$el.playAnimation() + this.$el!.playAnimation() } } @@ -127,7 +127,7 @@ handler(newValue: boolean) { if(this.$el != null){ if (newValue) { - this.$el.playAnimation() + this.$el!.playAnimation() } } @@ -142,12 +142,12 @@ if(this.$el != null){ if (this.action == "play") { - this.$el.playAnimation() + this.$el!.playAnimation() } else if (this.action == "pause") { - this.$el.pauseAnimation() + this.$el!.pauseAnimation() } else if (this.action == "stop") { - this.$el.cancelAnimation() - this.$el.clearAnimation() + this.$el!.cancelAnimation() + this.$el!.clearAnimation() } } @@ -163,9 +163,9 @@ handler(newValue: boolean) { if(this.$el != null){ if (newValue) { - this.$el.visibility = View.GONE + this.$el!.visibility = View.GONE } else { - this.$el.visibility = View.VISIBLE + this.$el!.visibility = View.VISIBLE } } }, @@ -177,9 +177,9 @@ setRepeatMode(repeat: string) { if(this.$el != null){ if ("RESTART" == repeat) { - this.$el.repeatMode = LottieDrawable.RESTART + this.$el!.repeatMode = LottieDrawable.RESTART } else if ("REVERSE" == repeat) { - this.$el.repeatMode = LottieDrawable.RESTART + this.$el!.repeatMode = LottieDrawable.RESTART } } }, @@ -197,13 +197,14 @@ let lottieAnimationView = new LottieAnimationView($androidContext) return lottieAnimationView }, + NVLoaded() { //原生View已创建 //可选实现,这里可以做后续操作 if(this.$el != null){ - this.$el.repeatMode = LottieDrawable.RESTART; - this.$el.visibility = View.GONE - this.$el.repeatCount = 0 - this.$el.addAnimatorListener(new CustomAnimListener(this)) + this.$el!.repeatMode = LottieDrawable.RESTART; + this.$el!.visibility = View.GONE + this.$el!.repeatCount = 0 + this.$el!.addAnimatorListener(new CustomAnimListener(this)) } }, -- GitLab