add 分享
add 聊天页面右上角菜单
This commit is contained in:
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user