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