直播结束,悬浮窗

This commit is contained in:
18401019693 2022-10-17 14:58:36 +08:00
parent 842ef05dc7
commit 5f44473c49
6 changed files with 36 additions and 36 deletions

View File

@ -47,15 +47,12 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
return instance; return instance;
} }
public void builderFloat(Activity mContext, String url,String tag) { public void builderFloat(Activity mContext, String url) {
if (TextUtils.isEmpty(tag)){
tag = TAG;
}
liveOnInvokeView = new LiveOnInvokeView(); liveOnInvokeView = new LiveOnInvokeView();
this.mContext = mContext; this.mContext = mContext;
this.url = url; this.url = url;
EasyFloat.with(mContext) EasyFloat.with(mContext)
.setTag(tag) .setTag(TAG)
.setLayout(R.layout.view_flaot_live, liveOnInvokeView) .setLayout(R.layout.view_flaot_live, liveOnInvokeView)
.setShowPattern(ShowPattern.CURRENT_ACTIVITY) .setShowPattern(ShowPattern.CURRENT_ACTIVITY)
.setGravity(Gravity.END | Gravity.CENTER_VERTICAL, 0, 200) .setGravity(Gravity.END | Gravity.CENTER_VERTICAL, 0, 200)

View File

@ -384,7 +384,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mContext.finish(); mContext.finish();
} else { } else {
EventBus.getDefault() EventBus.getDefault()
.postSticky(new LiveFloatEvent() .post(new LiveFloatEvent()
.setmLiveBean(mLiveBean) .setmLiveBean(mLiveBean)
.setmLiveSDK(mLiveSDK) .setmLiveSDK(mLiveSDK)
.setmLiveType(mLiveType) .setmLiveType(mLiveType)
@ -400,7 +400,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override @Override
public void onCancel() { public void onCancel() {
EventBus.getDefault() EventBus.getDefault()
.postSticky(new LiveFloatEvent() .post(new LiveFloatEvent()
.setmLiveBean(mLiveBean) .setmLiveBean(mLiveBean)
.setmLiveSDK(mLiveSDK) .setmLiveSDK(mLiveSDK)
.setmLiveType(mLiveType) .setmLiveType(mLiveType)

View File

@ -40,7 +40,6 @@ import com.google.firebase.messaging.FirebaseMessaging;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.jakewharton.rxbinding3.view.RxView; import com.jakewharton.rxbinding3.view.RxView;
import com.lzf.easyfloat.EasyFloat;
import com.tencent.imsdk.v2.V2TIMCallback; import com.tencent.imsdk.v2.V2TIMCallback;
import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMSDKConfig; import com.tencent.imsdk.v2.V2TIMSDKConfig;
@ -1246,11 +1245,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
if (event.isTime()) { if (event.isTime()) {
new Handler().postDelayed(() -> LiveFloatView.getInstance() new Handler().postDelayed(() -> LiveFloatView.getInstance()
.cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal()) .cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal())
.builderFloat(mContext, event.getmLiveBean().getPull(), "Main"), 1500); .builderFloat(mContext, event.getmLiveBean().getPull()), 1500);
} else { } else {
new Handler().post(() -> LiveFloatView.getInstance() new Handler().post(() -> LiveFloatView.getInstance()
.cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal()) .cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal())
.builderFloat(mContext, event.getmLiveBean().getPull(), "Main")); .builderFloat(mContext, event.getmLiveBean().getPull()));
} }

View File

@ -612,32 +612,8 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRecommendLiveRoomEvent(RecommendLiveRoomEvent event) {
LiveHttpUtil.getLiveInfo(event.getLiveuid(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> {
if (liveBean1 == null) {
return;
}
LiveAudienceActivity.forward(mContext, liveBean1, liveType, liveTypeVal, "", 0, liveSdk);
});
mCheckLivePresenter.checkLive(liveBean);
} else {
RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0);
}
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
public void onLiveFloatEvent(LiveFloatEvent event) {
new Handler().post(() -> LiveFloatView.getInstance()
.cacheLiveData(event.getmLiveBean(), event.getmLiveType(), event.getmLiveSDK(), event.getmLiveTypeVal())
.builderFloat(mContext, event.getmLiveBean().getPull(),"PDLiveConversationList"));
}
} }

View File

@ -29,18 +29,24 @@ import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity; import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.ImUserInfoModel; import com.yunbao.common.bean.ImUserInfoModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.NoviceInstructorManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.utils.DeviceUtils; import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.views.AbsMainViewHolder; import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.SystemMessageActivity; import com.yunbao.live.activity.SystemMessageActivity;
import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.ImUserBean;
import com.yunbao.live.event.RecommendLiveRoomEvent;
import com.yunbao.live.http.ImHttpUtil; import com.yunbao.live.http.ImHttpUtil;
import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.activity.MainActivity; import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.adapter.SystemMessageAdapter; import com.yunbao.main.adapter.SystemMessageAdapter;
@ -400,4 +406,25 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
MessageIMManager.get(mContext).setSystemNumber(systemNumber); MessageIMManager.get(mContext).setSystemNumber(systemNumber);
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRecommendLiveRoomEvent(RecommendLiveRoomEvent event) {
LiveHttpUtil.getLiveInfo(event.getLiveuid(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> {
if (liveBean1 == null) {
return;
}
LiveAudienceActivity.forward(mContext, liveBean1, liveType, liveTypeVal, "", 0, liveSdk);
});
mCheckLivePresenter.checkLive(liveBean);
} else {
RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0);
}
}
});
}
} }

View File

@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingTop="20dp"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <FrameLayout