From 09f74c38811f335494173ce34f3aa3bba6b29fb1 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 17 Oct 2022 15:10:03 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E4=B8=80?= =?UTF-8?q?=E5=A4=84=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shayu/phonelive/AppContext.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 95bfb8add..5e27d0899 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -1,5 +1,7 @@ package com.shayu.phonelive; +import static com.yunbao.live.socket.SocketClient.mSocketHandler; + import android.app.Activity; import android.app.ActivityManager; import android.content.Context; @@ -29,24 +31,23 @@ import com.yunbao.common.BuildConfig; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; -import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.imrongcloud.InstructorSendReward; import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider; import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom; -import com.yunbao.common.utils.FileUtil; -import com.yunbao.common.utils.ToastUtil; -import com.yunbao.live.views.RecommendLiveRoomProvider; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.L; import com.yunbao.common.utils.SpUtil; import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.views.PortraitLiveManager; +import com.yunbao.live.views.RecommendLiveRoomProvider; import com.yunbao.main.activity.MsgSettActivity; +import org.greenrobot.eventbus.EventBus; + import java.io.File; import java.io.IOException; import java.lang.ref.WeakReference; @@ -59,10 +60,6 @@ import io.rong.imlib.model.Conversation; import io.rong.imlib.model.MessageContent; import io.rong.message.TextMessage; -import static com.yunbao.live.socket.SocketClient.mSocketHandler; - -import org.greenrobot.eventbus.EventBus; - //import cn.tillusory.sdk.TiSDK; //import com.squareup.leakcanary.LeakCanary; @@ -101,7 +98,12 @@ public class AppContext extends CommonAppContext { @Override public void onActivityDestroyed(@NonNull Activity activity) { - activities.remove(activity); + for (WeakReference reference : activities) { + if(reference.get()==activity){ + activities.remove(reference); + return; + } + } } @Override