From 220ecebc4cd527616c53573d8fe65dbb2ce84d19 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 10 Aug 2022 08:56:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98,shouye=20ytuijian?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/main/activity/MainActivity.java | 8 ++++---- .../java/com/yunbao/main/views/FloatBannerView.java | 10 +++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 3f9df5a2a..722b2aaee 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -15,7 +15,6 @@ import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.Display; -import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; @@ -81,11 +80,10 @@ import com.yunbao.common.utils.VersionUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.AbsMainViewHolder; import com.yunbao.live.activity.LiveAudienceActivity; -import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; -import com.yunbao.main.views.FloatBannerView; import com.yunbao.live.bean.LiveBean; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; +import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.utils.LiveStorge; import com.yunbao.live.views.ChatListViewHolder; import com.yunbao.main.R; @@ -99,6 +97,7 @@ import com.yunbao.main.interfaces.MainAppBarLayoutListener; import com.yunbao.main.manager.imrongcloud.ConversationIMListManager; import com.yunbao.main.presenter.CheckLivePresenter; import com.yunbao.main.utils.GenerateTestUserSig; +import com.yunbao.main.views.FloatBannerView; import com.yunbao.main.views.MainHomeCommunityViewHolder; import com.yunbao.main.views.MainHomeLiveViewHolder; import com.yunbao.main.views.MainHomeShopViewHolder; @@ -390,6 +389,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene String json = GsonUtils.toJson(data); LiveBean liveBean = GsonUtils.fromJson(json, LiveBean.class); mCheckLivePresenter.checkLive(liveBean); + } @Override @@ -780,7 +780,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene CommonAppConfig.getInstance().setLaunched(false); LiveStorge.getInstance().clear(); VideoStorge.getInstance().clear(); - + floatBanner.release(); super.onDestroy(); } diff --git a/main/src/main/java/com/yunbao/main/views/FloatBannerView.java b/main/src/main/java/com/yunbao/main/views/FloatBannerView.java index fd381f47c..5107f512c 100644 --- a/main/src/main/java/com/yunbao/main/views/FloatBannerView.java +++ b/main/src/main/java/com/yunbao/main/views/FloatBannerView.java @@ -5,13 +5,11 @@ import android.graphics.Canvas; import android.os.Handler; import android.util.AttributeSet; import android.view.View; -import android.view.ViewGroup; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.TranslateAnimation; import android.widget.FrameLayout; import android.widget.LinearLayout; -import android.widget.RelativeLayout; import android.widget.ViewFlipper; import com.yunbao.common.R; @@ -76,6 +74,12 @@ public class FloatBannerView extends FrameLayout { } + /** + * 释放资源 + */ + public void release() { + bannerHandler.removeCallbacks(mFlipRunnable); + } private final Runnable mFlipRunnable = new Runnable() { @Override @@ -84,7 +88,7 @@ public class FloatBannerView extends FrameLayout { index = 0; } int next = index + 1; - next =( next == list.size() ? 0 : next); + next = (next == list.size() ? 0 : next); Uid = String.valueOf(list.get(next).getUid()); ImgLoader.displayAvatar(getContext(), list.get(index).getAvatar(), clipImage3); ImgLoader.displayAvatar(getContext(), list.get(next).getAvatar(), clipImage2);