diff --git a/Share/src/main/java/com/yunbao/share/AbsShareInterface.java b/Share/src/main/java/com/yunbao/share/AbsShareInterface.java index fed5dde..dbae513 100644 --- a/Share/src/main/java/com/yunbao/share/AbsShareInterface.java +++ b/Share/src/main/java/com/yunbao/share/AbsShareInterface.java @@ -7,7 +7,7 @@ import android.net.Uri; import androidx.core.content.FileProvider; 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 java.io.File; @@ -23,7 +23,7 @@ public abstract class AbsShareInterface { 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){ return FileProvider.getUriForFile(mContext, diff --git a/Share/src/main/java/com/yunbao/share/adapters/ShareAppAdapter.java b/Share/src/main/java/com/yunbao/share/adapters/ShareAppAdapter.java index 977367b..2ec55c8 100644 --- a/Share/src/main/java/com/yunbao/share/adapters/ShareAppAdapter.java +++ b/Share/src/main/java/com/yunbao/share/adapters/ShareAppAdapter.java @@ -1,7 +1,6 @@ package com.yunbao.share.adapters; import android.content.Context; -import android.os.Environment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -15,7 +14,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.pdlive.shayu.R; 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.Instagram; 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.WhatsApp; -import java.io.File; import java.util.ArrayList; import java.util.List; public class ShareAppAdapter extends RecyclerView.Adapter { private Context mContext; - private List list; + private List list; ShareCallback shareCallback; public ShareAppAdapter(Context mContext) { @@ -38,7 +36,7 @@ public class ShareAppAdapter extends RecyclerView.Adapter list) { + public void setList(List list) { this.list = list; notifyDataSetChanged(); } @@ -51,27 +49,28 @@ public class ShareAppAdapter extends RecyclerView.Adapter"+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); break; - case ShareBuilder.APP_LINE: + case ShareBean.APP_LINE: holder.setData(builder, R.mipmap.icon_share_line, R.string.dialog_share_app_line); break; - case ShareBuilder.APP_TWITTER: + case ShareBean.APP_TWITTER: holder.setData(builder, R.mipmap.icon_share_twitter, R.string.dialog_share_app_twitter); break; - case ShareBuilder.APP_WHATSAPP: + case ShareBean.APP_WHATSAPP: holder.setData(builder, R.mipmap.icon_share_whatsapp, R.string.dialog_share_app_whatsapp); break; - case ShareBuilder.APP_MESSENGER: + case ShareBean.APP_MESSENGER: holder.setData(builder, R.mipmap.icon_share_messenger, R.string.dialog_share_app_messenger); break; - case ShareBuilder.APP_INSTAGRAM: + case ShareBean.APP_INSTAGRAM: holder.setData(builder, R.mipmap.icon_share_instagram, R.string.dialog_share_app_instagram); break; - case ShareBuilder.APP_INTERNAL: + case ShareBean.APP_INTERNAL: holder.setData(builder, R.mipmap.ic_share_friend, R.string.dialog_share_app_internal); break; } @@ -99,30 +98,30 @@ public class ShareAppAdapter extends RecyclerView.Adapter { switch (bean.getType()) { - case ShareBuilder.APP_FACEBOOK: + case ShareBean.APP_FACEBOOK: new FacebookShare(itemView.getContext()).share(bean, new ShareCallback()); break; - case ShareBuilder.APP_LINE: + case ShareBean.APP_LINE: new Line(itemView.getContext()).share(bean, new ShareCallback()); break; - case ShareBuilder.APP_TWITTER: + case ShareBean.APP_TWITTER: new TwitterShare(itemView.getContext()).share(bean, new ShareCallback()); break; - case ShareBuilder.APP_WHATSAPP: + case ShareBean.APP_WHATSAPP: new WhatsApp(itemView.getContext()).share(bean, new ShareCallback()); break; - case ShareBuilder.APP_MESSENGER: + case ShareBean.APP_MESSENGER: new MessengerShare(itemView.getContext()).share(bean, new ShareCallback()); break; - case ShareBuilder.APP_INSTAGRAM: + case ShareBean.APP_INSTAGRAM: new Instagram(itemView.getContext()).share(bean, new ShareCallback()); break; - case ShareBuilder.APP_INTERNAL: + case ShareBean.APP_INTERNAL: new Internal(itemView.getContext()).share(bean, shareCallback); break; } diff --git a/Share/src/main/java/com/yunbao/share/bean/ShareBean.java b/Share/src/main/java/com/yunbao/share/bean/ShareBean.java new file mode 100644 index 0000000..d6a65da --- /dev/null +++ b/Share/src/main/java/com/yunbao/share/bean/ShareBean.java @@ -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(); + } + } +} diff --git a/Share/src/main/java/com/yunbao/share/bean/ShareBuilder.java b/Share/src/main/java/com/yunbao/share/bean/ShareBuilder.java deleted file mode 100644 index 903386a..0000000 --- a/Share/src/main/java/com/yunbao/share/bean/ShareBuilder.java +++ /dev/null @@ -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 + - '}'; - } -} diff --git a/Share/src/main/java/com/yunbao/share/platform/FacebookShare.java b/Share/src/main/java/com/yunbao/share/platform/FacebookShare.java index c34739e..d899895 100644 --- a/Share/src/main/java/com/yunbao/share/platform/FacebookShare.java +++ b/Share/src/main/java/com/yunbao/share/platform/FacebookShare.java @@ -12,10 +12,9 @@ import com.facebook.FacebookException; import com.facebook.share.Sharer; import com.facebook.share.model.ShareLinkContent; import com.facebook.share.widget.ShareDialog; -import com.yunbao.common.utils.ToastUtil; import com.yunbao.share.AbsShareInterface; import com.yunbao.share.ICallback; -import com.yunbao.share.bean.ShareBuilder; +import com.yunbao.share.bean.ShareBean; public class FacebookShare extends AbsShareInterface { public static CallbackManager callbackManager; @@ -24,7 +23,7 @@ public class FacebookShare extends AbsShareInterface { } @Override - public void share(ShareBuilder builder, ICallback callback) { + public void share(ShareBean builder, ICallback callback) { callbackManager= CallbackManager.Factory.create(); ShareLinkContent content = new ShareLinkContent.Builder() .setContentUrl(Uri.parse(builder.getLink())) diff --git a/Share/src/main/java/com/yunbao/share/platform/Instagram.java b/Share/src/main/java/com/yunbao/share/platform/Instagram.java index da876e6..d77fe56 100644 --- a/Share/src/main/java/com/yunbao/share/platform/Instagram.java +++ b/Share/src/main/java/com/yunbao/share/platform/Instagram.java @@ -6,7 +6,7 @@ import android.net.Uri; import com.yunbao.share.AbsShareInterface; import com.yunbao.share.ICallback; -import com.yunbao.share.bean.ShareBuilder; +import com.yunbao.share.bean.ShareBean; public class Instagram extends AbsShareInterface { public Instagram(Context context) { @@ -14,7 +14,7 @@ public class Instagram extends AbsShareInterface { } @Override - public void share(ShareBuilder builder, ICallback callback) { + public void share(ShareBean builder, ICallback callback) { String type = "image/*"; Intent share = new Intent(Intent.ACTION_SEND); Uri uri = fileToUri(builder.getFile()); diff --git a/Share/src/main/java/com/yunbao/share/platform/Internal.java b/Share/src/main/java/com/yunbao/share/platform/Internal.java index 67b76cd..fec9578 100644 --- a/Share/src/main/java/com/yunbao/share/platform/Internal.java +++ b/Share/src/main/java/com/yunbao/share/platform/Internal.java @@ -3,20 +3,23 @@ package com.yunbao.share.platform; import android.content.Context; 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.ICallback; -import com.yunbao.share.bean.ShareBuilder; +import com.yunbao.share.bean.ShareBean; import com.yunbao.share.ui.AppInternalShareDialog; import com.yunbao.share.ui.ShareSuccessNotifyDialog; +import io.rong.imlib.model.Conversation; + public class Internal extends AbsShareInterface { public Internal(Context context) { super(context); } @Override - public void share(ShareBuilder builder, ICallback callback) { + public void share(ShareBean builder, ICallback callback) { new AppInternalShareDialog(mContext) .setOnItemClickListener(new OnItemClickListener() { @Override @@ -26,10 +29,35 @@ public class Internal extends AbsShareInterface { return; } builder.setUid(toUid); + sendMessage(builder); new ShareSuccessNotifyDialog(mContext, builder) .showDialog(); callback.onSuccess(); } }).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() { + @Override + public void onSuccess(String token, Object bean) { + super.onSuccess(token, bean); + } + + @Override + public void onError(int status, String msg) { + super.onError(status, msg); + } + } + ); + } } diff --git a/Share/src/main/java/com/yunbao/share/platform/Line.java b/Share/src/main/java/com/yunbao/share/platform/Line.java index bbad5c9..5b88e69 100644 --- a/Share/src/main/java/com/yunbao/share/platform/Line.java +++ b/Share/src/main/java/com/yunbao/share/platform/Line.java @@ -6,7 +6,7 @@ import android.net.Uri; import com.yunbao.share.AbsShareInterface; import com.yunbao.share.ICallback; -import com.yunbao.share.bean.ShareBuilder; +import com.yunbao.share.bean.ShareBean; import java.net.URLEncoder; @@ -17,7 +17,7 @@ public class Line extends AbsShareInterface { } @Override - public void share(ShareBuilder builder, ICallback callback) { + public void share(ShareBean builder, ICallback callback) { try { Intent share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=" + URLEncoder.encode(builder.getText(), "UTF-8"))); mContext.startActivity(share); diff --git a/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java b/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java index e9b3126..3c3db19 100644 --- a/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java +++ b/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java @@ -13,10 +13,9 @@ import com.facebook.FacebookSdk; import com.facebook.share.Sharer; import com.facebook.share.model.ShareLinkContent; import com.facebook.share.widget.MessageDialog; -import com.yunbao.common.utils.ToastUtil; import com.yunbao.share.AbsShareInterface; import com.yunbao.share.ICallback; -import com.yunbao.share.bean.ShareBuilder; +import com.yunbao.share.bean.ShareBean; public class MessengerShare extends AbsShareInterface { public static CallbackManager callbackManager; @@ -27,7 +26,7 @@ public class MessengerShare extends AbsShareInterface { } @Override - public void share(ShareBuilder builder, ICallback callback) { + public void share(ShareBean builder, ICallback callback) { callbackManager = CallbackManager.Factory.create(); ShareLinkContent content = new ShareLinkContent.Builder() .setContentUrl(Uri.parse(builder.getLink())) diff --git a/Share/src/main/java/com/yunbao/share/platform/TwitterShare.java b/Share/src/main/java/com/yunbao/share/platform/TwitterShare.java index 399cc75..05adb5a 100644 --- a/Share/src/main/java/com/yunbao/share/platform/TwitterShare.java +++ b/Share/src/main/java/com/yunbao/share/platform/TwitterShare.java @@ -7,7 +7,7 @@ import android.net.Uri; import com.twitter.sdk.android.core.Twitter; import com.yunbao.share.AbsShareInterface; import com.yunbao.share.ICallback; -import com.yunbao.share.bean.ShareBuilder; +import com.yunbao.share.bean.ShareBean; import java.net.URLEncoder; @@ -19,7 +19,7 @@ public class TwitterShare extends AbsShareInterface { } @Override - public void share(ShareBuilder date, ICallback callback) { + public void share(ShareBean date, ICallback callback) { /* new TwitterAuthClient().authorize((Activity) mContext, new Callback() { diff --git a/Share/src/main/java/com/yunbao/share/platform/WhatsApp.java b/Share/src/main/java/com/yunbao/share/platform/WhatsApp.java index 51485e6..6d982ff 100644 --- a/Share/src/main/java/com/yunbao/share/platform/WhatsApp.java +++ b/Share/src/main/java/com/yunbao/share/platform/WhatsApp.java @@ -5,7 +5,7 @@ import android.content.Intent; import com.yunbao.share.AbsShareInterface; import com.yunbao.share.ICallback; -import com.yunbao.share.bean.ShareBuilder; +import com.yunbao.share.bean.ShareBean; public class WhatsApp extends AbsShareInterface { public WhatsApp(Context context) { @@ -13,7 +13,7 @@ public class WhatsApp extends AbsShareInterface { } @Override - public void share(ShareBuilder builder, ICallback callback) { + public void share(ShareBean builder, ICallback callback) { try { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); diff --git a/Share/src/main/java/com/yunbao/share/ui/AppInternalShareDialog.java b/Share/src/main/java/com/yunbao/share/ui/AppInternalShareDialog.java index 3bf8e35..6ee31a9 100644 --- a/Share/src/main/java/com/yunbao/share/ui/AppInternalShareDialog.java +++ b/Share/src/main/java/com/yunbao/share/ui/AppInternalShareDialog.java @@ -2,27 +2,21 @@ package com.yunbao.share.ui; import android.content.Context; import android.widget.EditText; -import android.widget.ImageView; -import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.lxj.xpopup.XPopup; import com.pdlive.shayu.R; -import com.yunbao.common.bean.MessageChatUserBean; import com.yunbao.common.dialog.AbsDialogFullScreenPopupWindow; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.ViewUtils; import com.yunbao.share.adapters.InternalShareAdapter; -import com.yunbao.share.bean.ShareBuilder; import java.util.ArrayList; import java.util.List; 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.api.RefreshLayout; 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.IRongCoreEnum; import io.rong.imlib.RongCoreClient; -import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; public class AppInternalShareDialog extends AbsDialogFullScreenPopupWindow { @@ -72,6 +65,10 @@ public class AppInternalShareDialog extends AbsDialogFullScreenPopupWindow { dismiss(); }); findViewById(R.id.btn_share).setOnClickListener(view -> { + if(adapter.getSelectPosition()==-1){ + ToastUtil.show(R.string.dialog_share_failure_not_select); + return; + } if (onItemClickListener != null) { onItemClickListener.onItemClick(listData.get(adapter.getSelectPosition()).mCore.getTargetId(), adapter.getSelectPosition()); } diff --git a/Share/src/main/java/com/yunbao/share/ui/InvitePopDialog.java b/Share/src/main/java/com/yunbao/share/ui/InvitePopDialog.java index fbfeeb5..8d07827 100644 --- a/Share/src/main/java/com/yunbao/share/ui/InvitePopDialog.java +++ b/Share/src/main/java/com/yunbao/share/ui/InvitePopDialog.java @@ -2,14 +2,12 @@ package com.yunbao.share.ui; import static android.content.Context.CLIPBOARD_SERVICE; -import android.app.Dialog; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.graphics.Color; import android.graphics.LinearGradient; import android.graphics.Shader; -import android.view.ViewTreeObserver; import android.widget.ImageView; import android.widget.TextView; @@ -22,10 +20,8 @@ import com.makeramen.roundedimageview.RoundedImageView; import com.pdlive.shayu.R; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.dialog.AbsDialogPopupWindow; -import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; -import com.yunbao.share.bean.ShareBuilder; +import com.yunbao.share.bean.ShareBean; import com.yunbao.share.adapters.ShareAppAdapter; import java.util.ArrayList; @@ -38,7 +34,7 @@ public class InvitePopDialog extends AbsDialogPopupWindow { private TextView info; private TextView link; private TextView title; - private List data; + private List data; private String uid; private String anchorId; @@ -123,18 +119,18 @@ public class InvitePopDialog extends AbsDialogPopupWindow { private void initData() { data = new ArrayList<>(); - data.add(builder(ShareBuilder.APP_FACEBOOK)); - data.add(builder(ShareBuilder.APP_LINE)); - data.add(builder(ShareBuilder.APP_TWITTER)); - data.add(builder(ShareBuilder.APP_WHATSAPP)); - data.add(builder(ShareBuilder.APP_MESSENGER)); + data.add(builder(ShareBean.APP_FACEBOOK)); + data.add(builder(ShareBean.APP_LINE)); + data.add(builder(ShareBean.APP_TWITTER)); + data.add(builder(ShareBean.APP_WHATSAPP)); + data.add(builder(ShareBean.APP_MESSENGER)); // data.add(builder(ShareBuilder.APP_INSTAGRAM)); adapter.setList(data); } - private ShareBuilder builder(int type) { - ShareBuilder builder = ShareBuilder.builder(type); + private ShareBean builder(int type) { + ShareBean builder = ShareBean.builder(type); builder.setText(getContext().getString(R.string.dialog_invite_info)); builder.setLink(url); builder.setUid(uid); diff --git a/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java b/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java index 6683254..75b16ed 100644 --- a/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java +++ b/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java @@ -12,58 +12,48 @@ import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.lxj.xpopup.XPopup; -import com.lxj.xpopup.util.XPopupUtils; import com.makeramen.roundedimageview.RoundedImageView; import com.pdlive.shayu.R; +import com.yunbao.common.dialog.AbsDialogCenterPopupWindow; import com.yunbao.common.dialog.AbsDialogPopupWindow; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; 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.List; public class SharePopDialog extends AbsDialogPopupWindow { + public static final int TYPE_LIVE = 0; + public static final int TYPE_DYNAMIC = 1; private ShareAppAdapter adapter; private RecyclerView list; private RoundedImageView avatar; private TextView info; private TextView link; - private List data; + private List data; - private String uid; - private String anchorId; - private String anchorName; - private String anchorAvatar; private String shareLink; + private int type; + private ShareBean bean; public SharePopDialog(@NonNull Context context) { super(context); } - public SharePopDialog setUid(String uid) { - this.uid = uid; + + public SharePopDialog setShareType(int type) { + this.type = type; return this; } - public SharePopDialog setAnchorId(String anchorId) { - this.anchorId = anchorId; + public SharePopDialog setShareData(ShareBean build) { + this.bean=build; 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) { this.shareLink = link + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); return this; @@ -89,7 +79,7 @@ public class SharePopDialog extends AbsDialogPopupWindow { info = findViewById(R.id.share_info); link = findViewById(R.id.share_link); adapter = new ShareAppAdapter(getContext()); - adapter.setOnShareStatusListener(new ShareAppAdapter.ShareCallback(){ + adapter.setOnShareStatusListener(new ShareAppAdapter.ShareCallback() { @Override public void onSuccess() { super.onSuccess(); @@ -103,16 +93,16 @@ public class SharePopDialog extends AbsDialogPopupWindow { private void initData() { data = new ArrayList<>(); - data.add(builder(ShareBuilder.APP_FACEBOOK)); - data.add(builder(ShareBuilder.APP_LINE)); - data.add(builder(ShareBuilder.APP_TWITTER)); - data.add(builder(ShareBuilder.APP_WHATSAPP)); - data.add(builder(ShareBuilder.APP_MESSENGER)); - data.add(builder(ShareBuilder.APP_INTERNAL)); + data.add(builder(ShareBean.APP_FACEBOOK)); + data.add(builder(ShareBean.APP_LINE)); + data.add(builder(ShareBean.APP_TWITTER)); + data.add(builder(ShareBean.APP_WHATSAPP)); + data.add(builder(ShareBean.APP_MESSENGER)); + data.add(builder(ShareBean.APP_INTERNAL)); adapter.setList(data); String url; 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 { if (shareLink.length() > 40) { url = shareLink.substring(0, 40) + "..."; @@ -122,20 +112,14 @@ public class SharePopDialog extends AbsDialogPopupWindow { } url = url + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); link.setText(url); - info.setText(String.format(getContext().getString(R.string.dialog_share_info), StringUtil.isEmpty(anchorName) ? "" : anchorName)); - ImgLoader.display(getContext(), anchorAvatar, avatar); + info.setText(String.format(getContext().getString(R.string.dialog_share_info), StringUtil.isEmpty(bean.getAnchorName()) ? "" : bean.getAnchorName())); + ImgLoader.display(getContext(), bean.getAnchorAvatar(), avatar); } - private ShareBuilder builder(int type) { - ShareBuilder builder = ShareBuilder.builder(type); - builder.setText(String.format(getContext().getString(R.string.dialog_share_info), StringUtil.isEmpty(anchorName) ? "" : anchorName)); - builder.setUid(uid); - builder.setAnchorId(anchorId); - builder.setAnchorName(anchorName); - builder.setAnchorAvatar(anchorAvatar); - if (shareLink != null) { - builder.setLink(shareLink); - } + private ShareBean builder(int type) { + ShareBean builder = bean.clone(); + builder.setType(type); + builder.setText(String.format(getContext().getString(R.string.dialog_share_info), StringUtil.isEmpty(bean.getAnchorName()) ? "" : bean.getAnchorName())); return builder; } @@ -144,11 +128,12 @@ public class SharePopDialog extends AbsDialogPopupWindow { if (shareLink != null) { url = shareLink; } 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); ClipData clipData = ClipData.newPlainText("text", info.getText().toString() + "\n" + url + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0)); cm.setPrimaryClip(clipData); ToastUtil.show(getContext().getString(com.yunbao.common.R.string.copy_success)); } + } diff --git a/Share/src/main/java/com/yunbao/share/ui/ShareSuccessNotifyDialog.java b/Share/src/main/java/com/yunbao/share/ui/ShareSuccessNotifyDialog.java index bb9c2c0..391286b 100644 --- a/Share/src/main/java/com/yunbao/share/ui/ShareSuccessNotifyDialog.java +++ b/Share/src/main/java/com/yunbao/share/ui/ShareSuccessNotifyDialog.java @@ -11,19 +11,16 @@ import androidx.annotation.NonNull; import com.lxj.xpopup.XPopup; import com.lxj.xpopup.enums.PopupAnimation; import com.pdlive.shayu.R; -import com.yunbao.common.bean.MessageUserInfoBean; import com.yunbao.common.custom.RatioRoundImageView; import com.yunbao.common.dialog.AbsDialogPositionPopupWindow; -import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.DpUtil; -import com.yunbao.common.utils.StringUtil; -import com.yunbao.share.bean.ShareBuilder; +import com.yunbao.share.bean.ShareBean; import io.rong.imkit.utils.RouteUtils; import io.rong.imlib.model.Conversation; public class ShareSuccessNotifyDialog extends AbsDialogPositionPopupWindow { - private ShareBuilder bean; + private ShareBean bean; private DialogInterface.OnDismissListener onDismissListener; private TextView anchorName; @@ -34,7 +31,7 @@ public class ShareSuccessNotifyDialog extends AbsDialogPositionPopupWindow { super(context); } - public ShareSuccessNotifyDialog(@NonNull Context context, ShareBuilder bean) { + public ShareSuccessNotifyDialog(@NonNull Context context, ShareBean bean) { super(context); this.bean = bean; } diff --git a/Share/src/main/res/values-en/strings.xml b/Share/src/main/res/values-en/strings.xml index a45ce7e..bb68d28 100644 --- a/Share/src/main/res/values-en/strings.xml +++ b/Share/src/main/res/values-en/strings.xml @@ -12,4 +12,5 @@ Share Success Chat + Please select friends \ No newline at end of file diff --git a/Share/src/main/res/values/strings.xml b/Share/src/main/res/values/strings.xml index 4c2e014..9cc4332 100644 --- a/Share/src/main/res/values/strings.xml +++ b/Share/src/main/res/values/strings.xml @@ -21,4 +21,5 @@ 發送 分享成功 去聊聊 + 请选择好友 \ No newline at end of file diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 2685dcd..a05b83b 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -44,7 +44,9 @@ import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider; import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom; 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.provider.MessageChatCardItemProvider; import com.yunbao.common.provider.MessageChatTipsItemProvider; import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.Bus; @@ -220,12 +222,14 @@ public class AppContext extends CommonAppContext { myMessages.add(RecommendLiveRoom.class); myMessages.add(InstructorSendReward.class); myMessages.add(MessageChatTipsContent.class); + myMessages.add(MessageChatCardContent.class); RongIMClient.registerMessageType(myMessages); // 注册自定义消息模板 RongConfigCenter.conversationConfig().addMessageProvider(new InstructorSendRewardProvider(getApplicationContext())); RongConfigCenter.conversationConfig().addMessageProvider(new RecommendLiveRoomProvider(getApplicationContext())); RongConfigCenter.conversationConfig().addMessageProvider(new MessageChatTipsItemProvider(getApplicationContext())); + RongConfigCenter.conversationConfig().addMessageProvider(new MessageChatCardItemProvider(getApplicationContext())); RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() { @Override diff --git a/common/src/main/java/com/yunbao/common/bean/MessageUserInfoBean.java b/common/src/main/java/com/yunbao/common/bean/MessageUserInfoBean.java index d85da7f..7600119 100644 --- a/common/src/main/java/com/yunbao/common/bean/MessageUserInfoBean.java +++ b/common/src/main/java/com/yunbao/common/bean/MessageUserInfoBean.java @@ -8,7 +8,7 @@ import java.util.List; public class MessageUserInfoBean extends BaseModel{ IMLoginModel user; UserInfo info; - UserLevel level; + //UserLevel level; @SerializedName("gift_num") int giftNum; @SerializedName("msg") @@ -60,13 +60,13 @@ public class MessageUserInfoBean extends BaseModel{ this.info = info; } - public UserLevel getLevel() { + /*public UserLevel getLevel() { return level; } public void setLevel(UserLevel level) { this.level = level; - } + }*/ public int getGiftNum() { return giftNum; @@ -107,6 +107,20 @@ public class MessageUserInfoBean extends BaseModel{ private String age; @SerializedName("open_off") 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() { return openOff; diff --git a/common/src/main/java/com/yunbao/common/provider/MessageChatCardItemProvider.java b/common/src/main/java/com/yunbao/common/provider/MessageChatCardItemProvider.java index ea8cc52..83abc14 100644 --- a/common/src/main/java/com/yunbao/common/provider/MessageChatCardItemProvider.java +++ b/common/src/main/java/com/yunbao/common/provider/MessageChatCardItemProvider.java @@ -4,9 +4,19 @@ import android.content.Context; import android.text.Spannable; import android.view.ViewGroup; +import com.alibaba.fastjson.JSON; 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.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; @@ -21,34 +31,74 @@ public class MessageChatCardItemProvider extends BaseMessageItemProvider list, IViewProviderListener 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 - protected boolean onItemClick(ViewHolder holder, MessageChatCardContent messageChatTipsContent, UiMessage uiMessage, int position, List list, IViewProviderListener listener) { + protected boolean onItemClick(ViewHolder holder, MessageChatCardContent content, UiMessage uiMessage, int position, List list, IViewProviderListener listener) { + if ("1".equals(content.getType())) { + gotoLive(content.getExtraData()); + } return false; } @Override protected boolean isMessageViewType(MessageContent messageContent) { - return messageContent instanceof MessageChatTipsContent; + return messageContent instanceof MessageChatCardContent; } @Override public Spannable getSummarySpannable(Context context, MessageChatCardContent content) { 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); + } + } + + }); + } } diff --git a/common/src/main/res/layout/view_message_chat_card.xml b/common/src/main/res/layout/view_message_chat_card.xml new file mode 100644 index 0000000..d9373d3 --- /dev/null +++ b/common/src/main/res/layout/view_message_chat_card.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-xxhdpi/ic_chat_black.png b/common/src/main/res/mipmap-xxhdpi/ic_chat_black.png new file mode 100644 index 0000000..21180bb Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/ic_chat_black.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/ic_chat_remarks.png b/common/src/main/res/mipmap-xxhdpi/ic_chat_remarks.png new file mode 100644 index 0000000..37508c5 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/ic_chat_remarks.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/ic_chat_report.png b/common/src/main/res/mipmap-xxhdpi/ic_chat_report.png new file mode 100644 index 0000000..6569f87 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/ic_chat_report.png differ diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index f5606a7..cb4cb26 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -26,6 +26,7 @@ Pull black Relieving blackout Remarks + Report Sign in immediately Continuously signed in day diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 83071f6..b22937d 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -16,7 +16,8 @@ 沒有更多數據了 拉黑 解除拉黑 - 備註 + 修改備註 + 舉報 立即簽到 已連續簽到 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 0b3c171..813230c 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -16,7 +16,8 @@ 沒有更多數據了 拉黑 解除拉黑 - 備註 + 修改備註 + 舉報 立即簽到 已連續簽到 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 5e6be0f..fe1e5b2 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -16,7 +16,8 @@ 沒有更多數據了 拉黑 解除拉黑 - 備註 + 修改備註 + 舉報 立即簽到 已連續簽到 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 571e9d6..7a8983b 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -26,6 +26,7 @@ Pull black Relieving blackout Remarks + Report Sign in immediately Continuously signed in day diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index e5b9736..4a983c4 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -123,6 +123,7 @@ import com.yunbao.live.http.ImHttpUtil; import com.yunbao.live.views.LiveRoomPlayViewHolder; import com.yunbao.live.views.LiveRoomViewHolder; import com.yunbao.live.views.PortraitLiveManager; +import com.yunbao.share.bean.ShareBean; import com.yunbao.share.ui.SharePopDialog; import org.greenrobot.eventbus.EventBus; @@ -865,7 +866,7 @@ public class LiveAudienceActivity extends LiveActivity { if (!TextUtils.isEmpty(event.getMethod())) { if (TextUtils.equals(event.getMethod(), "closeLiveRoom")) { onBackPressed(); - }else if (TextUtils.equals(event.getMethod(), "androidtoCommunityVideo")) { + } else if (TextUtils.equals(event.getMethod(), "androidtoCommunityVideo")) { RouteUtil.forwardCommunityActivity(); } } @@ -1460,10 +1461,16 @@ public class LiveAudienceActivity extends LiveActivity { break; case LIVE_SHARE: new SharePopDialog(mContext) - .setUid(CommonAppConfig.getInstance().getUid()) - .setAnchorId(event.getBean().getUid()) - .setAnchorName(event.getBean().getUserNiceName()) - .setAnchorAvatar(event.getBean().getAvatar()) + .setShareType(SharePopDialog.TYPE_LIVE) + .setShareData(ShareBean.ShareBuilder.create() + .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()) + .setAnchorName(event.getBean().getUserNiceName()) + .setAnchorAvatar(event.getBean().getAvatar()) + .build() + ) .showDialog(); break; case WISH_LIST_PROGRESS: diff --git a/live/src/main/java/com/yunbao/live/dialog/MenuPopuwWindow.java b/live/src/main/java/com/yunbao/live/dialog/MenuPopuwWindow.java index e8a4c64..fc6c679 100644 --- a/live/src/main/java/com/yunbao/live/dialog/MenuPopuwWindow.java +++ b/live/src/main/java/com/yunbao/live/dialog/MenuPopuwWindow.java @@ -13,6 +13,8 @@ import android.widget.PopupWindow; import android.widget.TextView; 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.live.R; import com.yunbao.live.activity.EditNameRemarksActivity; @@ -26,15 +28,15 @@ import io.rong.imlib.RongIMClient; public class MenuPopuwWindow implements View.OnClickListener { private Activity mContext; private String userId; - private View popupView; - private TextView tvBlack, tvBlackMove; + private View popupView, ltBlack, ltReport; + private TextView tvBlack; private LinearLayout ltRemarks; private PopupWindow popupWindow; private Handler netHandler = new Handler(); public MenuPopuwWindow(Activity 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(); } @@ -43,19 +45,18 @@ public class MenuPopuwWindow implements View.OnClickListener { if (TextUtils.equals(isAdmin, "1")) { tvBlack.setVisibility(View.GONE); - tvBlackMove.setVisibility(View.GONE); ltRemarks.setVisibility(View.VISIBLE); } else { - ltRemarks.setVisibility(View.GONE); + ltRemarks.setVisibility(View.VISIBLE); RongIMClient.getInstance().getBlacklistStatus(userId, new RongIMClient.ResultCallback() { @Override public void onSuccess(RongIMClient.BlacklistStatus blacklistStatus) { if (blacklistStatus == RongIMClient.BlacklistStatus.IN_BLACK_LIST) { - tvBlackMove.setVisibility(View.VISIBLE); - tvBlack.setVisibility(View.GONE); + tvBlack.setTag("1"); + tvBlack.setText(R.string.black_ing); } else { - tvBlack.setVisibility(View.VISIBLE); - tvBlackMove.setVisibility(View.GONE); + tvBlack.setTag(null); + tvBlack.setText(R.string.black); } } @@ -73,10 +74,11 @@ public class MenuPopuwWindow implements View.OnClickListener { */ private void initView() { 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); - tvBlack.setOnClickListener(this); - tvBlackMove.setOnClickListener(this); + ltBlack.setOnClickListener(this); + ltReport.setOnClickListener(this); ltRemarks.setOnClickListener(this); } @@ -87,7 +89,7 @@ public class MenuPopuwWindow implements View.OnClickListener { * @return */ 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); WindowManager.LayoutParams lp = mContext.getWindow().getAttributes(); lp.alpha = 0.8f; @@ -105,40 +107,14 @@ public class MenuPopuwWindow implements View.OnClickListener { public void onClick(View v) { int id = v.getId(); //拉黑 - if (id == R.id.tv_black) { - RongIMClient.getInstance().addToBlacklist(userId, new RongIMClient.OperationCallback() { - @Override - public void onSuccess() { - ToastUtil.show(mContext.getResources().getString(R.string.black_succer)); - popupWindow.dismiss(); - tvBlack.setVisibility(View.VISIBLE); - tvBlackMove.setVisibility(View.GONE); - netHandler.post(setBlackRunnable); - } - - @Override - 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(); - } - }); + if (id == R.id.lt_black) { + if (tvBlack.getTag() == null) { + black(); + } else { + unblack(); + } + } else if (id == R.id.lt_report) {//移出黑名单 + RouteUtil.forwardLiveReportActivity(userId); } else if (id == R.id.lt_remarks) {//添加备注 Intent intent = new Intent(mContext, EditNameRemarksActivity.class); 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() { @Override diff --git a/live/src/main/res/layout/popwindow_chat_more_v2.xml b/live/src/main/res/layout/popwindow_chat_more_v2.xml new file mode 100644 index 0000000..7c630f3 --- /dev/null +++ b/live/src/main/res/layout/popwindow_chat_more_v2.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java index 751ae51..a36218b 100644 --- a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java @@ -61,6 +61,7 @@ import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.views.LiveRoomViewHolder; import com.yunbao.main.dialog.EncourageDialog; import com.yunbao.main.http.MainHttpUtil; +import com.yunbao.share.bean.ShareBean; import com.yunbao.share.ui.SharePopDialog; import com.yunbao.video.activity.VideoPlayActivity; import com.yunbao.video.utils.VideoStorge; @@ -592,8 +593,13 @@ public class MyWebViewActivity extends AbsActivity { } else if (TextUtils.equals(event.getMethod(), "androidCommunityShare")) { JSONObject json = JSONObject.parseObject(event.getData()); new SharePopDialog(mContext) + .setShareType(SharePopDialog.TYPE_DYNAMIC) + .setShareData(ShareBean.ShareBuilder + .create() + .setAnchorAvatar(json.getString("avatar")) + .build() + ) .setShareLink(CommonAppConfig.HOST + json.getString("link")) - .setAnchorAvatar(json.getString("avatar")) .showDialog(); } else if (TextUtils.equals(event.getMethod(), "androidCancelAnchorAttention")) { if (!StringUtil.isEmpty(LiveAudienceActivity.is_fans)) { diff --git a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java index 793d8b8..a816b13 100644 --- a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java @@ -1,21 +1,16 @@ package com.yunbao.main.activity; import android.Manifest; -import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Color; import android.os.Build; -import android.os.Handler; -import android.os.Looper; import android.text.TextUtils; import android.util.Log; import android.view.View; -import android.view.ViewGroup; import android.view.WindowManager; import android.view.animation.Animation; import android.view.animation.AnimationUtils; -import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; @@ -27,12 +22,13 @@ import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import androidx.recyclerview.widget.RecyclerView; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.SelectImageActivity; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.ImageEntity; -import com.yunbao.common.bean.MessageChatUserBean; import com.yunbao.common.bean.MessageUserInfoBean; import com.yunbao.common.bean.NoviceInstructorModel; 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.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; -import com.yunbao.common.interfaces.OnSendMessageListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.NoviceInstructorManager; 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.StringUtil; 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.adapter.MessageChatTopImageListAdapter; 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.Subscribe; import org.greenrobot.eventbus.ThreadMode; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import io.rong.imkit.IMCenter; @@ -113,6 +108,12 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl MessageIMManager.get(this).addConversationClickListener(); } + @Override + protected void onResume() { + super.onResume(); + setUserCard(); + } + private void hideUserCard() { if (card.getTag() != null) return; card.setTag("fold"); @@ -185,7 +186,6 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl //绑定聊天用户id inputPanel.setTargetId(targetId); - ToastUtil.show("id:" + targetId); //获取用户信息 UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId); setUserCard(); @@ -262,29 +262,37 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl @Override public void onSuccess(MessageUserInfoBean 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)); ViewUtils.findViewById(card, R.id.userName, TextView.class).setText(data.getUser().getUserNicename()); 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(); showTag(); - if(data.getUser().getAttention()==0){ - ViewUtils.findViewById(card,R.id.follow, Button.class).setOnClickListener(new View.OnClickListener() { + if (data.getUser().getAttention() == 0) { + ViewUtils.findViewById(card, R.id.follow, Button.class).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - follow((Button) view,userInfoBean.getUser().getId()+""); + follow((Button) view, userInfoBean.getUser().getId() + ""); } }); - - }else{ - ViewUtils.findViewById(card,R.id.follow, Button.class).setVisibility(View.INVISIBLE); + } else { + ViewUtils.findViewById(card, R.id.follow, Button.class).setVisibility(View.INVISIBLE); } + getRemarkName(); } @Override public void onError(String error) { } + private void showBanner() { LiveNetManager.get(mContext) .getUserHomeBanner(targetId, new HttpCallback>() { @@ -305,30 +313,31 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl } }); } - private void showTag(){ - List tags=new ArrayList<>(); + + private void showTag() { + List tags = new ArrayList<>(); tags.add(userInfoBean.getInfo().getAge()); - if(!StringUtil.isEmpty(userInfoBean.getInfo().getCareer())){ + if (!StringUtil.isEmpty(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()); } List t; - if(WordUtil.isNewZh()) { - t=userInfoBean.getInfo().getCn_label(); - }else{ - t=userInfoBean.getInfo().getEn_label(); + if (WordUtil.isNewZh()) { + t = userInfoBean.getInfo().getCn_label(); + } else { + t = userInfoBean.getInfo().getEn_label(); } - if(t!=null){ + if (t != null) { for (String tag : t) { - if(!StringUtil.isEmpty(tag)){ + if (!StringUtil.isEmpty(tag)) { tags.add(tag); } } } - MessageChatTopTopListAdapter adapter=new MessageChatTopTopListAdapter(); + MessageChatTopTopListAdapter adapter = new MessageChatTopTopListAdapter(); RecyclerView avatarList = ViewUtils.findViewById(card, R.id.tag_list, RecyclerView.class); avatarList.setAdapter(adapter); 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 public void onClick(View v) { int id = v.getId(); @@ -418,12 +444,13 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl } } } + private void follow(Button btn, String id) { LiveNetManager.get(btn.getContext()) .setAttents(id, new HttpCallback() { @Override public void onSuccess(SetAttentsModel data) { - btn.setVisibility(View.INVISIBLE); + btn.setVisibility(View.INVISIBLE); } @Override @@ -432,6 +459,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl } }); } + @Override protected void onDestroy() { super.onDestroy(); @@ -448,7 +476,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl @Subscribe(threadMode = ThreadMode.MAIN) public void onMessageIMEvent(String event) { if (!TextUtils.isEmpty(event)) { - titleView.setText(event); + //titleView.setText(event); } } diff --git a/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityFragment.java b/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityFragment.java index 567b843..c777397 100644 --- a/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/MainHomeCommunityFragment.java @@ -65,6 +65,7 @@ import com.yunbao.main.activity.MainActivity; import com.yunbao.main.activity.MyWalletActivity; import com.yunbao.main.dialog.EncourageDialog; import com.yunbao.main.utils.BottomBarUtil; +import com.yunbao.share.bean.ShareBean; import com.yunbao.share.ui.SharePopDialog; import com.yunbao.video.activity.VideoPlayActivity; import com.yunbao.video.utils.VideoStorge; @@ -376,8 +377,10 @@ public class MainHomeCommunityFragment extends BaseFragment { } else if (TextUtils.equals(event.getMethod(), "androidCommunityShare")) { JSONObject json = JSONObject.parseObject(event.getData()); new SharePopDialog(mContext) + .setShareData(ShareBean.ShareBuilder.create() + .setAnchorAvatar(json.getString("avatar")) + .build()) .setShareLink(CommonAppConfig.HOST + json.getString("link")) - .setAnchorAvatar(json.getString("avatar")) .showDialog(); } } diff --git a/main/src/main/java/com/yunbao/main/fragment/MainMessageChatFragment.java b/main/src/main/java/com/yunbao/main/fragment/MainMessageChatFragment.java index 2b1c94e..db724e0 100644 --- a/main/src/main/java/com/yunbao/main/fragment/MainMessageChatFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/MainMessageChatFragment.java @@ -1,8 +1,6 @@ package com.yunbao.main.fragment; -import android.graphics.Color; import android.os.Bundle; -import android.text.SpannableString; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -10,7 +8,6 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.yunbao.common.custom.ItemDecoration; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; 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.model.BaseUiConversation; 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.model.Conversation; import io.rong.imlib.model.SearchConversationResult; @@ -63,7 +57,7 @@ public class MainMessageChatFragment extends ConversationListFragment { System.err.println(" ----------------------->" + mAdapter.getData().size()); for (BaseUiConversation cn : ((MainConversationListAdapter) mAdapter).getSrcList()) { 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)) { conversation = new SingleConversation(getContext(), new Conversation()); conversation.mCore.setObjectName("SEARCH_USER" + search); @@ -74,7 +68,6 @@ public class MainMessageChatFragment extends ConversationListFragment { conversation.mCore.setSenderUserId(cn.mCore.getSenderUserId()); data.add(conversation); } - } if (data.size() == 1) { data.get(0).mCore.setMentionedCount(3); diff --git a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java index f84b339..088b98a 100644 --- a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java +++ b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java @@ -57,6 +57,7 @@ import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; import io.rong.imlib.model.UserInfo; import io.rong.sight.SightExtensionModule; + import com.yunbao.main.R; import com.yunbao.main.views.MessageChatExtensionConfig; @@ -68,6 +69,7 @@ public class ConversationIMListManager { private Context mContext; //指导员ID private String targetId; + private String topContent; private Handler conversationIMListHandler = new Handler(); private ConversationIMListManager(Context context) { @@ -246,11 +248,30 @@ public class ConversationIMListManager { } }; + private void setConversationToTop(String targetId) { + setConversationToTop(null, targetId); + } + /** * 消息置顶 */ - private void setConversationToTop(String targetId) { - IMCenter.getInstance().setConversationToTop(Conversation.ConversationType.PRIVATE, targetId, true, false, null + private void setConversationToTop(BaseUiConversation conversation, String targetId) { + 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() { + @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()); 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())) { IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); if (!TextUtils.equals(model.getIsAdmin(), "1")) { @@ -300,10 +326,10 @@ public class ConversationIMListManager { .setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(String bean, int position) { - if (bean.equals(WordUtil.getNewString(R.string.top))) { - // copyText(baseUiConversation,context); - setConversationToTop(targetId); - } else if(bean.equals(WordUtil.getNewString(R.string.delete))){ + if (bean.equals(topContent)) { + // copyText(baseUiConversation,context); + setConversationToTop(baseUiConversation, targetId); + } else if (bean.equals(WordUtil.getNewString(R.string.delete))) { delete(baseUiConversation.mCore.getTargetId()); } } @@ -402,7 +428,8 @@ public class ConversationIMListManager { public String getTargetId() { return targetId; } - private void copyText(UiMessage uiMessage,Context context) { + + private void copyText(UiMessage uiMessage, Context context) { ClipboardManager cm = (ClipboardManager) context.getSystemService(CLIPBOARD_SERVICE); ClipData clipData = ClipData.newPlainText("text", uiMessage.getContentSpannable()); cm.setPrimaryClip(clipData); diff --git a/main/src/main/res/layout/view_msg_chat_title.xml b/main/src/main/res/layout/view_msg_chat_title.xml index 06d4947..d8394c2 100644 --- a/main/src/main/res/layout/view_msg_chat_title.xml +++ b/main/src/main/res/layout/view_msg_chat_title.xml @@ -3,16 +3,15 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="wrap_content" - > + android:layout_height="wrap_content"> @@ -49,10 +48,10 @@ @@ -109,17 +108,31 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + app:layout_constraintTop_toTopOf="@+id/userName"> + + + + + + app:layout_constraintStart_toStartOf="parent" + tools:itemCount="9" + tools:listitem="@layout/view_msg_chat_top_image" /> 暫未達到等級 領取成功 置頂 + 取消置頂 刪除 消息 官方通知 @@ -70,4 +71,6 @@ + 在线 + 离线 \ No newline at end of file diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml index aebd1e4..764d71f 100644 --- a/main/src/main/res/values/strings.xml +++ b/main/src/main/res/values/strings.xml @@ -19,6 +19,7 @@ Not yet reached level Successfully claimed 置頂 + 取消置頂 刪除 Information Activities @@ -67,7 +68,9 @@ Select your Birthday Album Camera - - - + Year + Month + Day + Online + Offline