|
@@ -19,7 +19,6 @@ import android.provider.Settings;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
import android.view.View;
|
|
|
-import android.view.ViewGroup;
|
|
|
import android.view.WindowManager;
|
|
|
import android.widget.FrameLayout;
|
|
|
import android.widget.ImageView;
|
|
@@ -48,10 +47,12 @@ import com.cooleshow.base.widgets.InputBar;
|
|
|
import com.cooleshow.base.widgets.dialog.CommonConfirmDialog;
|
|
|
import com.cooleshow.student.bean.FriendInfoBean;
|
|
|
import com.cooleshow.student.helper.EventHelper;
|
|
|
+import com.cooleshow.student.helper.ShareHelper;
|
|
|
import com.cooleshow.student.ui.live.floatPop.FloatWindowHelper;
|
|
|
import com.cooleshow.student.ui.live.floatPop.FloatingWindowService;
|
|
|
import com.cooleshow.student.widgets.dialog.LiveRoomCloseTipDialog;
|
|
|
import com.cooleshow.student.widgets.dialog.LiveRoomMicManagerDialog;
|
|
|
+import com.cooleshow.student.widgets.dialog.LiveRoomShareDialog;
|
|
|
import com.cooleshow.student.widgets.dialog.OpenOverlayPermissionTipDialog;
|
|
|
import com.cooleshow.student.widgets.helper.LiveRoomAddLikeHelper;
|
|
|
import com.cooleshow.base.widgets.dialog.InputBarDialog;
|
|
@@ -61,7 +62,6 @@ import com.cooleshow.student.bean.LiveRoomInfoBean;
|
|
|
import com.cooleshow.student.contract.LiveRoomContract;
|
|
|
import com.cooleshow.student.databinding.ActivityLiveroomLayoutBinding;
|
|
|
import com.cooleshow.student.presenter.live.LiveRoomPresenter;
|
|
|
-import com.rong.io.live.bean.User;
|
|
|
import com.rong.io.live.helper.LiveMemberHelper;
|
|
|
import com.rong.io.live.helper.LiveMessageHelper;
|
|
|
import com.rong.io.live.helper.LiveRTCEngineInitHelper;
|
|
@@ -86,6 +86,7 @@ import com.rong.io.live.widget.LiveRoomMicIconView;
|
|
|
import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -109,7 +110,6 @@ import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
|
|
|
import cn.rongcloud.rtc.base.RCRTCLiveRole;
|
|
|
import cn.rongcloud.rtc.base.RCRTCMediaType;
|
|
|
import cn.rongcloud.rtc.base.RCRTCResourceState;
|
|
|
-import cn.rongcloud.rtc.core.RendererCommon;
|
|
|
import de.hdodenhof.circleimageview.CircleImageView;
|
|
|
import io.reactivex.rxjava3.disposables.Disposable;
|
|
|
import io.rong.imkit.IMCenter;
|
|
@@ -124,13 +124,20 @@ import io.rong.message.TextMessage;
|
|
|
|
|
|
import com.cooleshow.student.widgets.helper.VideoViewManager;
|
|
|
import com.tbruyelle.rxpermissions3.RxPermissions;
|
|
|
+import com.umeng.socialize.ShareAction;
|
|
|
+import com.umeng.socialize.UMShareAPI;
|
|
|
+import com.umeng.socialize.UMShareListener;
|
|
|
+import com.umeng.socialize.bean.SHARE_MEDIA;
|
|
|
+import com.umeng.socialize.media.UMImage;
|
|
|
+import com.umeng.socialize.shareboard.SnsPlatform;
|
|
|
+import com.umeng.socialize.utils.ShareBoardlistener;
|
|
|
|
|
|
/**
|
|
|
* Author by pq, Date on 2022/3/29.
|
|
|
*/
|
|
|
|
|
|
@Route(path = RouterPath.LiveCenter.ACTIVITY_LIVE_ROOM)
|
|
|
-public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBinding, LiveRoomPresenter> implements View.OnClickListener, LiveRoomContract.view, SoftKeyboardUtil.OnSoftInputChangedListener {
|
|
|
+public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBinding, LiveRoomPresenter> implements View.OnClickListener, LiveRoomContract.view, SoftKeyboardUtil.OnSoftInputChangedListener, UMShareListener {
|
|
|
public static final int SEND_SHOW_FLOAT_WINDOW_TIME = 1000;//退到后台以后检查是否显示悬浮窗等待时长
|
|
|
public static final int SEND_APP_BACKGROUND_MSG = 1001;//退到后台消息
|
|
|
public static final int SEND_JUMP_OTHER_PAGE_MSG = 1002;//页面切换消息(购物车详情页等等)
|
|
@@ -138,6 +145,8 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
public static final int LIVE_STATUS_IS_REST = 1;//休息一下,马上回来
|
|
|
public static final int LIVE_STATUS_IS_CLOSE_VIDEO = 2;//主持人关闭画面
|
|
|
public static final int LIVE_STATUS_IS_OFFLINE = 3;//直播已结束
|
|
|
+ public static final int SHARE_CHAT_REQUEST_CODE = 500;//分享群聊requestcode
|
|
|
+ private File targetShareImgFile = null;
|
|
|
ConstraintLayout content_view;
|
|
|
RelativeLayout mFlLiveView;
|
|
|
LinearLayout ll_like;
|
|
@@ -250,6 +259,7 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
private VideoViewManager mVideoViewManager;
|
|
|
private LiveRoomShopCarDialog mShopCarDialog;
|
|
|
private LiveRoomMicManagerDialog mMicManagerDialog;
|
|
|
+ private LiveRoomShareDialog mLiveRoomShareDialog;
|
|
|
|
|
|
public static void startLiveRoomActivity(Context context, String roomid) {
|
|
|
Intent intent = new Intent(context, LiveRoomActivity.class);
|
|
@@ -310,6 +320,7 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
viewBinding.tvVideoCourse.setOnClickListener(this);
|
|
|
viewBinding.tvMusicSheet.setOnClickListener(this);
|
|
|
viewBinding.ivAvatar.setOnClickListener(this);
|
|
|
+ viewBinding.ivShare.setOnClickListener(this);
|
|
|
|
|
|
mRecyclerMsg.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
|
|
@Override
|
|
@@ -524,6 +535,31 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
sendShowFloatWindowAction(SEND_JUMP_OTHER_PAGE_MSG);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if (id == R.id.iv_share) {
|
|
|
+ //分享直播间
|
|
|
+ showShareDialog();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void showShareDialog() {
|
|
|
+ if (mRoomInfoBean == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (mLiveRoomShareDialog == null) {
|
|
|
+ mLiveRoomShareDialog = new LiveRoomShareDialog(this);
|
|
|
+ mLiveRoomShareDialog.setOnEventListener(new LiveRoomShareDialog.OnEventListener() {
|
|
|
+ @Override
|
|
|
+ public void onShare(File file) {
|
|
|
+ shareLive(file);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (!mLiveRoomShareDialog.isShowing()) {
|
|
|
+ mLiveRoomShareDialog.show();
|
|
|
+ }pq
|
|
|
+ mLiveRoomShareDialog.setData(mRoomInfoBean.speakerPic, mRoomInfoBean.speakerName, mRoomInfoBean.roomUid);
|
|
|
}
|
|
|
|
|
|
private void showMicManagerDialog() {
|
|
@@ -1914,9 +1950,21 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ if (resultCode == RESULT_OK) {
|
|
|
+ if (requestCode == SHARE_CHAT_REQUEST_CODE) {
|
|
|
+ //选择群聊
|
|
|
+ if (targetShareImgFile == null) {
|
|
|
+ ToastUtil.getInstance().showShort("分享失败");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ShareHelper.parseShareContactData(targetShareImgFile, data);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2082,6 +2130,42 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
return mFlJoinBarrage.getVisibility() != View.VISIBLE && mFlSnapUpBarrage.getVisibility() != View.VISIBLE;
|
|
|
}
|
|
|
|
|
|
+ private void shareLive(File imagfile) {
|
|
|
+ if (mLiveRoomShareDialog != null && mLiveRoomShareDialog.isShowing()) {
|
|
|
+ mLiveRoomShareDialog.dismiss();
|
|
|
+ }
|
|
|
+ this.targetShareImgFile = imagfile;
|
|
|
+ ShareAction ShareAction = new ShareAction(this).setDisplayList(
|
|
|
+ SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE, SHARE_MEDIA.SINA)
|
|
|
+ .setShareboardclickCallback(new ShareBoardlistener() {
|
|
|
+ @Override
|
|
|
+ public void onclick(SnsPlatform snsPlatform, SHARE_MEDIA share_media) {
|
|
|
+
|
|
|
+ if (share_media == null) {
|
|
|
+ if (TextUtils.equals(snsPlatform.mKeyword, "chat")) {
|
|
|
+ //分享群聊
|
|
|
+ ARouter.getInstance().build(RouterPath.ChatCenter.CHAT_SELECT_CONTACT)
|
|
|
+ .navigation(LiveRoomActivity.this, SHARE_CHAT_REQUEST_CODE);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!UMShareAPI.get(getApplicationContext()).isInstall(LiveRoomActivity.this, share_media)) {
|
|
|
+ ToastUtil.getInstance().show(getApplicationContext(), "应用未安装,分享失败");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UMImage image = new UMImage(LiveRoomActivity.this, file);//bitmap文件
|
|
|
+ image.setThumb(image);
|
|
|
+ image.compressStyle = UMImage.CompressStyle.SCALE;
|
|
|
+ new ShareAction(LiveRoomActivity.this).withMedia(image)
|
|
|
+ .setPlatform(share_media)
|
|
|
+ .setCallback(LiveRoomActivity.this)
|
|
|
+ .share();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ ShareAction.addButton("群聊", "chat", "icon_share_chat_group", "icon_share_chat_group");
|
|
|
+ ShareAction.open();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void onDestroy() {
|
|
|
if (presenter != null) {
|
|
@@ -2129,4 +2213,59 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
Log.i("pq", "SoftInput show");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ //分享回调
|
|
|
+ @Override
|
|
|
+ public void onStart(SHARE_MEDIA share_media) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onResult(SHARE_MEDIA platform) {
|
|
|
+ //分享成功
|
|
|
+ if (platform.name().equals("WEIXIN_FAVORITE")) {
|
|
|
+ ToastUtil.getInstance().showShort("收藏成功啦");
|
|
|
+ } else {
|
|
|
+ if (platform != SHARE_MEDIA.MORE && platform != SHARE_MEDIA.SMS
|
|
|
+ && platform != SHARE_MEDIA.EMAIL
|
|
|
+ && platform != SHARE_MEDIA.FLICKR
|
|
|
+ && platform != SHARE_MEDIA.FOURSQUARE
|
|
|
+ && platform != SHARE_MEDIA.TUMBLR
|
|
|
+ && platform != SHARE_MEDIA.POCKET
|
|
|
+ && platform != SHARE_MEDIA.PINTEREST
|
|
|
+
|
|
|
+ && platform != SHARE_MEDIA.INSTAGRAM
|
|
|
+ && platform != SHARE_MEDIA.GOOGLEPLUS
|
|
|
+ && platform != SHARE_MEDIA.YNOTE
|
|
|
+ && platform != SHARE_MEDIA.EVERNOTE) {
|
|
|
+ ToastUtil.getInstance().showShort("分享成功啦");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(SHARE_MEDIA platform, Throwable throwable) {
|
|
|
+ if (platform != SHARE_MEDIA.MORE && platform != SHARE_MEDIA.SMS
|
|
|
+ && platform != SHARE_MEDIA.EMAIL
|
|
|
+ && platform != SHARE_MEDIA.FLICKR
|
|
|
+ && platform != SHARE_MEDIA.FOURSQUARE
|
|
|
+ && platform != SHARE_MEDIA.TUMBLR
|
|
|
+ && platform != SHARE_MEDIA.POCKET
|
|
|
+ && platform != SHARE_MEDIA.PINTEREST
|
|
|
+
|
|
|
+ && platform != SHARE_MEDIA.INSTAGRAM
|
|
|
+ && platform != SHARE_MEDIA.GOOGLEPLUS
|
|
|
+ && platform != SHARE_MEDIA.YNOTE
|
|
|
+ && platform != SHARE_MEDIA.EVERNOTE) {
|
|
|
+ ToastUtil.getInstance().showShort("分享失败啦");
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onCancel(SHARE_MEDIA share_media) {
|
|
|
+ ToastUtil.getInstance().showShort("分享取消了");
|
|
|
+ }
|
|
|
}
|