From 548e37331033c08234570936a50177695c66fdb6 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Wed, 9 Oct 2024 09:59:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=80=E9=80=9A=E8=B4=B5?= =?UTF-8?q?=E6=97=8F=E5=85=A8=E6=9C=8D=E9=80=9A=E7=9F=A5=E4=B8=8D=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/views/weight/NobleNoticeView.java | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java b/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java index 2dd5c9411..1f8062c40 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java +++ b/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java @@ -1,7 +1,9 @@ package com.yunbao.common.views.weight; +import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Bitmap; +import android.os.AsyncTask; import android.text.TextUtils; import android.util.AttributeSet; import android.view.LayoutInflater; @@ -256,14 +258,35 @@ public class NobleNoticeView extends FrameLayout { } + @SuppressLint("StaticFieldLeak") @Override public void onStep(int frame, double v) { System.out.println("frame = " + frame); System.out.println("scrollLayout.getMeasuredWidth() = " + scrollLayout.getMeasuredWidth()); if (frame == 21) { setButtonPosition(roleType); - observable.observeOn(AndroidSchedulers.mainThread()) + new AsyncTask() { + @Override + protected Void doInBackground(Void... voids) { + // 在这里执行后台任务 + return null; + } + + @Override + protected void onPostExecute(Void aVoid) { + super.onPostExecute(aVoid); + TranslateAnimation animationTranslate = new TranslateAnimation(scrollLayout.getMeasuredHeight(), -scrollLayout.getMeasuredWidth(), 0, 0); + AnimationSet animationSet1 = new AnimationSet(true); + animationSet1.addAnimation(animationTranslate); + animationSet1.setFillAfter(true); + animationSet1.setDuration((animationTime - 1000) / 2); + animationSet1.setAnimationListener(animationListener); + scrollLayout.startAnimation(animationSet1); + } + }.execute(); + /*observable.observeOn(AndroidSchedulers.mainThread()) .subscribe(bitmap -> { + L.e("44444"); TranslateAnimation animationTranslate = new TranslateAnimation(0, -scrollLayout.getMeasuredWidth(), 0, 0); AnimationSet animationSet1 = new AnimationSet(true); animationSet1.addAnimation(animationTranslate); @@ -273,8 +296,7 @@ public class NobleNoticeView extends FrameLayout { scrollLayout.startAnimation(animationSet1); }, throwable -> { - }).isDisposed(); - + }).isDisposed();*/ } if (frame == 135) { contextLayout.setVisibility(GONE); @@ -377,12 +399,10 @@ public class NobleNoticeView extends FrameLayout { Animation.AnimationListener animationListener = new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { - } @Override public void onAnimationEnd(Animation animation) { - scrollLayout.clearAnimation(); if (svagaBc.isAnimating()) { TranslateAnimation animationTranslate = new TranslateAnimation(0, -scrollLayout.getMeasuredWidth(), 0, 0);