add 分享
add 聊天页面右上角菜单
This commit is contained in:
parent
9c54cfca2a
commit
b3b46ccff3
@ -7,7 +7,7 @@ import android.net.Uri;
|
|||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
|
|
||||||
import com.twitter.sdk.android.tweetcomposer.TweetUploadService;
|
import com.twitter.sdk.android.tweetcomposer.TweetUploadService;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
import com.yunbao.share.receiver.TwitterResultReceiver;
|
import com.yunbao.share.receiver.TwitterResultReceiver;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -23,7 +23,7 @@ public abstract class AbsShareInterface {
|
|||||||
context.registerReceiver(new TwitterResultReceiver(), filter);
|
context.registerReceiver(new TwitterResultReceiver(), filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void share(ShareBuilder builder, ICallback callback);
|
public abstract void share(ShareBean builder, ICallback callback);
|
||||||
|
|
||||||
public Uri fileToUri(File file){
|
public Uri fileToUri(File file){
|
||||||
return FileProvider.getUriForFile(mContext,
|
return FileProvider.getUriForFile(mContext,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.yunbao.share.adapters;
|
package com.yunbao.share.adapters;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Environment;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -15,7 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
|
|
||||||
import com.pdlive.shayu.R;
|
import com.pdlive.shayu.R;
|
||||||
import com.yunbao.share.ICallback;
|
import com.yunbao.share.ICallback;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
import com.yunbao.share.platform.FacebookShare;
|
import com.yunbao.share.platform.FacebookShare;
|
||||||
import com.yunbao.share.platform.Instagram;
|
import com.yunbao.share.platform.Instagram;
|
||||||
import com.yunbao.share.platform.Internal;
|
import com.yunbao.share.platform.Internal;
|
||||||
@ -24,13 +23,12 @@ import com.yunbao.share.platform.MessengerShare;
|
|||||||
import com.yunbao.share.platform.TwitterShare;
|
import com.yunbao.share.platform.TwitterShare;
|
||||||
import com.yunbao.share.platform.WhatsApp;
|
import com.yunbao.share.platform.WhatsApp;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppViewHolder> {
|
public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppViewHolder> {
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private List<ShareBuilder> list;
|
private List<ShareBean> list;
|
||||||
ShareCallback shareCallback;
|
ShareCallback shareCallback;
|
||||||
|
|
||||||
public ShareAppAdapter(Context mContext) {
|
public ShareAppAdapter(Context mContext) {
|
||||||
@ -38,7 +36,7 @@ public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppVie
|
|||||||
this.mContext = mContext;
|
this.mContext = mContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setList(List<ShareBuilder> list) {
|
public void setList(List<ShareBean> list) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
@ -51,27 +49,28 @@ public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppVie
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull AppViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull AppViewHolder holder, int position) {
|
||||||
ShareBuilder builder = list.get(position);
|
ShareBean builder = list.get(position);
|
||||||
|
System.out.println("------type------>"+builder.getType());
|
||||||
switch (builder.getType()) {
|
switch (builder.getType()) {
|
||||||
case ShareBuilder.APP_FACEBOOK:
|
case ShareBean.APP_FACEBOOK:
|
||||||
holder.setData(builder, R.mipmap.icon_share_facebook, R.string.dialog_share_app_facebook);
|
holder.setData(builder, R.mipmap.icon_share_facebook, R.string.dialog_share_app_facebook);
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_LINE:
|
case ShareBean.APP_LINE:
|
||||||
holder.setData(builder, R.mipmap.icon_share_line, R.string.dialog_share_app_line);
|
holder.setData(builder, R.mipmap.icon_share_line, R.string.dialog_share_app_line);
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_TWITTER:
|
case ShareBean.APP_TWITTER:
|
||||||
holder.setData(builder, R.mipmap.icon_share_twitter, R.string.dialog_share_app_twitter);
|
holder.setData(builder, R.mipmap.icon_share_twitter, R.string.dialog_share_app_twitter);
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_WHATSAPP:
|
case ShareBean.APP_WHATSAPP:
|
||||||
holder.setData(builder, R.mipmap.icon_share_whatsapp, R.string.dialog_share_app_whatsapp);
|
holder.setData(builder, R.mipmap.icon_share_whatsapp, R.string.dialog_share_app_whatsapp);
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_MESSENGER:
|
case ShareBean.APP_MESSENGER:
|
||||||
holder.setData(builder, R.mipmap.icon_share_messenger, R.string.dialog_share_app_messenger);
|
holder.setData(builder, R.mipmap.icon_share_messenger, R.string.dialog_share_app_messenger);
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_INSTAGRAM:
|
case ShareBean.APP_INSTAGRAM:
|
||||||
holder.setData(builder, R.mipmap.icon_share_instagram, R.string.dialog_share_app_instagram);
|
holder.setData(builder, R.mipmap.icon_share_instagram, R.string.dialog_share_app_instagram);
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_INTERNAL:
|
case ShareBean.APP_INTERNAL:
|
||||||
holder.setData(builder, R.mipmap.ic_share_friend, R.string.dialog_share_app_internal);
|
holder.setData(builder, R.mipmap.ic_share_friend, R.string.dialog_share_app_internal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -99,30 +98,30 @@ public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppVie
|
|||||||
title = itemView.findViewById(R.id.share_app_name);
|
title = itemView.findViewById(R.id.share_app_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(ShareBuilder bean, @DrawableRes int iconId, @StringRes int appName) {
|
public void setData(ShareBean bean, @DrawableRes int iconId, @StringRes int appName) {
|
||||||
icon.setImageResource(iconId);
|
icon.setImageResource(iconId);
|
||||||
title.setText(appName);
|
title.setText(appName);
|
||||||
itemView.setOnClickListener(v -> {
|
itemView.setOnClickListener(v -> {
|
||||||
switch (bean.getType()) {
|
switch (bean.getType()) {
|
||||||
case ShareBuilder.APP_FACEBOOK:
|
case ShareBean.APP_FACEBOOK:
|
||||||
new FacebookShare(itemView.getContext()).share(bean, new ShareCallback());
|
new FacebookShare(itemView.getContext()).share(bean, new ShareCallback());
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_LINE:
|
case ShareBean.APP_LINE:
|
||||||
new Line(itemView.getContext()).share(bean, new ShareCallback());
|
new Line(itemView.getContext()).share(bean, new ShareCallback());
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_TWITTER:
|
case ShareBean.APP_TWITTER:
|
||||||
new TwitterShare(itemView.getContext()).share(bean, new ShareCallback());
|
new TwitterShare(itemView.getContext()).share(bean, new ShareCallback());
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_WHATSAPP:
|
case ShareBean.APP_WHATSAPP:
|
||||||
new WhatsApp(itemView.getContext()).share(bean, new ShareCallback());
|
new WhatsApp(itemView.getContext()).share(bean, new ShareCallback());
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_MESSENGER:
|
case ShareBean.APP_MESSENGER:
|
||||||
new MessengerShare(itemView.getContext()).share(bean, new ShareCallback());
|
new MessengerShare(itemView.getContext()).share(bean, new ShareCallback());
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_INSTAGRAM:
|
case ShareBean.APP_INSTAGRAM:
|
||||||
new Instagram(itemView.getContext()).share(bean, new ShareCallback());
|
new Instagram(itemView.getContext()).share(bean, new ShareCallback());
|
||||||
break;
|
break;
|
||||||
case ShareBuilder.APP_INTERNAL:
|
case ShareBean.APP_INTERNAL:
|
||||||
new Internal(itemView.getContext()).share(bean, shareCallback);
|
new Internal(itemView.getContext()).share(bean, shareCallback);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
260
Share/src/main/java/com/yunbao/share/bean/ShareBean.java
Normal file
260
Share/src/main/java/com/yunbao/share/bean/ShareBean.java
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
package com.yunbao.share.bean;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.yunbao.common.CommonAppConfig;
|
||||||
|
import com.yunbao.common.utils.StringUtil;
|
||||||
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.share.ui.SharePopDialog;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class ShareBean {
|
||||||
|
public static final int APP_FACEBOOK = 0;
|
||||||
|
public static final int APP_LINE = 1;
|
||||||
|
public static final int APP_TWITTER = 2;
|
||||||
|
public static final int APP_WHATSAPP = 3;
|
||||||
|
public static final int APP_MESSENGER = 4;
|
||||||
|
public static final int APP_INSTAGRAM = 5;
|
||||||
|
public static final int APP_INTERNAL = 6;
|
||||||
|
|
||||||
|
private String text;
|
||||||
|
private String link;
|
||||||
|
private File file;
|
||||||
|
private int type;
|
||||||
|
private String uid;
|
||||||
|
private String anchorId;
|
||||||
|
private String anchorName;
|
||||||
|
private String anchorAvatar;
|
||||||
|
private int shareType;
|
||||||
|
private String cover;
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
|
||||||
|
public static String createLiveShareLink(String shareUid, String anchorId, String anchorName, String anchorAvatar) {
|
||||||
|
return String.format(CommonAppConfig.HOST +
|
||||||
|
"/index.php?g=Appapi&m=home&a=share&uid=%s&user_id=%s&isGoogle=%s",
|
||||||
|
anchorId,
|
||||||
|
shareUid,
|
||||||
|
CommonAppConfig.IS_GOOGLE_PLAY
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String createInviteLink(String shareUid) {
|
||||||
|
return String.format("https://www.pdlive.com/public/app/download/index.html?user_id=%s&isGoogle=%s",
|
||||||
|
shareUid,
|
||||||
|
CommonAppConfig.IS_GOOGLE_PLAY
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ShareBean builder(int type) {
|
||||||
|
return new ShareBean(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ShareBean(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getShareType() {
|
||||||
|
return shareType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShareType(int shareType) {
|
||||||
|
this.shareType = shareType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCover() {
|
||||||
|
return cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCover(String cover) {
|
||||||
|
this.cover = cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(String uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAnchorId() {
|
||||||
|
return anchorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnchorId(String anchorId) {
|
||||||
|
this.anchorId = anchorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAnchorName() {
|
||||||
|
return anchorName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnchorName(String anchorName) {
|
||||||
|
this.anchorName = anchorName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAnchorAvatar() {
|
||||||
|
return anchorAvatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnchorAvatar(String anchorAvatar) {
|
||||||
|
this.anchorAvatar = anchorAvatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBean setText(String text) {
|
||||||
|
this.text = text;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBean setLink(String link) {
|
||||||
|
this.link = link;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBean setFile(File file) {
|
||||||
|
this.file = file;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
if (StringUtil.isEmpty(text)) {
|
||||||
|
return getLink();
|
||||||
|
}
|
||||||
|
return text + "\n" + getLink();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLink() {
|
||||||
|
if (StringUtil.isEmpty(link)) {
|
||||||
|
link = createLiveShareLink(uid, anchorId, anchorName, anchorAvatar);
|
||||||
|
}
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getFile() {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ShareBuilder{" +
|
||||||
|
"text='" + text + '\'' +
|
||||||
|
", link='" + link + '\'' +
|
||||||
|
", file=" + file +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* private String text;
|
||||||
|
* private String link;
|
||||||
|
* private File file;
|
||||||
|
* private int type;
|
||||||
|
* private String uid;
|
||||||
|
* private String anchorId;
|
||||||
|
* private String anchorName;
|
||||||
|
* private String anchorAvatar;
|
||||||
|
* private int shareType;
|
||||||
|
* private String cover;
|
||||||
|
* private String title;
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ShareBean clone(){
|
||||||
|
ShareBean bean=new ShareBean(type);
|
||||||
|
bean.anchorId=anchorId;
|
||||||
|
bean.anchorName=anchorName;
|
||||||
|
bean.anchorAvatar=anchorAvatar;
|
||||||
|
bean.text=text;
|
||||||
|
bean.link=link;
|
||||||
|
bean.file=file;
|
||||||
|
bean.uid=uid;
|
||||||
|
bean.shareType=shareType;
|
||||||
|
bean.cover=cover;
|
||||||
|
bean.title=title;
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ShareBuilder {
|
||||||
|
ShareBean bean;
|
||||||
|
|
||||||
|
public ShareBuilder() {
|
||||||
|
bean = new ShareBean(APP_FACEBOOK);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBuilder setShareType(int shareType) {
|
||||||
|
bean.setShareType(shareType);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBuilder setCover(String cover) {
|
||||||
|
bean.setCover(cover);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBuilder setTitle(String title) {
|
||||||
|
bean.setTitle(title);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBuilder setUid(String uid) {
|
||||||
|
bean.setUid(uid);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBuilder setAnchorId(String anchorId) {
|
||||||
|
bean.setAnchorId(anchorId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBuilder setAnchorName(String anchorName) {
|
||||||
|
bean.setAnchorName(anchorName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBuilder setAnchorAvatar(String anchorAvatar) {
|
||||||
|
bean.setAnchorAvatar(anchorAvatar);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBuilder setText(String text) {
|
||||||
|
bean.setText(text);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBuilder setLink(String link) {
|
||||||
|
bean.setLink(link);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShareBuilder setFile(File file) {
|
||||||
|
bean.setFile(file);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public ShareBean build() {
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static ShareBuilder create() {
|
||||||
|
return new ShareBuilder();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,135 +0,0 @@
|
|||||||
package com.yunbao.share.bean;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.yunbao.common.CommonAppConfig;
|
|
||||||
import com.yunbao.common.CommonAppContext;
|
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
|
||||||
import com.yunbao.common.utils.StringUtil;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class ShareBuilder {
|
|
||||||
public static final int APP_FACEBOOK = 0;
|
|
||||||
public static final int APP_LINE = 1;
|
|
||||||
public static final int APP_TWITTER = 2;
|
|
||||||
public static final int APP_WHATSAPP = 3;
|
|
||||||
public static final int APP_MESSENGER = 4;
|
|
||||||
public static final int APP_INSTAGRAM = 5;
|
|
||||||
public static final int APP_INTERNAL = 6;
|
|
||||||
|
|
||||||
private String text;
|
|
||||||
private String link;
|
|
||||||
private File file;
|
|
||||||
private int type;
|
|
||||||
private String uid;
|
|
||||||
private String anchorId;
|
|
||||||
private String anchorName;
|
|
||||||
private String anchorAvatar;
|
|
||||||
|
|
||||||
public static String createLiveShareLink(String shareUid, String anchorId, String anchorName, String anchorAvatar) {
|
|
||||||
return String.format(CommonAppConfig.HOST +
|
|
||||||
"/index.php?g=Appapi&m=home&a=share&uid=%s&user_id=%s&isGoogle=%s",
|
|
||||||
anchorId,
|
|
||||||
shareUid,
|
|
||||||
CommonAppConfig.IS_GOOGLE_PLAY
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String createInviteLink(String shareUid) {
|
|
||||||
return String.format("https://www.pdlive.com/public/app/download/index.html?user_id=%s&isGoogle=%s",
|
|
||||||
shareUid,
|
|
||||||
CommonAppConfig.IS_GOOGLE_PLAY
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ShareBuilder builder(int type) {
|
|
||||||
return new ShareBuilder(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ShareBuilder(int type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUid() {
|
|
||||||
return uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUid(String uid) {
|
|
||||||
this.uid = uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAnchorId() {
|
|
||||||
return anchorId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAnchorId(String anchorId) {
|
|
||||||
this.anchorId = anchorId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAnchorName() {
|
|
||||||
return anchorName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAnchorName(String anchorName) {
|
|
||||||
this.anchorName = anchorName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAnchorAvatar() {
|
|
||||||
return anchorAvatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAnchorAvatar(String anchorAvatar) {
|
|
||||||
this.anchorAvatar = anchorAvatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShareBuilder setText(String text) {
|
|
||||||
this.text = text;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShareBuilder setLink(String link) {
|
|
||||||
this.link = link;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShareBuilder setFile(File file) {
|
|
||||||
this.file = file;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getText() {
|
|
||||||
if (StringUtil.isEmpty(text)) {
|
|
||||||
return getLink();
|
|
||||||
}
|
|
||||||
return text + "\n" + getLink();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLink() {
|
|
||||||
if (StringUtil.isEmpty(link)) {
|
|
||||||
link = createLiveShareLink(uid, anchorId, anchorName, anchorAvatar);
|
|
||||||
}
|
|
||||||
return link;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getFile() {
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "ShareBuilder{" +
|
|
||||||
"text='" + text + '\'' +
|
|
||||||
", link='" + link + '\'' +
|
|
||||||
", file=" + file +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,10 +12,9 @@ import com.facebook.FacebookException;
|
|||||||
import com.facebook.share.Sharer;
|
import com.facebook.share.Sharer;
|
||||||
import com.facebook.share.model.ShareLinkContent;
|
import com.facebook.share.model.ShareLinkContent;
|
||||||
import com.facebook.share.widget.ShareDialog;
|
import com.facebook.share.widget.ShareDialog;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
|
||||||
import com.yunbao.share.AbsShareInterface;
|
import com.yunbao.share.AbsShareInterface;
|
||||||
import com.yunbao.share.ICallback;
|
import com.yunbao.share.ICallback;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
|
|
||||||
public class FacebookShare extends AbsShareInterface {
|
public class FacebookShare extends AbsShareInterface {
|
||||||
public static CallbackManager callbackManager;
|
public static CallbackManager callbackManager;
|
||||||
@ -24,7 +23,7 @@ public class FacebookShare extends AbsShareInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void share(ShareBuilder builder, ICallback callback) {
|
public void share(ShareBean builder, ICallback callback) {
|
||||||
callbackManager= CallbackManager.Factory.create();
|
callbackManager= CallbackManager.Factory.create();
|
||||||
ShareLinkContent content = new ShareLinkContent.Builder()
|
ShareLinkContent content = new ShareLinkContent.Builder()
|
||||||
.setContentUrl(Uri.parse(builder.getLink()))
|
.setContentUrl(Uri.parse(builder.getLink()))
|
||||||
|
@ -6,7 +6,7 @@ import android.net.Uri;
|
|||||||
|
|
||||||
import com.yunbao.share.AbsShareInterface;
|
import com.yunbao.share.AbsShareInterface;
|
||||||
import com.yunbao.share.ICallback;
|
import com.yunbao.share.ICallback;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
|
|
||||||
public class Instagram extends AbsShareInterface {
|
public class Instagram extends AbsShareInterface {
|
||||||
public Instagram(Context context) {
|
public Instagram(Context context) {
|
||||||
@ -14,7 +14,7 @@ public class Instagram extends AbsShareInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void share(ShareBuilder builder, ICallback callback) {
|
public void share(ShareBean builder, ICallback callback) {
|
||||||
String type = "image/*";
|
String type = "image/*";
|
||||||
Intent share = new Intent(Intent.ACTION_SEND);
|
Intent share = new Intent(Intent.ACTION_SEND);
|
||||||
Uri uri = fileToUri(builder.getFile());
|
Uri uri = fileToUri(builder.getFile());
|
||||||
|
@ -3,20 +3,23 @@ package com.yunbao.share.platform;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.interfaces.OnSendMessageListener;
|
||||||
|
import com.yunbao.common.message.content.MessageChatCardContent;
|
||||||
import com.yunbao.share.AbsShareInterface;
|
import com.yunbao.share.AbsShareInterface;
|
||||||
import com.yunbao.share.ICallback;
|
import com.yunbao.share.ICallback;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
import com.yunbao.share.ui.AppInternalShareDialog;
|
import com.yunbao.share.ui.AppInternalShareDialog;
|
||||||
import com.yunbao.share.ui.ShareSuccessNotifyDialog;
|
import com.yunbao.share.ui.ShareSuccessNotifyDialog;
|
||||||
|
|
||||||
|
import io.rong.imlib.model.Conversation;
|
||||||
|
|
||||||
public class Internal extends AbsShareInterface {
|
public class Internal extends AbsShareInterface {
|
||||||
public Internal(Context context) {
|
public Internal(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void share(ShareBuilder builder, ICallback callback) {
|
public void share(ShareBean builder, ICallback callback) {
|
||||||
new AppInternalShareDialog(mContext)
|
new AppInternalShareDialog(mContext)
|
||||||
.setOnItemClickListener(new OnItemClickListener<String>() {
|
.setOnItemClickListener(new OnItemClickListener<String>() {
|
||||||
@Override
|
@Override
|
||||||
@ -26,10 +29,35 @@ public class Internal extends AbsShareInterface {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
builder.setUid(toUid);
|
builder.setUid(toUid);
|
||||||
|
sendMessage(builder);
|
||||||
new ShareSuccessNotifyDialog(mContext, builder)
|
new ShareSuccessNotifyDialog(mContext, builder)
|
||||||
.showDialog();
|
.showDialog();
|
||||||
callback.onSuccess();
|
callback.onSuccess();
|
||||||
}
|
}
|
||||||
}).showDialog();
|
}).showDialog();
|
||||||
}
|
}
|
||||||
|
void sendMessage(ShareBean builder){
|
||||||
|
MessageChatCardContent.sendMessage(Conversation.ConversationType.PRIVATE, builder.getUid(),
|
||||||
|
MessageChatCardContent.obtain(
|
||||||
|
builder.getCover(),
|
||||||
|
builder.getTitle(),
|
||||||
|
builder.getAnchorAvatar(),
|
||||||
|
builder.getAnchorName(),
|
||||||
|
builder.getAnchorId(),
|
||||||
|
"1",
|
||||||
|
builder.getAnchorId()
|
||||||
|
),
|
||||||
|
new OnSendMessageListener<Object>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String token, Object bean) {
|
||||||
|
super.onSuccess(token, bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int status, String msg) {
|
||||||
|
super.onError(status, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import android.net.Uri;
|
|||||||
|
|
||||||
import com.yunbao.share.AbsShareInterface;
|
import com.yunbao.share.AbsShareInterface;
|
||||||
import com.yunbao.share.ICallback;
|
import com.yunbao.share.ICallback;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class Line extends AbsShareInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void share(ShareBuilder builder, ICallback callback) {
|
public void share(ShareBean builder, ICallback callback) {
|
||||||
try {
|
try {
|
||||||
Intent share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=" + URLEncoder.encode(builder.getText(), "UTF-8")));
|
Intent share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=" + URLEncoder.encode(builder.getText(), "UTF-8")));
|
||||||
mContext.startActivity(share);
|
mContext.startActivity(share);
|
||||||
|
@ -13,10 +13,9 @@ import com.facebook.FacebookSdk;
|
|||||||
import com.facebook.share.Sharer;
|
import com.facebook.share.Sharer;
|
||||||
import com.facebook.share.model.ShareLinkContent;
|
import com.facebook.share.model.ShareLinkContent;
|
||||||
import com.facebook.share.widget.MessageDialog;
|
import com.facebook.share.widget.MessageDialog;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
|
||||||
import com.yunbao.share.AbsShareInterface;
|
import com.yunbao.share.AbsShareInterface;
|
||||||
import com.yunbao.share.ICallback;
|
import com.yunbao.share.ICallback;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
|
|
||||||
public class MessengerShare extends AbsShareInterface {
|
public class MessengerShare extends AbsShareInterface {
|
||||||
public static CallbackManager callbackManager;
|
public static CallbackManager callbackManager;
|
||||||
@ -27,7 +26,7 @@ public class MessengerShare extends AbsShareInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void share(ShareBuilder builder, ICallback callback) {
|
public void share(ShareBean builder, ICallback callback) {
|
||||||
callbackManager = CallbackManager.Factory.create();
|
callbackManager = CallbackManager.Factory.create();
|
||||||
ShareLinkContent content = new ShareLinkContent.Builder()
|
ShareLinkContent content = new ShareLinkContent.Builder()
|
||||||
.setContentUrl(Uri.parse(builder.getLink()))
|
.setContentUrl(Uri.parse(builder.getLink()))
|
||||||
|
@ -7,7 +7,7 @@ import android.net.Uri;
|
|||||||
import com.twitter.sdk.android.core.Twitter;
|
import com.twitter.sdk.android.core.Twitter;
|
||||||
import com.yunbao.share.AbsShareInterface;
|
import com.yunbao.share.AbsShareInterface;
|
||||||
import com.yunbao.share.ICallback;
|
import com.yunbao.share.ICallback;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ public class TwitterShare extends AbsShareInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void share(ShareBuilder date, ICallback callback) {
|
public void share(ShareBean date, ICallback callback) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
new TwitterAuthClient().authorize((Activity) mContext, new Callback<TwitterSession>() {
|
new TwitterAuthClient().authorize((Activity) mContext, new Callback<TwitterSession>() {
|
||||||
|
@ -5,7 +5,7 @@ import android.content.Intent;
|
|||||||
|
|
||||||
import com.yunbao.share.AbsShareInterface;
|
import com.yunbao.share.AbsShareInterface;
|
||||||
import com.yunbao.share.ICallback;
|
import com.yunbao.share.ICallback;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
|
|
||||||
public class WhatsApp extends AbsShareInterface {
|
public class WhatsApp extends AbsShareInterface {
|
||||||
public WhatsApp(Context context) {
|
public WhatsApp(Context context) {
|
||||||
@ -13,7 +13,7 @@ public class WhatsApp extends AbsShareInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void share(ShareBuilder builder, ICallback callback) {
|
public void share(ShareBean builder, ICallback callback) {
|
||||||
try {
|
try {
|
||||||
Intent sendIntent = new Intent();
|
Intent sendIntent = new Intent();
|
||||||
sendIntent.setAction(Intent.ACTION_SEND);
|
sendIntent.setAction(Intent.ACTION_SEND);
|
||||||
|
@ -2,27 +2,21 @@ package com.yunbao.share.ui;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
import com.pdlive.shayu.R;
|
import com.pdlive.shayu.R;
|
||||||
import com.yunbao.common.bean.MessageChatUserBean;
|
|
||||||
import com.yunbao.common.dialog.AbsDialogFullScreenPopupWindow;
|
import com.yunbao.common.dialog.AbsDialogFullScreenPopupWindow;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.utils.ViewUtils;
|
|
||||||
import com.yunbao.share.adapters.InternalShareAdapter;
|
import com.yunbao.share.adapters.InternalShareAdapter;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.rong.imkit.conversationlist.model.SingleConversation;
|
import io.rong.imkit.conversationlist.model.SingleConversation;
|
||||||
import io.rong.imkit.userinfo.RongUserInfoManager;
|
|
||||||
import io.rong.imkit.widget.refresh.SmartRefreshLayout;
|
import io.rong.imkit.widget.refresh.SmartRefreshLayout;
|
||||||
import io.rong.imkit.widget.refresh.api.RefreshLayout;
|
import io.rong.imkit.widget.refresh.api.RefreshLayout;
|
||||||
import io.rong.imkit.widget.refresh.listener.OnLoadMoreListener;
|
import io.rong.imkit.widget.refresh.listener.OnLoadMoreListener;
|
||||||
@ -31,7 +25,6 @@ import io.rong.imkit.widget.refresh.wrapper.RongRefreshHeader;
|
|||||||
import io.rong.imlib.IRongCoreCallback;
|
import io.rong.imlib.IRongCoreCallback;
|
||||||
import io.rong.imlib.IRongCoreEnum;
|
import io.rong.imlib.IRongCoreEnum;
|
||||||
import io.rong.imlib.RongCoreClient;
|
import io.rong.imlib.RongCoreClient;
|
||||||
import io.rong.imlib.RongIMClient;
|
|
||||||
import io.rong.imlib.model.Conversation;
|
import io.rong.imlib.model.Conversation;
|
||||||
|
|
||||||
public class AppInternalShareDialog extends AbsDialogFullScreenPopupWindow {
|
public class AppInternalShareDialog extends AbsDialogFullScreenPopupWindow {
|
||||||
@ -72,6 +65,10 @@ public class AppInternalShareDialog extends AbsDialogFullScreenPopupWindow {
|
|||||||
dismiss();
|
dismiss();
|
||||||
});
|
});
|
||||||
findViewById(R.id.btn_share).setOnClickListener(view -> {
|
findViewById(R.id.btn_share).setOnClickListener(view -> {
|
||||||
|
if(adapter.getSelectPosition()==-1){
|
||||||
|
ToastUtil.show(R.string.dialog_share_failure_not_select);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (onItemClickListener != null) {
|
if (onItemClickListener != null) {
|
||||||
onItemClickListener.onItemClick(listData.get(adapter.getSelectPosition()).mCore.getTargetId(), adapter.getSelectPosition());
|
onItemClickListener.onItemClick(listData.get(adapter.getSelectPosition()).mCore.getTargetId(), adapter.getSelectPosition());
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,12 @@ package com.yunbao.share.ui;
|
|||||||
|
|
||||||
import static android.content.Context.CLIPBOARD_SERVICE;
|
import static android.content.Context.CLIPBOARD_SERVICE;
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.LinearGradient;
|
import android.graphics.LinearGradient;
|
||||||
import android.graphics.Shader;
|
import android.graphics.Shader;
|
||||||
import android.view.ViewTreeObserver;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -22,10 +20,8 @@ import com.makeramen.roundedimageview.RoundedImageView;
|
|||||||
import com.pdlive.shayu.R;
|
import com.pdlive.shayu.R;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
|
||||||
import com.yunbao.share.adapters.ShareAppAdapter;
|
import com.yunbao.share.adapters.ShareAppAdapter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -38,7 +34,7 @@ public class InvitePopDialog extends AbsDialogPopupWindow {
|
|||||||
private TextView info;
|
private TextView info;
|
||||||
private TextView link;
|
private TextView link;
|
||||||
private TextView title;
|
private TextView title;
|
||||||
private List<ShareBuilder> data;
|
private List<ShareBean> data;
|
||||||
|
|
||||||
private String uid;
|
private String uid;
|
||||||
private String anchorId;
|
private String anchorId;
|
||||||
@ -123,18 +119,18 @@ public class InvitePopDialog extends AbsDialogPopupWindow {
|
|||||||
|
|
||||||
private void initData() {
|
private void initData() {
|
||||||
data = new ArrayList<>();
|
data = new ArrayList<>();
|
||||||
data.add(builder(ShareBuilder.APP_FACEBOOK));
|
data.add(builder(ShareBean.APP_FACEBOOK));
|
||||||
data.add(builder(ShareBuilder.APP_LINE));
|
data.add(builder(ShareBean.APP_LINE));
|
||||||
data.add(builder(ShareBuilder.APP_TWITTER));
|
data.add(builder(ShareBean.APP_TWITTER));
|
||||||
data.add(builder(ShareBuilder.APP_WHATSAPP));
|
data.add(builder(ShareBean.APP_WHATSAPP));
|
||||||
data.add(builder(ShareBuilder.APP_MESSENGER));
|
data.add(builder(ShareBean.APP_MESSENGER));
|
||||||
// data.add(builder(ShareBuilder.APP_INSTAGRAM));
|
// data.add(builder(ShareBuilder.APP_INSTAGRAM));
|
||||||
adapter.setList(data);
|
adapter.setList(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ShareBuilder builder(int type) {
|
private ShareBean builder(int type) {
|
||||||
ShareBuilder builder = ShareBuilder.builder(type);
|
ShareBean builder = ShareBean.builder(type);
|
||||||
builder.setText(getContext().getString(R.string.dialog_invite_info));
|
builder.setText(getContext().getString(R.string.dialog_invite_info));
|
||||||
builder.setLink(url);
|
builder.setLink(url);
|
||||||
builder.setUid(uid);
|
builder.setUid(uid);
|
||||||
|
@ -12,58 +12,48 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
import com.lxj.xpopup.util.XPopupUtils;
|
|
||||||
import com.makeramen.roundedimageview.RoundedImageView;
|
import com.makeramen.roundedimageview.RoundedImageView;
|
||||||
import com.pdlive.shayu.R;
|
import com.pdlive.shayu.R;
|
||||||
|
import com.yunbao.common.dialog.AbsDialogCenterPopupWindow;
|
||||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
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.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.share.adapters.ShareAppAdapter;
|
import com.yunbao.share.adapters.ShareAppAdapter;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SharePopDialog extends AbsDialogPopupWindow {
|
public class SharePopDialog extends AbsDialogPopupWindow {
|
||||||
|
public static final int TYPE_LIVE = 0;
|
||||||
|
public static final int TYPE_DYNAMIC = 1;
|
||||||
private ShareAppAdapter adapter;
|
private ShareAppAdapter adapter;
|
||||||
private RecyclerView list;
|
private RecyclerView list;
|
||||||
private RoundedImageView avatar;
|
private RoundedImageView avatar;
|
||||||
private TextView info;
|
private TextView info;
|
||||||
private TextView link;
|
private TextView link;
|
||||||
private List<ShareBuilder> data;
|
private List<ShareBean> data;
|
||||||
|
|
||||||
private String uid;
|
|
||||||
private String anchorId;
|
|
||||||
private String anchorName;
|
|
||||||
private String anchorAvatar;
|
|
||||||
private String shareLink;
|
private String shareLink;
|
||||||
|
private int type;
|
||||||
|
private ShareBean bean;
|
||||||
|
|
||||||
public SharePopDialog(@NonNull Context context) {
|
public SharePopDialog(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SharePopDialog setUid(String uid) {
|
|
||||||
this.uid = uid;
|
public SharePopDialog setShareType(int type) {
|
||||||
|
this.type = type;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SharePopDialog setAnchorId(String anchorId) {
|
public SharePopDialog setShareData(ShareBean build) {
|
||||||
this.anchorId = anchorId;
|
this.bean=build;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SharePopDialog setAnchorName(String anchorName) {
|
|
||||||
this.anchorName = anchorName;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SharePopDialog setAnchorAvatar(String anchorAvatar) {
|
|
||||||
this.anchorAvatar = anchorAvatar;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SharePopDialog setShareLink(String link) {
|
public SharePopDialog setShareLink(String link) {
|
||||||
this.shareLink = link + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
this.shareLink = link + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
||||||
return this;
|
return this;
|
||||||
@ -89,7 +79,7 @@ public class SharePopDialog extends AbsDialogPopupWindow {
|
|||||||
info = findViewById(R.id.share_info);
|
info = findViewById(R.id.share_info);
|
||||||
link = findViewById(R.id.share_link);
|
link = findViewById(R.id.share_link);
|
||||||
adapter = new ShareAppAdapter(getContext());
|
adapter = new ShareAppAdapter(getContext());
|
||||||
adapter.setOnShareStatusListener(new ShareAppAdapter.ShareCallback(){
|
adapter.setOnShareStatusListener(new ShareAppAdapter.ShareCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
super.onSuccess();
|
super.onSuccess();
|
||||||
@ -103,16 +93,16 @@ public class SharePopDialog extends AbsDialogPopupWindow {
|
|||||||
|
|
||||||
private void initData() {
|
private void initData() {
|
||||||
data = new ArrayList<>();
|
data = new ArrayList<>();
|
||||||
data.add(builder(ShareBuilder.APP_FACEBOOK));
|
data.add(builder(ShareBean.APP_FACEBOOK));
|
||||||
data.add(builder(ShareBuilder.APP_LINE));
|
data.add(builder(ShareBean.APP_LINE));
|
||||||
data.add(builder(ShareBuilder.APP_TWITTER));
|
data.add(builder(ShareBean.APP_TWITTER));
|
||||||
data.add(builder(ShareBuilder.APP_WHATSAPP));
|
data.add(builder(ShareBean.APP_WHATSAPP));
|
||||||
data.add(builder(ShareBuilder.APP_MESSENGER));
|
data.add(builder(ShareBean.APP_MESSENGER));
|
||||||
data.add(builder(ShareBuilder.APP_INTERNAL));
|
data.add(builder(ShareBean.APP_INTERNAL));
|
||||||
adapter.setList(data);
|
adapter.setList(data);
|
||||||
String url;
|
String url;
|
||||||
if (shareLink == null) {
|
if (shareLink == null) {
|
||||||
url = ShareBuilder.createLiveShareLink(uid, anchorId, anchorName, anchorAvatar).substring(0, 40) + "...";
|
url = ShareBean.createLiveShareLink(bean.getUid(), bean.getAnchorId(), bean.getAnchorName(), bean.getAnchorAvatar()).substring(0, 40) + "...";
|
||||||
} else {
|
} else {
|
||||||
if (shareLink.length() > 40) {
|
if (shareLink.length() > 40) {
|
||||||
url = shareLink.substring(0, 40) + "...";
|
url = shareLink.substring(0, 40) + "...";
|
||||||
@ -122,20 +112,14 @@ public class SharePopDialog extends AbsDialogPopupWindow {
|
|||||||
}
|
}
|
||||||
url = url + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
url = url + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
||||||
link.setText(url);
|
link.setText(url);
|
||||||
info.setText(String.format(getContext().getString(R.string.dialog_share_info), StringUtil.isEmpty(anchorName) ? "" : anchorName));
|
info.setText(String.format(getContext().getString(R.string.dialog_share_info), StringUtil.isEmpty(bean.getAnchorName()) ? "" : bean.getAnchorName()));
|
||||||
ImgLoader.display(getContext(), anchorAvatar, avatar);
|
ImgLoader.display(getContext(), bean.getAnchorAvatar(), avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ShareBuilder builder(int type) {
|
private ShareBean builder(int type) {
|
||||||
ShareBuilder builder = ShareBuilder.builder(type);
|
ShareBean builder = bean.clone();
|
||||||
builder.setText(String.format(getContext().getString(R.string.dialog_share_info), StringUtil.isEmpty(anchorName) ? "" : anchorName));
|
builder.setType(type);
|
||||||
builder.setUid(uid);
|
builder.setText(String.format(getContext().getString(R.string.dialog_share_info), StringUtil.isEmpty(bean.getAnchorName()) ? "" : bean.getAnchorName()));
|
||||||
builder.setAnchorId(anchorId);
|
|
||||||
builder.setAnchorName(anchorName);
|
|
||||||
builder.setAnchorAvatar(anchorAvatar);
|
|
||||||
if (shareLink != null) {
|
|
||||||
builder.setLink(shareLink);
|
|
||||||
}
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,11 +128,12 @@ public class SharePopDialog extends AbsDialogPopupWindow {
|
|||||||
if (shareLink != null) {
|
if (shareLink != null) {
|
||||||
url = shareLink;
|
url = shareLink;
|
||||||
} else {
|
} else {
|
||||||
url = ShareBuilder.createLiveShareLink(uid, anchorId, anchorName, anchorAvatar);
|
url = ShareBean.createLiveShareLink(bean.getUid(), bean.getAnchorId(), bean.getAnchorName(), bean.getAnchorAvatar());
|
||||||
}
|
}
|
||||||
ClipboardManager cm = (ClipboardManager) getContext().getSystemService(CLIPBOARD_SERVICE);
|
ClipboardManager cm = (ClipboardManager) getContext().getSystemService(CLIPBOARD_SERVICE);
|
||||||
ClipData clipData = ClipData.newPlainText("text", info.getText().toString() + "\n" + url + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0));
|
ClipData clipData = ClipData.newPlainText("text", info.getText().toString() + "\n" + url + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0));
|
||||||
cm.setPrimaryClip(clipData);
|
cm.setPrimaryClip(clipData);
|
||||||
ToastUtil.show(getContext().getString(com.yunbao.common.R.string.copy_success));
|
ToastUtil.show(getContext().getString(com.yunbao.common.R.string.copy_success));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,19 +11,16 @@ import androidx.annotation.NonNull;
|
|||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
import com.lxj.xpopup.enums.PopupAnimation;
|
import com.lxj.xpopup.enums.PopupAnimation;
|
||||||
import com.pdlive.shayu.R;
|
import com.pdlive.shayu.R;
|
||||||
import com.yunbao.common.bean.MessageUserInfoBean;
|
|
||||||
import com.yunbao.common.custom.RatioRoundImageView;
|
import com.yunbao.common.custom.RatioRoundImageView;
|
||||||
import com.yunbao.common.dialog.AbsDialogPositionPopupWindow;
|
import com.yunbao.common.dialog.AbsDialogPositionPopupWindow;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.share.bean.ShareBean;
|
||||||
import com.yunbao.share.bean.ShareBuilder;
|
|
||||||
|
|
||||||
import io.rong.imkit.utils.RouteUtils;
|
import io.rong.imkit.utils.RouteUtils;
|
||||||
import io.rong.imlib.model.Conversation;
|
import io.rong.imlib.model.Conversation;
|
||||||
|
|
||||||
public class ShareSuccessNotifyDialog extends AbsDialogPositionPopupWindow {
|
public class ShareSuccessNotifyDialog extends AbsDialogPositionPopupWindow {
|
||||||
private ShareBuilder bean;
|
private ShareBean bean;
|
||||||
private DialogInterface.OnDismissListener onDismissListener;
|
private DialogInterface.OnDismissListener onDismissListener;
|
||||||
|
|
||||||
private TextView anchorName;
|
private TextView anchorName;
|
||||||
@ -34,7 +31,7 @@ public class ShareSuccessNotifyDialog extends AbsDialogPositionPopupWindow {
|
|||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShareSuccessNotifyDialog(@NonNull Context context, ShareBuilder bean) {
|
public ShareSuccessNotifyDialog(@NonNull Context context, ShareBean bean) {
|
||||||
super(context);
|
super(context);
|
||||||
this.bean = bean;
|
this.bean = bean;
|
||||||
}
|
}
|
||||||
|
@ -12,4 +12,5 @@
|
|||||||
<string name="dialog_share_internal_list_btn">Share</string>
|
<string name="dialog_share_internal_list_btn">Share</string>
|
||||||
<string name="dialog_share_success">Success</string>
|
<string name="dialog_share_success">Success</string>
|
||||||
<string name="dialog_share_success_btn">Chat</string>
|
<string name="dialog_share_success_btn">Chat</string>
|
||||||
|
<string name="dialog_share_failure_not_select">Please select friends</string>
|
||||||
</resources>
|
</resources>
|
@ -21,4 +21,5 @@
|
|||||||
<string name="dialog_share_internal_list_btn">發送</string>
|
<string name="dialog_share_internal_list_btn">發送</string>
|
||||||
<string name="dialog_share_success">分享成功</string>
|
<string name="dialog_share_success">分享成功</string>
|
||||||
<string name="dialog_share_success_btn">去聊聊</string>
|
<string name="dialog_share_success_btn">去聊聊</string>
|
||||||
|
<string name="dialog_share_failure_not_select">请选择好友</string>
|
||||||
</resources>
|
</resources>
|
@ -44,7 +44,9 @@ import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider;
|
|||||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||||
import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
|
import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
|
||||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||||
|
import com.yunbao.common.message.content.MessageChatCardContent;
|
||||||
import com.yunbao.common.message.content.MessageChatTipsContent;
|
import com.yunbao.common.message.content.MessageChatTipsContent;
|
||||||
|
import com.yunbao.common.provider.MessageChatCardItemProvider;
|
||||||
import com.yunbao.common.provider.MessageChatTipsItemProvider;
|
import com.yunbao.common.provider.MessageChatTipsItemProvider;
|
||||||
import com.yunbao.common.utils.AppManager;
|
import com.yunbao.common.utils.AppManager;
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
@ -220,12 +222,14 @@ public class AppContext extends CommonAppContext {
|
|||||||
myMessages.add(RecommendLiveRoom.class);
|
myMessages.add(RecommendLiveRoom.class);
|
||||||
myMessages.add(InstructorSendReward.class);
|
myMessages.add(InstructorSendReward.class);
|
||||||
myMessages.add(MessageChatTipsContent.class);
|
myMessages.add(MessageChatTipsContent.class);
|
||||||
|
myMessages.add(MessageChatCardContent.class);
|
||||||
|
|
||||||
RongIMClient.registerMessageType(myMessages);
|
RongIMClient.registerMessageType(myMessages);
|
||||||
// 注册自定义消息模板
|
// 注册自定义消息模板
|
||||||
RongConfigCenter.conversationConfig().addMessageProvider(new InstructorSendRewardProvider(getApplicationContext()));
|
RongConfigCenter.conversationConfig().addMessageProvider(new InstructorSendRewardProvider(getApplicationContext()));
|
||||||
RongConfigCenter.conversationConfig().addMessageProvider(new RecommendLiveRoomProvider(getApplicationContext()));
|
RongConfigCenter.conversationConfig().addMessageProvider(new RecommendLiveRoomProvider(getApplicationContext()));
|
||||||
RongConfigCenter.conversationConfig().addMessageProvider(new MessageChatTipsItemProvider(getApplicationContext()));
|
RongConfigCenter.conversationConfig().addMessageProvider(new MessageChatTipsItemProvider(getApplicationContext()));
|
||||||
|
RongConfigCenter.conversationConfig().addMessageProvider(new MessageChatCardItemProvider(getApplicationContext()));
|
||||||
|
|
||||||
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
|
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||||||
public class MessageUserInfoBean extends BaseModel{
|
public class MessageUserInfoBean extends BaseModel{
|
||||||
IMLoginModel user;
|
IMLoginModel user;
|
||||||
UserInfo info;
|
UserInfo info;
|
||||||
UserLevel level;
|
//UserLevel level;
|
||||||
@SerializedName("gift_num")
|
@SerializedName("gift_num")
|
||||||
int giftNum;
|
int giftNum;
|
||||||
@SerializedName("msg")
|
@SerializedName("msg")
|
||||||
@ -60,13 +60,13 @@ public class MessageUserInfoBean extends BaseModel{
|
|||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserLevel getLevel() {
|
/*public UserLevel getLevel() {
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLevel(UserLevel level) {
|
public void setLevel(UserLevel level) {
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public int getGiftNum() {
|
public int getGiftNum() {
|
||||||
return giftNum;
|
return giftNum;
|
||||||
@ -107,6 +107,20 @@ public class MessageUserInfoBean extends BaseModel{
|
|||||||
private String age;
|
private String age;
|
||||||
@SerializedName("open_off")
|
@SerializedName("open_off")
|
||||||
private int openOff;//接单设置 1开启 2关闭
|
private int openOff;//接单设置 1开启 2关闭
|
||||||
|
@SerializedName("rong_online")
|
||||||
|
private int rongOnline;
|
||||||
|
|
||||||
|
public void setOpenOff(int openOff) {
|
||||||
|
this.openOff = openOff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRongOnline() {
|
||||||
|
return rongOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRongOnline(int rongOnline) {
|
||||||
|
this.rongOnline = rongOnline;
|
||||||
|
}
|
||||||
|
|
||||||
public int getOpenOff() {
|
public int getOpenOff() {
|
||||||
return openOff;
|
return openOff;
|
||||||
|
@ -4,9 +4,19 @@ import android.content.Context;
|
|||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.bean.LiveBean;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.http.HttpCallback;
|
||||||
|
import com.yunbao.common.http.LiveHttpUtil;
|
||||||
import com.yunbao.common.message.content.MessageChatCardContent;
|
import com.yunbao.common.message.content.MessageChatCardContent;
|
||||||
import com.yunbao.common.message.content.MessageChatTipsContent;
|
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||||
|
import com.yunbao.common.utils.MicStatusManager;
|
||||||
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
|
import com.yunbao.common.utils.StringUtil;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -21,34 +31,74 @@ public class MessageChatCardItemProvider extends BaseMessageItemProvider<Message
|
|||||||
|
|
||||||
public MessageChatCardItemProvider(Context mContext) {
|
public MessageChatCardItemProvider(Context mContext) {
|
||||||
this.mContext = mContext;
|
this.mContext = mContext;
|
||||||
mConfig.showPortrait = false;
|
mConfig.showPortrait = true;
|
||||||
mConfig.showSummaryWithName = false;
|
mConfig.showSummaryWithName = true;
|
||||||
mConfig.showContentBubble = false;
|
mConfig.showContentBubble = false;
|
||||||
mConfig.centerInHorizontal = true;
|
mConfig.centerInHorizontal = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ViewHolder onCreateMessageContentViewHolder(ViewGroup parent, int viewType) {
|
protected ViewHolder onCreateMessageContentViewHolder(ViewGroup parent, int viewType) {
|
||||||
return ViewHolder.createViewHolder(mContext, parent, R.layout.view_message_chat_tip);
|
return ViewHolder.createViewHolder(mContext, parent, R.layout.view_message_chat_card);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void bindMessageContentViewHolder(ViewHolder holder, ViewHolder parentHolder, MessageChatCardContent content, UiMessage uiMessage, int position, List<UiMessage> list, IViewProviderListener<UiMessage> listener) {
|
protected void bindMessageContentViewHolder(ViewHolder holder, ViewHolder parentHolder, MessageChatCardContent content, UiMessage uiMessage, int position, List<UiMessage> list, IViewProviderListener<UiMessage> listener) {
|
||||||
holder.setText(R.id.tips, content.getAvatar());
|
holder.setText(R.id.user_name, content.getUserName());
|
||||||
|
holder.setText(R.id.titleView, content.getTitle());
|
||||||
|
ImgLoader.display(mContext, content.getAvatar(), holder.getView(R.id.avatar));
|
||||||
|
if (!StringUtil.isEmpty()) {
|
||||||
|
ImgLoader.display(mContext, content.getCover(), holder.getView(R.id.cover));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onItemClick(ViewHolder holder, MessageChatCardContent messageChatTipsContent, 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())) {
|
||||||
|
gotoLive(content.getExtraData());
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isMessageViewType(MessageContent messageContent) {
|
protected boolean isMessageViewType(MessageContent messageContent) {
|
||||||
return messageContent instanceof MessageChatTipsContent;
|
return messageContent instanceof MessageChatCardContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Spannable getSummarySpannable(Context context, MessageChatCardContent content) {
|
public Spannable getSummarySpannable(Context context, MessageChatCardContent content) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void gotoLive(final String live_id) {
|
||||||
|
LiveHttpUtil.getLiveInfo(live_id + "", 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);
|
||||||
|
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||||
|
if (liveBean == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MicStatusManager.getInstance().isMic(liveUid)) {
|
||||||
|
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCheckError(String contextError) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
RouteUtil.forwardUserHome(mContext, String.valueOf(live_id), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
63
common/src/main/res/layout/view_message_chat_card.xml
Normal file
63
common/src/main/res/layout/view_message_chat_card.xml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="192dp"
|
||||||
|
android:layout_height="299dp"
|
||||||
|
android:background="@drawable/bg_msg_list_search">
|
||||||
|
|
||||||
|
|
||||||
|
<com.yunbao.common.custom.RatioRoundImageView
|
||||||
|
android:id="@+id/cover"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="206dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:riv_corner_radius="15dp"
|
||||||
|
app:ri_ratio="1.2"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:src="@mipmap/screen" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/titleView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:textColor="#333333"
|
||||||
|
android:textSize="13sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/cover"
|
||||||
|
tools:text="TextView" />
|
||||||
|
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/avatar"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@mipmap/chat_head_mo"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/titleView"
|
||||||
|
app:riv_oval="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/user_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:text="TextView"
|
||||||
|
android:textColor="#333333"
|
||||||
|
android:textSize="11sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/avatar"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/avatar"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/avatar" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
BIN
common/src/main/res/mipmap-xxhdpi/ic_chat_black.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/ic_chat_black.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/ic_chat_remarks.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/ic_chat_remarks.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/ic_chat_report.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/ic_chat_report.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
@ -26,6 +26,7 @@
|
|||||||
<string name="black">Pull black</string>
|
<string name="black">Pull black</string>
|
||||||
<string name="black_ing">Relieving blackout</string>
|
<string name="black_ing">Relieving blackout</string>
|
||||||
<string name="chat_remarks">Remarks</string>
|
<string name="chat_remarks">Remarks</string>
|
||||||
|
<string name="chat_report">Report</string>
|
||||||
<string name="bonus_sign">Sign in immediately</string>
|
<string name="bonus_sign">Sign in immediately</string>
|
||||||
<string name="bonus_sign_1">Continuously signed in</string>
|
<string name="bonus_sign_1">Continuously signed in</string>
|
||||||
<string name="bonus_day">day</string>
|
<string name="bonus_day">day</string>
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
<string name="refresh_footer_nothing">沒有更多數據了</string>
|
<string name="refresh_footer_nothing">沒有更多數據了</string>
|
||||||
<string name="black">拉黑</string>
|
<string name="black">拉黑</string>
|
||||||
<string name="black_ing">解除拉黑</string>
|
<string name="black_ing">解除拉黑</string>
|
||||||
<string name="chat_remarks">備註</string>
|
<string name="chat_remarks">修改備註</string>
|
||||||
|
<string name="chat_report">舉報</string>
|
||||||
<string name="bonus_sign">立即簽到</string>
|
<string name="bonus_sign">立即簽到</string>
|
||||||
<string name="bonus_sign_1">已連續簽到</string>
|
<string name="bonus_sign_1">已連續簽到</string>
|
||||||
<string name="bonus_day">天</string>
|
<string name="bonus_day">天</string>
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
<string name="refresh_footer_nothing">沒有更多數據了</string>
|
<string name="refresh_footer_nothing">沒有更多數據了</string>
|
||||||
<string name="black">拉黑</string>
|
<string name="black">拉黑</string>
|
||||||
<string name="black_ing">解除拉黑</string>
|
<string name="black_ing">解除拉黑</string>
|
||||||
<string name="chat_remarks">備註</string>
|
<string name="chat_remarks">修改備註</string>
|
||||||
|
<string name="chat_report">舉報</string>
|
||||||
<string name="bonus_sign">立即簽到</string>
|
<string name="bonus_sign">立即簽到</string>
|
||||||
<string name="bonus_sign_1">已連續簽到</string>
|
<string name="bonus_sign_1">已連續簽到</string>
|
||||||
<string name="bonus_day">天</string>
|
<string name="bonus_day">天</string>
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
<string name="refresh_footer_nothing">沒有更多數據了</string>
|
<string name="refresh_footer_nothing">沒有更多數據了</string>
|
||||||
<string name="black">拉黑</string>
|
<string name="black">拉黑</string>
|
||||||
<string name="black_ing">解除拉黑</string>
|
<string name="black_ing">解除拉黑</string>
|
||||||
<string name="chat_remarks">備註</string>
|
<string name="chat_remarks">修改備註</string>
|
||||||
|
<string name="chat_report">舉報</string>
|
||||||
<string name="bonus_sign">立即簽到</string>
|
<string name="bonus_sign">立即簽到</string>
|
||||||
<string name="bonus_sign_1">已連續簽到</string>
|
<string name="bonus_sign_1">已連續簽到</string>
|
||||||
<string name="bonus_day">天</string>
|
<string name="bonus_day">天</string>
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
<string name="black">Pull black</string>
|
<string name="black">Pull black</string>
|
||||||
<string name="black_ing">Relieving blackout</string>
|
<string name="black_ing">Relieving blackout</string>
|
||||||
<string name="chat_remarks">Remarks</string>
|
<string name="chat_remarks">Remarks</string>
|
||||||
|
<string name="chat_report">Report</string>
|
||||||
<string name="bonus_sign">Sign in immediately</string>
|
<string name="bonus_sign">Sign in immediately</string>
|
||||||
<string name="bonus_sign_1">Continuously signed in</string>
|
<string name="bonus_sign_1">Continuously signed in</string>
|
||||||
<string name="bonus_day">day</string>
|
<string name="bonus_day">day</string>
|
||||||
|
@ -123,6 +123,7 @@ import com.yunbao.live.http.ImHttpUtil;
|
|||||||
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
||||||
import com.yunbao.live.views.LiveRoomViewHolder;
|
import com.yunbao.live.views.LiveRoomViewHolder;
|
||||||
import com.yunbao.live.views.PortraitLiveManager;
|
import com.yunbao.live.views.PortraitLiveManager;
|
||||||
|
import com.yunbao.share.bean.ShareBean;
|
||||||
import com.yunbao.share.ui.SharePopDialog;
|
import com.yunbao.share.ui.SharePopDialog;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@ -865,7 +866,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
if (!TextUtils.isEmpty(event.getMethod())) {
|
if (!TextUtils.isEmpty(event.getMethod())) {
|
||||||
if (TextUtils.equals(event.getMethod(), "closeLiveRoom")) {
|
if (TextUtils.equals(event.getMethod(), "closeLiveRoom")) {
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
}else if (TextUtils.equals(event.getMethod(), "androidtoCommunityVideo")) {
|
} else if (TextUtils.equals(event.getMethod(), "androidtoCommunityVideo")) {
|
||||||
RouteUtil.forwardCommunityActivity();
|
RouteUtil.forwardCommunityActivity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1460,10 +1461,16 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
break;
|
break;
|
||||||
case LIVE_SHARE:
|
case LIVE_SHARE:
|
||||||
new SharePopDialog(mContext)
|
new SharePopDialog(mContext)
|
||||||
|
.setShareType(SharePopDialog.TYPE_LIVE)
|
||||||
|
.setShareData(ShareBean.ShareBuilder.create()
|
||||||
.setUid(CommonAppConfig.getInstance().getUid())
|
.setUid(CommonAppConfig.getInstance().getUid())
|
||||||
|
.setCover(StringUtil.isEmpty(event.getBean().getImg()) ? event.getBean().getAvatar() : event.getBean().getImg())
|
||||||
|
.setTitle(StringUtil.isEmpty(event.getBean().getTitle()) ? event.getBean().getUserNiceName() : event.getBean().getTitle())
|
||||||
.setAnchorId(event.getBean().getUid())
|
.setAnchorId(event.getBean().getUid())
|
||||||
.setAnchorName(event.getBean().getUserNiceName())
|
.setAnchorName(event.getBean().getUserNiceName())
|
||||||
.setAnchorAvatar(event.getBean().getAvatar())
|
.setAnchorAvatar(event.getBean().getAvatar())
|
||||||
|
.build()
|
||||||
|
)
|
||||||
.showDialog();
|
.showDialog();
|
||||||
break;
|
break;
|
||||||
case WISH_LIST_PROGRESS:
|
case WISH_LIST_PROGRESS:
|
||||||
|
@ -13,6 +13,8 @@ import android.widget.PopupWindow;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.yunbao.common.http.HttpClient;
|
import com.yunbao.common.http.HttpClient;
|
||||||
|
import com.yunbao.common.utils.DpUtil;
|
||||||
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.activity.EditNameRemarksActivity;
|
import com.yunbao.live.activity.EditNameRemarksActivity;
|
||||||
@ -26,15 +28,15 @@ import io.rong.imlib.RongIMClient;
|
|||||||
public class MenuPopuwWindow implements View.OnClickListener {
|
public class MenuPopuwWindow implements View.OnClickListener {
|
||||||
private Activity mContext;
|
private Activity mContext;
|
||||||
private String userId;
|
private String userId;
|
||||||
private View popupView;
|
private View popupView, ltBlack, ltReport;
|
||||||
private TextView tvBlack, tvBlackMove;
|
private TextView tvBlack;
|
||||||
private LinearLayout ltRemarks;
|
private LinearLayout ltRemarks;
|
||||||
private PopupWindow popupWindow;
|
private PopupWindow popupWindow;
|
||||||
private Handler netHandler = new Handler();
|
private Handler netHandler = new Handler();
|
||||||
|
|
||||||
public MenuPopuwWindow(Activity context) {
|
public MenuPopuwWindow(Activity context) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
popupView = LayoutInflater.from(mContext).inflate(R.layout.popwindow_chat_more, null);
|
popupView = LayoutInflater.from(mContext).inflate(R.layout.popwindow_chat_more_v2, null);
|
||||||
initView();
|
initView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,19 +45,18 @@ public class MenuPopuwWindow implements View.OnClickListener {
|
|||||||
|
|
||||||
if (TextUtils.equals(isAdmin, "1")) {
|
if (TextUtils.equals(isAdmin, "1")) {
|
||||||
tvBlack.setVisibility(View.GONE);
|
tvBlack.setVisibility(View.GONE);
|
||||||
tvBlackMove.setVisibility(View.GONE);
|
|
||||||
ltRemarks.setVisibility(View.VISIBLE);
|
ltRemarks.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
ltRemarks.setVisibility(View.GONE);
|
ltRemarks.setVisibility(View.VISIBLE);
|
||||||
RongIMClient.getInstance().getBlacklistStatus(userId, new RongIMClient.ResultCallback<RongIMClient.BlacklistStatus>() {
|
RongIMClient.getInstance().getBlacklistStatus(userId, new RongIMClient.ResultCallback<RongIMClient.BlacklistStatus>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(RongIMClient.BlacklistStatus blacklistStatus) {
|
public void onSuccess(RongIMClient.BlacklistStatus blacklistStatus) {
|
||||||
if (blacklistStatus == RongIMClient.BlacklistStatus.IN_BLACK_LIST) {
|
if (blacklistStatus == RongIMClient.BlacklistStatus.IN_BLACK_LIST) {
|
||||||
tvBlackMove.setVisibility(View.VISIBLE);
|
tvBlack.setTag("1");
|
||||||
tvBlack.setVisibility(View.GONE);
|
tvBlack.setText(R.string.black_ing);
|
||||||
} else {
|
} else {
|
||||||
tvBlack.setVisibility(View.VISIBLE);
|
tvBlack.setTag(null);
|
||||||
tvBlackMove.setVisibility(View.GONE);
|
tvBlack.setText(R.string.black);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,10 +74,11 @@ public class MenuPopuwWindow implements View.OnClickListener {
|
|||||||
*/
|
*/
|
||||||
private void initView() {
|
private void initView() {
|
||||||
tvBlack = popupView.findViewById(R.id.tv_black);
|
tvBlack = popupView.findViewById(R.id.tv_black);
|
||||||
tvBlackMove = popupView.findViewById(R.id.tv_black_move);
|
ltBlack = popupView.findViewById(R.id.lt_black);
|
||||||
|
ltReport = popupView.findViewById(R.id.lt_report);
|
||||||
ltRemarks = popupView.findViewById(R.id.lt_remarks);
|
ltRemarks = popupView.findViewById(R.id.lt_remarks);
|
||||||
tvBlack.setOnClickListener(this);
|
ltBlack.setOnClickListener(this);
|
||||||
tvBlackMove.setOnClickListener(this);
|
ltReport.setOnClickListener(this);
|
||||||
ltRemarks.setOnClickListener(this);
|
ltRemarks.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +89,7 @@ public class MenuPopuwWindow implements View.OnClickListener {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void show(View view) {
|
public void show(View view) {
|
||||||
popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
|
popupWindow = new PopupWindow(popupView, DpUtil.dp2px(97), ViewGroup.LayoutParams.WRAP_CONTENT, true);
|
||||||
popupWindow.showAsDropDown(view);
|
popupWindow.showAsDropDown(view);
|
||||||
WindowManager.LayoutParams lp = mContext.getWindow().getAttributes();
|
WindowManager.LayoutParams lp = mContext.getWindow().getAttributes();
|
||||||
lp.alpha = 0.8f;
|
lp.alpha = 0.8f;
|
||||||
@ -105,40 +107,14 @@ public class MenuPopuwWindow implements View.OnClickListener {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
//拉黑
|
//拉黑
|
||||||
if (id == R.id.tv_black) {
|
if (id == R.id.lt_black) {
|
||||||
RongIMClient.getInstance().addToBlacklist(userId, new RongIMClient.OperationCallback() {
|
if (tvBlack.getTag() == null) {
|
||||||
@Override
|
black();
|
||||||
public void onSuccess() {
|
} else {
|
||||||
ToastUtil.show(mContext.getResources().getString(R.string.black_succer));
|
unblack();
|
||||||
popupWindow.dismiss();
|
|
||||||
tvBlack.setVisibility(View.VISIBLE);
|
|
||||||
tvBlackMove.setVisibility(View.GONE);
|
|
||||||
netHandler.post(setBlackRunnable);
|
|
||||||
}
|
}
|
||||||
|
} else if (id == R.id.lt_report) {//移出黑名单
|
||||||
@Override
|
RouteUtil.forwardLiveReportActivity(userId);
|
||||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
|
||||||
ToastUtil.show(errorCode.msg);
|
|
||||||
popupWindow.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (id == R.id.tv_black_move) {//移出黑名单
|
|
||||||
RongIMClient.getInstance().removeFromBlacklist(userId, new RongIMClient.OperationCallback() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess() {
|
|
||||||
ToastUtil.show(mContext.getResources().getString(R.string.black_succer_more));
|
|
||||||
popupWindow.dismiss();
|
|
||||||
tvBlackMove.setVisibility(View.VISIBLE);
|
|
||||||
tvBlack.setVisibility(View.GONE);
|
|
||||||
netHandler.post(setBlackRunnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
|
||||||
ToastUtil.show(errorCode.msg);
|
|
||||||
popupWindow.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (id == R.id.lt_remarks) {//添加备注
|
} else if (id == R.id.lt_remarks) {//添加备注
|
||||||
Intent intent = new Intent(mContext, EditNameRemarksActivity.class);
|
Intent intent = new Intent(mContext, EditNameRemarksActivity.class);
|
||||||
intent.putExtra(EditNameRemarksActivity.NAMEREMARK, userId);
|
intent.putExtra(EditNameRemarksActivity.NAMEREMARK, userId);
|
||||||
@ -147,6 +123,40 @@ public class MenuPopuwWindow implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void black() {
|
||||||
|
RongIMClient.getInstance().addToBlacklist(userId, new RongIMClient.OperationCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
ToastUtil.show(mContext.getResources().getString(R.string.black_succer));
|
||||||
|
popupWindow.dismiss();
|
||||||
|
netHandler.post(setBlackRunnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||||
|
ToastUtil.show(errorCode.msg);
|
||||||
|
popupWindow.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unblack() {
|
||||||
|
RongIMClient.getInstance().removeFromBlacklist(userId, new RongIMClient.OperationCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
ToastUtil.show(mContext.getResources().getString(R.string.black_succer_more));
|
||||||
|
popupWindow.dismiss();
|
||||||
|
netHandler.post(setBlackRunnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||||
|
ToastUtil.show(errorCode.msg);
|
||||||
|
popupWindow.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//将对方拉黑或者解除拉黑(自己后台)
|
//将对方拉黑或者解除拉黑(自己后台)
|
||||||
private Runnable setBlackRunnable = new Runnable() {
|
private Runnable setBlackRunnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
103
live/src/main/res/layout/popwindow_chat_more_v2.xml
Normal file
103
live/src/main/res/layout/popwindow_chat_more_v2.xml
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="97dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/background_d5_white"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/lt_remarks"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:gravity="start|center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_marginEnd="7dp"
|
||||||
|
android:src="@mipmap/ic_chat_remarks" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_remarks"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/chat_remarks"
|
||||||
|
android:textColor="@color/black1"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:visibility="visible" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0.5dp"
|
||||||
|
android:layout_marginLeft="6dp"
|
||||||
|
android:layout_marginRight="6dp"
|
||||||
|
android:background="@color/gray_dcdcdc" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/lt_report"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:gravity="start|center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_marginEnd="7dp"
|
||||||
|
android:src="@mipmap/ic_chat_report" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_report"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/chat_report"
|
||||||
|
android:textColor="@color/black1"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0.5dp"
|
||||||
|
android:layout_marginLeft="6dp"
|
||||||
|
android:layout_marginRight="6dp"
|
||||||
|
android:background="@color/gray_dcdcdc" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/lt_black"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:gravity="start|center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_marginEnd="7dp"
|
||||||
|
android:src="@mipmap/ic_chat_black" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_black"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/black"
|
||||||
|
android:textColor="@color/black1"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -61,6 +61,7 @@ import com.yunbao.live.activity.LiveAudienceActivity;
|
|||||||
import com.yunbao.live.views.LiveRoomViewHolder;
|
import com.yunbao.live.views.LiveRoomViewHolder;
|
||||||
import com.yunbao.main.dialog.EncourageDialog;
|
import com.yunbao.main.dialog.EncourageDialog;
|
||||||
import com.yunbao.main.http.MainHttpUtil;
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
|
import com.yunbao.share.bean.ShareBean;
|
||||||
import com.yunbao.share.ui.SharePopDialog;
|
import com.yunbao.share.ui.SharePopDialog;
|
||||||
import com.yunbao.video.activity.VideoPlayActivity;
|
import com.yunbao.video.activity.VideoPlayActivity;
|
||||||
import com.yunbao.video.utils.VideoStorge;
|
import com.yunbao.video.utils.VideoStorge;
|
||||||
@ -592,8 +593,13 @@ public class MyWebViewActivity extends AbsActivity {
|
|||||||
} else if (TextUtils.equals(event.getMethod(), "androidCommunityShare")) {
|
} else if (TextUtils.equals(event.getMethod(), "androidCommunityShare")) {
|
||||||
JSONObject json = JSONObject.parseObject(event.getData());
|
JSONObject json = JSONObject.parseObject(event.getData());
|
||||||
new SharePopDialog(mContext)
|
new SharePopDialog(mContext)
|
||||||
.setShareLink(CommonAppConfig.HOST + json.getString("link"))
|
.setShareType(SharePopDialog.TYPE_DYNAMIC)
|
||||||
|
.setShareData(ShareBean.ShareBuilder
|
||||||
|
.create()
|
||||||
.setAnchorAvatar(json.getString("avatar"))
|
.setAnchorAvatar(json.getString("avatar"))
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
.setShareLink(CommonAppConfig.HOST + json.getString("link"))
|
||||||
.showDialog();
|
.showDialog();
|
||||||
} else if (TextUtils.equals(event.getMethod(), "androidCancelAnchorAttention")) {
|
} else if (TextUtils.equals(event.getMethod(), "androidCancelAnchorAttention")) {
|
||||||
if (!StringUtil.isEmpty(LiveAudienceActivity.is_fans)) {
|
if (!StringUtil.isEmpty(LiveAudienceActivity.is_fans)) {
|
||||||
|
@ -1,21 +1,16 @@
|
|||||||
package com.yunbao.main.activity;
|
package com.yunbao.main.activity;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -27,12 +22,13 @@ import androidx.fragment.app.FragmentManager;
|
|||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.blankj.utilcode.util.GsonUtils;
|
import com.blankj.utilcode.util.GsonUtils;
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
import com.yunbao.common.activity.SelectImageActivity;
|
import com.yunbao.common.activity.SelectImageActivity;
|
||||||
import com.yunbao.common.bean.IMLoginModel;
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
import com.yunbao.common.bean.ImageEntity;
|
import com.yunbao.common.bean.ImageEntity;
|
||||||
import com.yunbao.common.bean.MessageChatUserBean;
|
|
||||||
import com.yunbao.common.bean.MessageUserInfoBean;
|
import com.yunbao.common.bean.MessageUserInfoBean;
|
||||||
import com.yunbao.common.bean.NoviceInstructorModel;
|
import com.yunbao.common.bean.NoviceInstructorModel;
|
||||||
import com.yunbao.common.bean.SetAttentsModel;
|
import com.yunbao.common.bean.SetAttentsModel;
|
||||||
@ -40,11 +36,9 @@ import com.yunbao.common.event.PDChatInputModeEvent;
|
|||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.interfaces.OnSendMessageListener;
|
|
||||||
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.message.content.MessageChatTipsContent;
|
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.StringUtil;
|
import com.yunbao.common.utils.StringUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
@ -59,13 +53,14 @@ import com.yunbao.live.views.PDLiveConversationFragment;
|
|||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.adapter.MessageChatTopImageListAdapter;
|
import com.yunbao.main.adapter.MessageChatTopImageListAdapter;
|
||||||
import com.yunbao.main.adapter.MessageChatTopTopListAdapter;
|
import com.yunbao.main.adapter.MessageChatTopTopListAdapter;
|
||||||
import com.yunbao.main.fragment.MyAddressBookFragment;
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.rong.imkit.IMCenter;
|
import io.rong.imkit.IMCenter;
|
||||||
@ -113,6 +108,12 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
MessageIMManager.get(this).addConversationClickListener();
|
MessageIMManager.get(this).addConversationClickListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
setUserCard();
|
||||||
|
}
|
||||||
|
|
||||||
private void hideUserCard() {
|
private void hideUserCard() {
|
||||||
if (card.getTag() != null) return;
|
if (card.getTag() != null) return;
|
||||||
card.setTag("fold");
|
card.setTag("fold");
|
||||||
@ -185,7 +186,6 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
|
|
||||||
//绑定聊天用户id
|
//绑定聊天用户id
|
||||||
inputPanel.setTargetId(targetId);
|
inputPanel.setTargetId(targetId);
|
||||||
ToastUtil.show("id:" + targetId);
|
|
||||||
//获取用户信息
|
//获取用户信息
|
||||||
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
|
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
|
||||||
setUserCard();
|
setUserCard();
|
||||||
@ -262,29 +262,37 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(MessageUserInfoBean data) {
|
public void onSuccess(MessageUserInfoBean data) {
|
||||||
userInfoBean = data;
|
userInfoBean = data;
|
||||||
titleView.setText(data.getUser().getUserNicename() + "_");
|
titleView.setText(data.getUser().getUserNicename());
|
||||||
ImgLoader.display(mContext, data.getUser().getAvatar(), ViewUtils.findViewById(card, R.id.rc_conversation_portrait, ImageView.class));
|
ImgLoader.display(mContext, data.getUser().getAvatar(), ViewUtils.findViewById(card, R.id.rc_conversation_portrait, ImageView.class));
|
||||||
ViewUtils.findViewById(card, R.id.userName, TextView.class).setText(data.getUser().getUserNicename());
|
ViewUtils.findViewById(card, R.id.userName, TextView.class).setText(data.getUser().getUserNicename());
|
||||||
ViewUtils.findViewById(card, R.id.sign, TextView.class).setText(data.getUser().getSignature());
|
ViewUtils.findViewById(card, R.id.sign, TextView.class).setText(data.getUser().getSignature());
|
||||||
|
if (data.getInfo().getRongOnline() == 1) {
|
||||||
|
ViewUtils.findViewById(card, R.id.user_status, TextView.class).setText(R.string.activity_msg_chat_top_status_online);
|
||||||
|
ViewUtils.findViewById(card, R.id.userStatusIcon, ImageView.class).setImageResource(R.mipmap.icon_green);
|
||||||
|
} else {
|
||||||
|
ViewUtils.findViewById(card, R.id.user_status, TextView.class).setText(R.string.activity_msg_chat_top_status_offline);
|
||||||
|
ViewUtils.findViewById(card, R.id.userStatusIcon, ImageView.class).setImageResource(R.mipmap.icon_green);
|
||||||
|
}
|
||||||
showBanner();
|
showBanner();
|
||||||
showTag();
|
showTag();
|
||||||
if(data.getUser().getAttention()==0){
|
if (data.getUser().getAttention() == 0) {
|
||||||
ViewUtils.findViewById(card,R.id.follow, Button.class).setOnClickListener(new View.OnClickListener() {
|
ViewUtils.findViewById(card, R.id.follow, Button.class).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
follow((Button) view,userInfoBean.getUser().getId()+"");
|
follow((Button) view, userInfoBean.getUser().getId() + "");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
}else{
|
ViewUtils.findViewById(card, R.id.follow, Button.class).setVisibility(View.INVISIBLE);
|
||||||
ViewUtils.findViewById(card,R.id.follow, Button.class).setVisibility(View.INVISIBLE);
|
|
||||||
}
|
}
|
||||||
|
getRemarkName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showBanner() {
|
private void showBanner() {
|
||||||
LiveNetManager.get(mContext)
|
LiveNetManager.get(mContext)
|
||||||
.getUserHomeBanner(targetId, new HttpCallback<List<String>>() {
|
.getUserHomeBanner(targetId, new HttpCallback<List<String>>() {
|
||||||
@ -305,30 +313,31 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void showTag(){
|
|
||||||
List<String> tags=new ArrayList<>();
|
private void showTag() {
|
||||||
|
List<String> tags = new ArrayList<>();
|
||||||
tags.add(userInfoBean.getInfo().getAge());
|
tags.add(userInfoBean.getInfo().getAge());
|
||||||
if(!StringUtil.isEmpty(userInfoBean.getInfo().getCareer())){
|
if (!StringUtil.isEmpty(userInfoBean.getInfo().getCareer())) {
|
||||||
tags.add(userInfoBean.getInfo().getCareer());
|
tags.add(userInfoBean.getInfo().getCareer());
|
||||||
}
|
}
|
||||||
if(!StringUtil.isEmpty(userInfoBean.getInfo().getHeight())&&!userInfoBean.getInfo().getHeight().equals("0")) {
|
if (!StringUtil.isEmpty(userInfoBean.getInfo().getHeight()) && !userInfoBean.getInfo().getHeight().equals("0")) {
|
||||||
tags.add(userInfoBean.getInfo().getHeight());
|
tags.add(userInfoBean.getInfo().getHeight());
|
||||||
}
|
}
|
||||||
List<String> t;
|
List<String> t;
|
||||||
if(WordUtil.isNewZh()) {
|
if (WordUtil.isNewZh()) {
|
||||||
t=userInfoBean.getInfo().getCn_label();
|
t = userInfoBean.getInfo().getCn_label();
|
||||||
}else{
|
} else {
|
||||||
t=userInfoBean.getInfo().getEn_label();
|
t = userInfoBean.getInfo().getEn_label();
|
||||||
}
|
}
|
||||||
if(t!=null){
|
if (t != null) {
|
||||||
for (String tag : t) {
|
for (String tag : t) {
|
||||||
if(!StringUtil.isEmpty(tag)){
|
if (!StringUtil.isEmpty(tag)) {
|
||||||
tags.add(tag);
|
tags.add(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageChatTopTopListAdapter adapter=new MessageChatTopTopListAdapter();
|
MessageChatTopTopListAdapter adapter = new MessageChatTopTopListAdapter();
|
||||||
RecyclerView avatarList = ViewUtils.findViewById(card, R.id.tag_list, RecyclerView.class);
|
RecyclerView avatarList = ViewUtils.findViewById(card, R.id.tag_list, RecyclerView.class);
|
||||||
avatarList.setAdapter(adapter);
|
avatarList.setAdapter(adapter);
|
||||||
adapter.setUrls(tags);
|
adapter.setUrls(tags);
|
||||||
@ -337,6 +346,23 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getRemarkName() {
|
||||||
|
MainHttpUtil.getInstructorRemark(new com.yunbao.common.http.HttpCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
JSONArray array = JSONArray.parseArray(Arrays.toString(info));
|
||||||
|
for (int i = 0; i < array.size(); i++) {
|
||||||
|
JSONObject json = array.getJSONObject(0);
|
||||||
|
if (json.containsKey(targetId)) {
|
||||||
|
titleView.setText(json.getString(targetId));
|
||||||
|
ViewUtils.findViewById(card, R.id.userName, TextView.class).setText(json.getString(targetId));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
@ -418,6 +444,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void follow(Button btn, String id) {
|
private void follow(Button btn, String id) {
|
||||||
LiveNetManager.get(btn.getContext())
|
LiveNetManager.get(btn.getContext())
|
||||||
.setAttents(id, new HttpCallback<SetAttentsModel>() {
|
.setAttents(id, new HttpCallback<SetAttentsModel>() {
|
||||||
@ -432,6 +459,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@ -448,7 +476,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onMessageIMEvent(String event) {
|
public void onMessageIMEvent(String event) {
|
||||||
if (!TextUtils.isEmpty(event)) {
|
if (!TextUtils.isEmpty(event)) {
|
||||||
titleView.setText(event);
|
//titleView.setText(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ import com.yunbao.main.activity.MainActivity;
|
|||||||
import com.yunbao.main.activity.MyWalletActivity;
|
import com.yunbao.main.activity.MyWalletActivity;
|
||||||
import com.yunbao.main.dialog.EncourageDialog;
|
import com.yunbao.main.dialog.EncourageDialog;
|
||||||
import com.yunbao.main.utils.BottomBarUtil;
|
import com.yunbao.main.utils.BottomBarUtil;
|
||||||
|
import com.yunbao.share.bean.ShareBean;
|
||||||
import com.yunbao.share.ui.SharePopDialog;
|
import com.yunbao.share.ui.SharePopDialog;
|
||||||
import com.yunbao.video.activity.VideoPlayActivity;
|
import com.yunbao.video.activity.VideoPlayActivity;
|
||||||
import com.yunbao.video.utils.VideoStorge;
|
import com.yunbao.video.utils.VideoStorge;
|
||||||
@ -376,8 +377,10 @@ public class MainHomeCommunityFragment extends BaseFragment {
|
|||||||
} else if (TextUtils.equals(event.getMethod(), "androidCommunityShare")) {
|
} else if (TextUtils.equals(event.getMethod(), "androidCommunityShare")) {
|
||||||
JSONObject json = JSONObject.parseObject(event.getData());
|
JSONObject json = JSONObject.parseObject(event.getData());
|
||||||
new SharePopDialog(mContext)
|
new SharePopDialog(mContext)
|
||||||
.setShareLink(CommonAppConfig.HOST + json.getString("link"))
|
.setShareData(ShareBean.ShareBuilder.create()
|
||||||
.setAnchorAvatar(json.getString("avatar"))
|
.setAnchorAvatar(json.getString("avatar"))
|
||||||
|
.build())
|
||||||
|
.setShareLink(CommonAppConfig.HOST + json.getString("link"))
|
||||||
.showDialog();
|
.showDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.yunbao.main.fragment;
|
package com.yunbao.main.fragment;
|
||||||
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -10,7 +8,6 @@ import android.view.ViewGroup;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.yunbao.common.custom.ItemDecoration;
|
|
||||||
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.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
@ -24,9 +21,6 @@ import io.rong.imkit.conversationlist.ConversationListAdapter;
|
|||||||
import io.rong.imkit.conversationlist.ConversationListFragment;
|
import io.rong.imkit.conversationlist.ConversationListFragment;
|
||||||
import io.rong.imkit.conversationlist.model.BaseUiConversation;
|
import io.rong.imkit.conversationlist.model.BaseUiConversation;
|
||||||
import io.rong.imkit.conversationlist.model.SingleConversation;
|
import io.rong.imkit.conversationlist.model.SingleConversation;
|
||||||
import io.rong.imlib.IRongCoreCallback;
|
|
||||||
import io.rong.imlib.IRongCoreEnum;
|
|
||||||
import io.rong.imlib.RongCoreClient;
|
|
||||||
import io.rong.imlib.RongIMClient;
|
import io.rong.imlib.RongIMClient;
|
||||||
import io.rong.imlib.model.Conversation;
|
import io.rong.imlib.model.Conversation;
|
||||||
import io.rong.imlib.model.SearchConversationResult;
|
import io.rong.imlib.model.SearchConversationResult;
|
||||||
@ -63,7 +57,7 @@ public class MainMessageChatFragment extends ConversationListFragment {
|
|||||||
System.err.println(" ----------------------->" + mAdapter.getData().size());
|
System.err.println(" ----------------------->" + mAdapter.getData().size());
|
||||||
for (BaseUiConversation cn : ((MainConversationListAdapter) mAdapter).getSrcList()) {
|
for (BaseUiConversation cn : ((MainConversationListAdapter) mAdapter).getSrcList()) {
|
||||||
System.err.println(" ----------------------->" + cn.mCore.getConversationTitle() + "|" + cn.mCore.getSenderUserName());
|
System.err.println(" ----------------------->" + cn.mCore.getConversationTitle() + "|" + cn.mCore.getSenderUserName());
|
||||||
if(StringUtil.isEmpty(cn.mCore.getConversationTitle()))continue;
|
if (StringUtil.isEmpty(cn.mCore.getConversationTitle())) continue;
|
||||||
if (cn.mCore.getConversationTitle().contains(search)) {
|
if (cn.mCore.getConversationTitle().contains(search)) {
|
||||||
conversation = new SingleConversation(getContext(), new Conversation());
|
conversation = new SingleConversation(getContext(), new Conversation());
|
||||||
conversation.mCore.setObjectName("SEARCH_USER" + search);
|
conversation.mCore.setObjectName("SEARCH_USER" + search);
|
||||||
@ -74,7 +68,6 @@ public class MainMessageChatFragment extends ConversationListFragment {
|
|||||||
conversation.mCore.setSenderUserId(cn.mCore.getSenderUserId());
|
conversation.mCore.setSenderUserId(cn.mCore.getSenderUserId());
|
||||||
data.add(conversation);
|
data.add(conversation);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (data.size() == 1) {
|
if (data.size() == 1) {
|
||||||
data.get(0).mCore.setMentionedCount(3);
|
data.get(0).mCore.setMentionedCount(3);
|
||||||
|
@ -57,6 +57,7 @@ import io.rong.imlib.RongIMClient;
|
|||||||
import io.rong.imlib.model.Conversation;
|
import io.rong.imlib.model.Conversation;
|
||||||
import io.rong.imlib.model.UserInfo;
|
import io.rong.imlib.model.UserInfo;
|
||||||
import io.rong.sight.SightExtensionModule;
|
import io.rong.sight.SightExtensionModule;
|
||||||
|
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.views.MessageChatExtensionConfig;
|
import com.yunbao.main.views.MessageChatExtensionConfig;
|
||||||
|
|
||||||
@ -68,6 +69,7 @@ public class ConversationIMListManager {
|
|||||||
private Context mContext;
|
private Context mContext;
|
||||||
//指导员ID
|
//指导员ID
|
||||||
private String targetId;
|
private String targetId;
|
||||||
|
private String topContent;
|
||||||
private Handler conversationIMListHandler = new Handler();
|
private Handler conversationIMListHandler = new Handler();
|
||||||
|
|
||||||
private ConversationIMListManager(Context context) {
|
private ConversationIMListManager(Context context) {
|
||||||
@ -246,11 +248,30 @@ public class ConversationIMListManager {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private void setConversationToTop(String targetId) {
|
||||||
|
setConversationToTop(null, targetId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息置顶
|
* 消息置顶
|
||||||
*/
|
*/
|
||||||
private void setConversationToTop(String targetId) {
|
private void setConversationToTop(BaseUiConversation conversation, String targetId) {
|
||||||
IMCenter.getInstance().setConversationToTop(Conversation.ConversationType.PRIVATE, targetId, true, false, null
|
boolean top = true;
|
||||||
|
Conversation.ConversationType type = Conversation.ConversationType.PRIVATE;
|
||||||
|
if (conversation != null) {
|
||||||
|
top = !conversation.mCore.isTop();
|
||||||
|
targetId = conversation.mCore.getTargetId();
|
||||||
|
type = conversation.mCore.getConversationType();
|
||||||
|
}
|
||||||
|
IMCenter.getInstance().setConversationToTop(type, targetId, top, false, new RongIMClient.ResultCallback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean aBoolean) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(RongIMClient.ErrorCode e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +304,12 @@ public class ConversationIMListManager {
|
|||||||
//非指导员都可以点击
|
//非指导员都可以点击
|
||||||
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(baseUiConversation.mCore.getTargetId());
|
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(baseUiConversation.mCore.getTargetId());
|
||||||
String[] list;
|
String[] list;
|
||||||
list = new String[]{WordUtil.getNewString(R.string.top),WordUtil.getNewString(R.string.delete)};
|
if (baseUiConversation.mCore.isTop()) {
|
||||||
|
topContent = WordUtil.getNewString(R.string.untop);
|
||||||
|
} else {
|
||||||
|
topContent = WordUtil.getNewString(R.string.top);
|
||||||
|
}
|
||||||
|
list = new String[]{topContent, WordUtil.getNewString(R.string.delete)};
|
||||||
if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
|
if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
|
||||||
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
|
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
|
||||||
if (!TextUtils.equals(model.getIsAdmin(), "1")) {
|
if (!TextUtils.equals(model.getIsAdmin(), "1")) {
|
||||||
@ -300,10 +326,10 @@ public class ConversationIMListManager {
|
|||||||
.setOnItemClickListener(new OnItemClickListener<String>() {
|
.setOnItemClickListener(new OnItemClickListener<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(String bean, int position) {
|
public void onItemClick(String bean, int position) {
|
||||||
if (bean.equals(WordUtil.getNewString(R.string.top))) {
|
if (bean.equals(topContent)) {
|
||||||
// copyText(baseUiConversation,context);
|
// copyText(baseUiConversation,context);
|
||||||
setConversationToTop(targetId);
|
setConversationToTop(baseUiConversation, targetId);
|
||||||
} else if(bean.equals(WordUtil.getNewString(R.string.delete))){
|
} else if (bean.equals(WordUtil.getNewString(R.string.delete))) {
|
||||||
delete(baseUiConversation.mCore.getTargetId());
|
delete(baseUiConversation.mCore.getTargetId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -402,7 +428,8 @@ public class ConversationIMListManager {
|
|||||||
public String getTargetId() {
|
public String getTargetId() {
|
||||||
return targetId;
|
return targetId;
|
||||||
}
|
}
|
||||||
private void copyText(UiMessage uiMessage,Context context) {
|
|
||||||
|
private void copyText(UiMessage uiMessage, Context context) {
|
||||||
ClipboardManager cm = (ClipboardManager) context.getSystemService(CLIPBOARD_SERVICE);
|
ClipboardManager cm = (ClipboardManager) context.getSystemService(CLIPBOARD_SERVICE);
|
||||||
ClipData clipData = ClipData.newPlainText("text", uiMessage.getContentSpannable());
|
ClipData clipData = ClipData.newPlainText("text", uiMessage.getContentSpannable());
|
||||||
cm.setPrimaryClip(clipData);
|
cm.setPrimaryClip(clipData);
|
||||||
|
@ -3,16 +3,15 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:id="@+id/relativeLayout"
|
android:id="@+id/relativeLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:paddingTop="24dp"
|
|
||||||
android:layout_height="52dp"
|
android:layout_height="52dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:paddingTop="24dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
@ -49,10 +48,10 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_more"
|
android:id="@+id/img_more"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:scaleType="center"
|
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:padding="9dp"
|
android:padding="9dp"
|
||||||
|
android:scaleType="center"
|
||||||
android:src="@mipmap/btn_more_black"
|
android:src="@mipmap/btn_more_black"
|
||||||
android:visibility="visible" />
|
android:visibility="visible" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@ -109,17 +108,31 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/userName"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/userName"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/userName">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/user_status"
|
android:id="@+id/user_status"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:text="在线"
|
android:text="在线"
|
||||||
android:textColor="#AAAAAA"
|
android:textColor="#AAAAAA"
|
||||||
android:textSize="8sp"
|
android:textSize="8sp" />
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/userName"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/userName"
|
<ImageView
|
||||||
app:layout_constraintTop_toTopOf="@+id/userName" />
|
android:id="@+id/userStatusIcon"
|
||||||
|
android:layout_width="5dp"
|
||||||
|
android:layout_height="5dp"
|
||||||
|
android:layout_gravity="top"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:src="@mipmap/icon_green" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/info"
|
android:id="@+id/info"
|
||||||
@ -184,13 +197,13 @@
|
|||||||
android:layout_marginStart="50dp"
|
android:layout_marginStart="50dp"
|
||||||
android:layout_marginEnd="50dp"
|
android:layout_marginEnd="50dp"
|
||||||
android:layout_marginBottom="60dp"
|
android:layout_marginBottom="60dp"
|
||||||
tools:listitem="@layout/view_msg_chat_top_image"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
|
||||||
tools:itemCount="9"
|
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/imageView"
|
app:layout_constraintEnd_toEndOf="@+id/imageView"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
tools:itemCount="9"
|
||||||
|
tools:listitem="@layout/view_msg_chat_top_image" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/tag_list"
|
android:id="@+id/tag_list"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
<string name="battlepass_reward_item_lock">暫未達到等級</string>
|
<string name="battlepass_reward_item_lock">暫未達到等級</string>
|
||||||
<string name="battlepass_reward_item_get">領取成功</string>
|
<string name="battlepass_reward_item_get">領取成功</string>
|
||||||
<string name="top">置頂</string>
|
<string name="top">置頂</string>
|
||||||
|
<string name="untop">取消置頂</string>
|
||||||
<string name="delete">刪除</string>
|
<string name="delete">刪除</string>
|
||||||
<string name="activity_msg_title">消息</string>
|
<string name="activity_msg_title">消息</string>
|
||||||
<string name="activity_msg_news_notice">官方通知</string>
|
<string name="activity_msg_news_notice">官方通知</string>
|
||||||
@ -70,4 +71,6 @@
|
|||||||
<string name="year">年</string>
|
<string name="year">年</string>
|
||||||
<string name="month">月</string>
|
<string name="month">月</string>
|
||||||
<string name="day">日</string>
|
<string name="day">日</string>
|
||||||
|
<string name="activity_msg_chat_top_status_online">在线</string>
|
||||||
|
<string name="activity_msg_chat_top_status_offline">离线</string>
|
||||||
</resources>
|
</resources>
|
@ -19,6 +19,7 @@
|
|||||||
<string name="battlepass_reward_item_lock">Not yet reached level</string>
|
<string name="battlepass_reward_item_lock">Not yet reached level</string>
|
||||||
<string name="battlepass_reward_item_get">Successfully claimed</string>
|
<string name="battlepass_reward_item_get">Successfully claimed</string>
|
||||||
<string name="top">置頂</string>
|
<string name="top">置頂</string>
|
||||||
|
<string name="untop">取消置頂</string>
|
||||||
<string name="delete">刪除</string>
|
<string name="delete">刪除</string>
|
||||||
<string name="activity_msg_title">Information</string>
|
<string name="activity_msg_title">Information</string>
|
||||||
<string name="activity_msg_news_notice">Activities</string>
|
<string name="activity_msg_news_notice">Activities</string>
|
||||||
@ -67,7 +68,9 @@
|
|||||||
<string name="activity_reg_user_info_birthday_text">Select your Birthday</string>
|
<string name="activity_reg_user_info_birthday_text">Select your Birthday</string>
|
||||||
<string name="dialog_user_info_album">Album</string>
|
<string name="dialog_user_info_album">Album</string>
|
||||||
<string name="dialog_user_info_camera">Camera</string>
|
<string name="dialog_user_info_camera">Camera</string>
|
||||||
<string name="year">年</string>
|
<string name="year">Year</string>
|
||||||
<string name="month">月</string>
|
<string name="month">Month</string>
|
||||||
<string name="day">日</string>
|
<string name="day">Day</string>
|
||||||
|
<string name="activity_msg_chat_top_status_online">Online</string>
|
||||||
|
<string name="activity_msg_chat_top_status_offline">Offline</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user