update 动态&视频分享功能

This commit is contained in:
zlzw 2024-03-21 14:48:10 +08:00
parent 0e83f4fbaf
commit ab6d871b38
13 changed files with 150 additions and 27 deletions

View File

@ -29,6 +29,7 @@ public class ShareBean {
private int shareType; private int shareType;
private String cover; private String cover;
private String title; private String title;
private String extraData;
public static String createLiveShareLink(String shareUid, String anchorId, String anchorName, String anchorAvatar) { public static String createLiveShareLink(String shareUid, String anchorId, String anchorName, String anchorAvatar) {
@ -119,6 +120,14 @@ public class ShareBean {
this.anchorAvatar = anchorAvatar; this.anchorAvatar = anchorAvatar;
} }
public String getExtraData() {
return extraData;
}
public void setExtraData(String extraData) {
this.extraData = extraData;
}
public ShareBean setText(String text) { public ShareBean setText(String text) {
this.text = text; this.text = text;
return this; return this;
@ -163,32 +172,33 @@ public class ShareBean {
} }
/** /**
* private String text; * private String text;
* private String link; * private String link;
* private File file; * private File file;
* private int type; * private int type;
* private String uid; * private String uid;
* private String anchorId; * private String anchorId;
* private String anchorName; * private String anchorName;
* private String anchorAvatar; * private String anchorAvatar;
* private int shareType; * private int shareType;
* private String cover; * private String cover;
* private String title; * private String title;
*/ */
@NonNull @NonNull
@Override @Override
public ShareBean clone(){ public ShareBean clone() {
ShareBean bean=new ShareBean(type); ShareBean bean = new ShareBean(type);
bean.anchorId=anchorId; bean.anchorId = anchorId;
bean.anchorName=anchorName; bean.anchorName = anchorName;
bean.anchorAvatar=anchorAvatar; bean.anchorAvatar = anchorAvatar;
bean.text=text; bean.text = text;
bean.link=link; bean.link = link;
bean.file=file; bean.file = file;
bean.uid=uid; bean.uid = uid;
bean.shareType=shareType; bean.shareType = shareType;
bean.cover=cover; bean.cover = cover;
bean.title=title; bean.title = title;
bean.extraData = extraData;
return bean; return bean;
} }
@ -248,6 +258,12 @@ public class ShareBean {
bean.setFile(file); bean.setFile(file);
return this; return this;
} }
public ShareBuilder setExtraData(String extraData) {
bean.setExtraData(extraData);
return this;
}
public ShareBean build() { public ShareBean build() {
return bean; return bean;
} }

View File

@ -9,6 +9,7 @@ import com.yunbao.share.AbsShareInterface;
import com.yunbao.share.ICallback; import com.yunbao.share.ICallback;
import com.yunbao.share.bean.ShareBean; import com.yunbao.share.bean.ShareBean;
import com.yunbao.share.ui.AppInternalShareDialog; import com.yunbao.share.ui.AppInternalShareDialog;
import com.yunbao.share.ui.SharePopDialog;
import com.yunbao.share.ui.ShareSuccessNotifyDialog; import com.yunbao.share.ui.ShareSuccessNotifyDialog;
import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Conversation;
@ -46,7 +47,7 @@ public class Internal extends AbsShareInterface {
builder.getAnchorName(), builder.getAnchorName(),
builder.getAnchorId(), builder.getAnchorId(),
builder.getShareType() + "", builder.getShareType() + "",
builder.getAnchorId() builder.getExtraData()
), ),
new OnSendMessageListener<Object>() { new OnSendMessageListener<Object>() {
@Override @Override

View File

@ -29,6 +29,7 @@ import java.util.List;
public class SharePopDialog extends AbsDialogPopupWindow { public class SharePopDialog extends AbsDialogPopupWindow {
public static final int TYPE_LIVE = 1; public static final int TYPE_LIVE = 1;
public static final int TYPE_DYNAMIC = 0; public static final int TYPE_DYNAMIC = 0;
public static final int TYPE_VIDEO = 2;
private ShareAppAdapter adapter; private ShareAppAdapter adapter;
private RecyclerView list; private RecyclerView list;
private RoundedImageView avatar; private RoundedImageView avatar;

View File

@ -1,15 +1,19 @@
package com.yunbao.common.provider; package com.yunbao.common.provider;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.text.Spannable; import android.text.Spannable;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.yunbao.common.Constants;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.bean.LiveBean; 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.http.LiveHttpUtil; import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.message.content.MessageChatCardContent; import com.yunbao.common.message.content.MessageChatCardContent;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
@ -18,6 +22,7 @@ import com.yunbao.common.utils.StringUtil;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import io.rong.imkit.conversation.messgelist.provider.BaseMessageItemProvider; import io.rong.imkit.conversation.messgelist.provider.BaseMessageItemProvider;
@ -56,6 +61,20 @@ public class MessageChatCardItemProvider extends BaseMessageItemProvider<Message
protected boolean onItemClick(ViewHolder holder, MessageChatCardContent content, UiMessage uiMessage, int position, List<UiMessage> list, IViewProviderListener<UiMessage> listener) { protected boolean onItemClick(ViewHolder holder, MessageChatCardContent content, UiMessage uiMessage, int position, List<UiMessage> list, IViewProviderListener<UiMessage> listener) {
if ("1".equals(content.getType())) { if ("1".equals(content.getType())) {
gotoLive(content.getExtraData()); gotoLive(content.getExtraData());
}else if("0".equals(content.getType())){
RouteUtil.forwardCommunity(content.getExtraData());
}else if("2".equals(content.getType())){
LiveNetManager.get(mContext).getDynamicInfo(content.getExtraData(), new com.yunbao.common.http.base.HttpCallback<ActiveBean>() {
@Override
public void onSuccess(ActiveBean data) {
RouteUtil.forwardVideoPlayActivity(data);
}
@Override
public void onError(String error) {
}
});
} }
return false; return false;
} }

View File

@ -10,10 +10,12 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext; import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.HtmlConfig; import com.yunbao.common.HtmlConfig;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.RedPacketListBean;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
@ -53,6 +55,7 @@ public class RouteUtil {
public static final String PATH_VIDEO_ACTIVITY = "/activity/VideoPlayActivity"; public static final String PATH_VIDEO_ACTIVITY = "/activity/VideoPlayActivity";
public static final String PATH_COMMUNITY = "/main/CommunityDetailsActivity"; public static final String PATH_COMMUNITY = "/main/CommunityDetailsActivity";
public static final String PATH_USER_HOME = "/main/UserHomeActivity"; public static final String PATH_USER_HOME = "/main/UserHomeActivity";
public static final String PATH_VIDEO_PLAY = "/video/VideoPlayActivity";
public static void forwardUserHome(String uid) { public static void forwardUserHome(String uid) {
ARouter.getInstance().build(PATH_USER_HOME) ARouter.getInstance().build(PATH_USER_HOME)
@ -393,4 +396,11 @@ public class RouteUtil {
public static void forwardActivity(String path) { public static void forwardActivity(String path) {
ARouter.getInstance().build(path).navigation(); ARouter.getInstance().build(path).navigation();
} }
public static void forwardVideoPlayActivity(ActiveBean bean) {
ARouter.getInstance().build(PATH_VIDEO_PLAY)
.withParcelable("ActiveBean",bean)
.withString(Constants.VIDEO_KEY,Constants.VIDEO_SINGLE)
.navigation();
}
} }

View File

@ -149,6 +149,7 @@
android:textSize="12dp" /> android:textSize="12dp" />
<ImageView <ImageView
android:id="@+id/share"
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:src="@mipmap/icon_share_new" /> android:src="@mipmap/icon_share_new" />

View File

@ -1470,6 +1470,7 @@ public class LiveAudienceActivity extends LiveActivity {
.setAnchorId(event.getBean().getUid()) .setAnchorId(event.getBean().getUid())
.setAnchorName(event.getBean().getUserNiceName()) .setAnchorName(event.getBean().getUserNiceName())
.setAnchorAvatar(event.getBean().getAvatar()) .setAnchorAvatar(event.getBean().getAvatar())
.setExtraData(event.getBean().getUid())
.build() .build()
) )
.showDialog(); .showDialog();

View File

@ -41,6 +41,8 @@ import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.NineGridLayout; import com.yunbao.common.views.NineGridLayout;
import com.yunbao.common.views.TopGradual; import com.yunbao.common.views.TopGradual;
import com.yunbao.share.bean.ShareBean;
import com.yunbao.share.ui.SharePopDialog;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -239,6 +241,31 @@ public class CommunityDetailsActivity extends AbsActivity {
} }
}); });
findViewById(R.id.share).setOnClickListener(view -> {
String image = null;
if (activeBean.getImg_or_video().equals("1")) {
JSONArray jsonArray = (JSONArray) JSONArray.parse(activeBean.getImg_json());
if (!jsonArray.isEmpty()) {
image = jsonArray.getString(0);
}
}else{
image=activeBean.getVideo() + "?vframe/jpg/offset/0";
}
new SharePopDialog(mContext)
.setShareType(SharePopDialog.TYPE_DYNAMIC)
.setShareData(ShareBean.ShareBuilder.create()
.setShareType(SharePopDialog.TYPE_DYNAMIC)
.setUid(CommonAppConfig.getInstance().getUid())
.setCover(StringUtil.isEmpty(image) ? activeBean.getUser_avatar() : image)
.setTitle(StringUtil.isEmpty(activeBean.getContent()) ? activeBean.getUser_name() : JSONObject.parseObject(activeBean.getContent()).getString("msg"))
.setAnchorId(activeBean.getUser_id())
.setAnchorName(activeBean.getUser_name())
.setAnchorAvatar(activeBean.getUser_avatar())
.setExtraData(activeId)
.build()
)
.showDialog();
});
} }
//回复评论 //回复评论

View File

@ -40,6 +40,7 @@ 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.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.ViewUtils; import com.yunbao.common.utils.ViewUtils;
@ -249,6 +250,9 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
} }
}); });
ViewUtils.findViewById(card, R.id.rc_conversation_portrait, ImageView.class).setOnClickListener(view -> {
RouteUtil.forwardUserHome(targetId);
});
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -15,6 +15,7 @@ import com.google.gson.Gson;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -89,5 +90,8 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
//设置时间 //设置时间
String date =new SimpleDateFormat("HH:mm", Locale.getDefault()).format(new Date(uiConversation.mCore.getSentTime())); String date =new SimpleDateFormat("HH:mm", Locale.getDefault()).format(new Date(uiConversation.mCore.getSentTime()));
holder.setText(R.id.rc_conversation_date, date); holder.setText(R.id.rc_conversation_date, date);
holder.getView(R.id.rc_conversation_portrait).setOnClickListener(view -> {
RouteUtil.forwardUserHome(targetId);
});
} }
} }

View File

@ -33,6 +33,11 @@ android {
ndk { ndk {
abiFilters "armeabi-v7a","arm64-v8a" abiFilters "armeabi-v7a","arm64-v8a"
} }
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
} }
aaptOptions { aaptOptions {
cruncherEnabled = false cruncherEnabled = false
@ -63,5 +68,5 @@ dependencies {
implementation project(path: ':common') implementation project(path: ':common')
implementation project(path: ':live') implementation project(path: ':live')
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
} }

View File

@ -9,6 +9,7 @@ import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView; import android.widget.ImageView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.binioter.guideview.Guide; import com.binioter.guideview.Guide;
import com.binioter.guideview.GuideBuilder; import com.binioter.guideview.GuideBuilder;
@ -37,6 +38,7 @@ import java.util.List;
* Created by cxf on 2018/11/26. * Created by cxf on 2018/11/26.
*/ */
@Route(path = RouteUtil.PATH_VIDEO_PLAY)
public class VideoPlayActivity extends AbsVideoPlayActivity { public class VideoPlayActivity extends AbsVideoPlayActivity {
private View viewBottom; private View viewBottom;
@ -105,6 +107,12 @@ public class VideoPlayActivity extends AbsVideoPlayActivity {
if (TextUtils.isEmpty(mVideoKey)) { if (TextUtils.isEmpty(mVideoKey)) {
return; return;
} }
ActiveBean bean=intent.getParcelableExtra("ActiveBean");
if(bean!=null){
List<ActiveBean> list = new ArrayList<>();
list.add(bean);
VideoStorge.getInstance().put(Constants.VIDEO_SINGLE, list);
}
int position = intent.getIntExtra(Constants.VIDEO_POSITION, 0); int position = intent.getIntExtra(Constants.VIDEO_POSITION, 0);
int page = intent.getIntExtra(Constants.VIDEO_PAGE, 1); int page = intent.getIntExtra(Constants.VIDEO_PAGE, 1);
mVideoScrollViewHolder = new VideoScrollViewHolder(mContext, (ViewGroup) findViewById(R.id.container), position, mVideoKey, page); mVideoScrollViewHolder = new VideoScrollViewHolder(mContext, (ViewGroup) findViewById(R.id.container), position, mVideoKey, page);

View File

@ -19,6 +19,7 @@ import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.android.arouter.utils.TextUtils; import com.alibaba.android.arouter.utils.TextUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xuexiang.xui.widget.flowlayout.FlowTagLayout; import com.xuexiang.xui.widget.flowlayout.FlowTagLayout;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
@ -33,6 +34,8 @@ import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.AbsViewHolder; import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.share.bean.ShareBean;
import com.yunbao.share.ui.SharePopDialog;
import com.yunbao.video.R; import com.yunbao.video.R;
import com.yunbao.video.activity.AbsVideoPlayActivity; import com.yunbao.video.activity.AbsVideoPlayActivity;
import com.yunbao.video.dialog.VideoShareDialogFragment; import com.yunbao.video.dialog.VideoShareDialogFragment;
@ -489,11 +492,34 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
if (mVideoBean == null) { if (mVideoBean == null) {
return; return;
} }
VideoShareDialogFragment fragment = new VideoShareDialogFragment(); /* VideoShareDialogFragment fragment = new VideoShareDialogFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putParcelable(Constants.VIDEO_BEAN, mVideoBean); bundle.putParcelable(Constants.VIDEO_BEAN, mVideoBean);
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.show(((AbsVideoPlayActivity) mContext).getSupportFragmentManager(), "VideoShareDialogFragment"); fragment.show(((AbsVideoPlayActivity) mContext).getSupportFragmentManager(), "VideoShareDialogFragment");*/
String image = null;
if (mVideoBean.getImg_or_video().equals("1")) {
JSONArray jsonArray = (JSONArray) JSONArray.parse(mVideoBean.getImg_json());
if (!jsonArray.isEmpty()) {
image = jsonArray.getString(0);
}
}else{
image=mVideoBean.getVideo() + "?vframe/jpg/offset/0";
}
new SharePopDialog(mContext)
.setShareType(SharePopDialog.TYPE_VIDEO)
.setShareData(ShareBean.ShareBuilder.create()
.setShareType(SharePopDialog.TYPE_VIDEO)
.setUid(CommonAppConfig.getInstance().getUid())
.setCover(StringUtil.isEmpty(image) ? mVideoBean.getUser_avatar() : image)
.setTitle(StringUtil.isEmpty(mVideoBean.getContent()) ? mVideoBean.getUser_name() : JSONObject.parseObject(mVideoBean.getContent()).getString("msg"))
.setAnchorId(mVideoBean.getUser_id())
.setAnchorName(mVideoBean.getUser_name())
.setAnchorAvatar(mVideoBean.getUser_avatar())
.setExtraData(mVideoBean.getId())
.build()
)
.showDialog();
} }
public void release() { public void release() {