From b3b46ccff35e1d2ae1a85d5299ab927d46d16315 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sat, 16 Mar 2024 17:50:16 +0800 Subject: [PATCH 1/5] =?UTF-8?q?add=20=E5=88=86=E4=BA=AB=20add=20=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E9=A1=B5=E9=9D=A2=E5=8F=B3=E4=B8=8A=E8=A7=92=E8=8F=9C?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/share/AbsShareInterface.java | 4 +- .../share/adapters/ShareAppAdapter.java | 41 ++- .../java/com/yunbao/share/bean/ShareBean.java | 260 ++++++++++++++++++ .../com/yunbao/share/bean/ShareBuilder.java | 135 --------- .../yunbao/share/platform/FacebookShare.java | 5 +- .../com/yunbao/share/platform/Instagram.java | 4 +- .../com/yunbao/share/platform/Internal.java | 34 ++- .../java/com/yunbao/share/platform/Line.java | 4 +- .../yunbao/share/platform/MessengerShare.java | 5 +- .../yunbao/share/platform/TwitterShare.java | 4 +- .../com/yunbao/share/platform/WhatsApp.java | 4 +- .../share/ui/AppInternalShareDialog.java | 11 +- .../com/yunbao/share/ui/InvitePopDialog.java | 22 +- .../com/yunbao/share/ui/SharePopDialog.java | 71 ++--- .../share/ui/ShareSuccessNotifyDialog.java | 9 +- Share/src/main/res/values-en/strings.xml | 1 + Share/src/main/res/values/strings.xml | 1 + .../java/com/shayu/phonelive/AppContext.java | 4 + .../common/bean/MessageUserInfoBean.java | 20 +- .../provider/MessageChatCardItemProvider.java | 66 ++++- .../res/layout/view_message_chat_card.xml | 63 +++++ .../main/res/mipmap-xxhdpi/ic_chat_black.png | Bin 0 -> 2600 bytes .../res/mipmap-xxhdpi/ic_chat_remarks.png | Bin 0 -> 1469 bytes .../main/res/mipmap-xxhdpi/ic_chat_report.png | Bin 0 -> 1981 bytes common/src/main/res/values-en-rUS/string.xml | 1 + common/src/main/res/values-zh-rHK/strings.xml | 3 +- common/src/main/res/values-zh-rTW/strings.xml | 3 +- common/src/main/res/values-zh/strings.xml | 3 +- common/src/main/res/values/strings.xml | 1 + .../live/activity/LiveAudienceActivity.java | 17 +- .../yunbao/live/dialog/MenuPopuwWindow.java | 104 +++---- .../res/layout/popwindow_chat_more_v2.xml | 103 +++++++ .../main/activity/MyWebViewActivity.java | 8 +- .../activity/PDLiveConversationActivity.java | 88 ++++-- .../fragment/MainHomeCommunityFragment.java | 5 +- .../fragment/MainMessageChatFragment.java | 9 +- .../ConversationIMListManager.java | 43 ++- .../main/res/layout/view_msg_chat_title.xml | 43 ++- main/src/main/res/values-zh/strings.xml | 3 + main/src/main/res/values/strings.xml | 9 +- 40 files changed, 835 insertions(+), 376 deletions(-) create mode 100644 Share/src/main/java/com/yunbao/share/bean/ShareBean.java delete mode 100644 Share/src/main/java/com/yunbao/share/bean/ShareBuilder.java create mode 100644 common/src/main/res/layout/view_message_chat_card.xml create mode 100644 common/src/main/res/mipmap-xxhdpi/ic_chat_black.png create mode 100644 common/src/main/res/mipmap-xxhdpi/ic_chat_remarks.png create mode 100644 common/src/main/res/mipmap-xxhdpi/ic_chat_report.png create mode 100644 live/src/main/res/layout/popwindow_chat_more_v2.xml diff --git a/Share/src/main/java/com/yunbao/share/AbsShareInterface.java b/Share/src/main/java/com/yunbao/share/AbsShareInterface.java index fed5ddee8..dbae5135a 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 977367b96..2ec55c811 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 000000000..d6a65daa8 --- /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 903386a68..000000000 --- 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 c34739e1f..d899895b2 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 da876e6fb..d77fe5685 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 67b76cdb0..fec95780c 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 bbad5c934..5b88e69a6 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 e9b312646..3c3db1906 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 399cc758c..05adb5aa2 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 51485e6fb..6d982ffe2 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 3bf8e3545..6ee31a9c2 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 fbfeeb53e..8d0782712 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 66832548b..75b16edc1 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 bb9c2c030..391286b17 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 a45ce7e82..bb68d289c 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 4c2e01402..9cc433273 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 2685dcde5..a05b83b02 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 d85da7fda..760011933 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 ea8cc52ca..83abc14de 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 000000000..d9373d3df --- /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 0000000000000000000000000000000000000000..21180bbbf3f27fb4b091ab0f92e0464fece611a9 GIT binary patch literal 2600 zcmV+@3fJ|CP)Px;;z>k7RA@u3T78UMRTV$yzK?a|4z&uXC4AUmC|lUwckkPlwzPn;Rzgz&X@C-f z2_jX(r-46|k0K%_h+@_7QHcaaO3FvjP$@}e!Pd?0y!&Q%YJsh7_%QfE5ZmoSXJ_WU zuLbFTnKR%>ms75pZGvT z;2$1g7`_JpF9{(Y$>;O=BeBnOXAD3o^%Vek6aY?YR}X_BqW=NFV_NIm823zpv<+bO z>ea@cJ$u$7;xA`vv_8);324y6z7F;QPriVdIfQWdPU# z0ROGYRfy=bi1xq~3+D-;T&S@mTC(A(SV*tYG5Ausm9A%x&x zH|6vBpJz1|m+R~6JH;@JtpG4LQE~@8&s&^TXC?qjsn-y3X??ZW`7jKh&{|)W)lefj zrPOKwcoG1t*!TSauv}|Bltp(cfF(fc%JvCH04>pE2aL1 zi1X`5aF(_Cs(9n3=BBbts<2YBFruplH zfyZ*W+}bQvBFzEUbvFF z1pwk9%2V#qTHl#Am%pb1U?C~xh!CPTaT4FDwZ12dk!CXe{r$_rFnkFBI^#tG09I

()d*VXF(eTdk_dijo3tyUKo3WdR=3LvT$YXIPP4Z@CDhZ}s~=Sx}J zLn(D00Q}0btkcWo@*}?QuWd(3rX8p&R7!0?#BVleC%KK>Mnw1fzRxk;)^HqWju7H{ z+qUn|Qv2h|+X4_J^dKTmQ7Fj~^~7%x(T{!K-_VL}ShsGS*s^6yN3G4Y4jecT6pO`= zXTnaj4WPTb`=rj!P7MIZHUbe*CVY!LPiws`DZ{Ich!-HDB%%`{Js&Xv1^{~yQFnE9 zy_l7yXbXVry32`Z6991187<;ue-H#;9T^$A)?9osdhA$X~p{vzueq>~1Z{0~L<;of_^dur4lhyh9+(`fSQmM3R=gyrC zZ>FgLlu~yh;@wTQn-g|TXJ_Zm?c28>)_gdQbBPdw*$gwe>b$}c3&Hbp5v|gYSFLfc zW1iU6w@96u_cIi#p5YGFO|^51WK|yXSfLwuog^ zO5F_rcQly$BhT}0Z&orL$LWrUud@?#4+tU7Niy0^0Vt(@AcVLh$psP7-Ja*IYn6yf zsaXK<8ZT^JjzcEPT$Vrc%rj@(w$0?$i3vL!a=F}h;@9|w0Jv5ghOwK74&4%?gv!JP zIgaDnww*aZBagv@mj&qz4g17JUiErQ2THlxEJb#x`J|Tp-vc3RBG)Y8r8N5>JMka$>=-F!+ z#=_y@;ayV7yK3Oq#TR07a`KGP(b1hvcR)&c5hDH`06q~j^6zT3>W+?%^7ByYa2#i| zVHoGfcJPBrr82)*EWWRly1rJKm``n%e;-z>)kUMDqq|(!y$lhbiUX)rD(4gm1#1`o4d8s^^h_l=3Md#APu6p=p|PI4oS(y$JxCQs`kAP6#1f z&-2C@tPo;-A{2Xl-!C=<5OqmRSS_y$MAhSL&-1po0bttJM>@XddEOtCQWpXMKMXe7 z0cJcV5b?HrKK~D;)JurCBDN5GZ9k=H4m65?HlEMtQ%~$TxW2x=e%rQ(>n&(h!M16w zmu6iArPN7=VZ4)QV|SLz<)v}PZkl7gy}c)xrui;+cT@3oFnnJ2eSbw(!z{O8!Gg~O zLBQ{1hYCTo3z<08sD*tI0FsB|7zlvB{^{s4p0cI=rd=V%mbl|7ZdrbM!>U9@biayFMv8SD62q>39l3XUNS4tBrfD)A!W73$hRue3-{%T+ z*x=s!?YG~a69mCBMC9h4Da0vO4gi=S+rs~nGd?~(kmY%aC;cA*>8Nel91^zx0000< KMNUMnLSTXxG3Jv1 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..37508c5d3ad61e57e4def798642d5165554140e8 GIT binary patch literal 1469 zcmV;u1w#6XP)Px)cS%G+RA@u(SzU-6MG&s)p2>O=HNXBKTr?7b!OiVX&#{~$#0QmJ5)9E3!50Ak(%yFeP2edy}0@2jfruBt(}zz1I7_~9afnfBn6cp#h2F3#ukzZsGtojRAxUEbZ@ zeeS@41A*bX3B}qXuwuoExm{gdhX5cA0E1G>driPNj>tEdb18jDb?>Z7JmgGeW>|oE@C=-AXCa zUj%>wDdmx7U|iQ-uC*QpfCY%-_B-l%UjK{`5JEi07<(xs@DC!c@jP#+8JM1)o@*`3 z`WgTh5&^CCCsNAw(@tPuV1S=Gb!v%HY9|2PqP1Rxh?fF@9V*up(^~6scQhJ^XaNAN z8#g~9mXuOuMEnZ?zOU74TdURTH)CUC6%$g%XTWis?RDk58DprmCd--ZZ!8mr6A^+S z2;M7|N*l+<#^{hY9YzEk$Jxjjdwr@wH}Mh~XrGjF%ajlhLXbP-q4FmpR3YWz~ z=q!bV*1DNt7#&~$pnn=w0Qds{D6|$vfGx{{VzD^4P$-;h8j?v2v)OEqZQEakS0#!6 zptZhJDRr7LwwZIjD?G#m{NYq8b+l5cMBx6nJ?C6kDwU<2^UnZaet3vKuU4z;QmNE} zAP8P#jIAb5)0|T3N#FNhY>R;Fy8VcFgg}N0UzSpCrA>tp+ZbbeVzQp%^=A|QlV!x%dp+jNhVayxBGFDmE!mFOMN zTCeqef3TUtl`B_XZ`<|=04%15Ol$qV=Xv*q25G3P;dx04p=Jcq>Gb?LbLPB7sRSY( z@;vX+r2RtTn-K94060^>I`5ZKo}3W^Az0Se*OxkW>=?borUTRI^t>Pls`0C`nX#tD z144*J0I&@JZlny;0DXlqwr_NF^oxmPJ5IoHoDVI_+7O-r1N=ZS{|f-zB&9rk{(_DZ z5JE^qbXt7i&N9Z9kB*N1JmUmM#PkC4frFnhOHEN-4C*Xg(i!kgn70O(G5 zeJOP4bv~2N=cyK$@Vv|j0TZ*E%502G4=)`UO53sTWfs~5ucV)QofToI!-_c zags5%w9z4^m$p``J@5PejzskTr6!$yiG>iqBjSQa1j5|uBPr#E*-GFJ0C=YXI4XRK zrBZ2`X?4|c4-oLMwQ|Y%B&yXaD-;U9npi%PnGpi508El~9A_Qp{9wn@=_Ej{&gXKu zWwl!EyQn^{7fqXd-{0SCpTwGYGHz`ZcwAlxu^ticR!T|V_g@8orme?WM}WwzTD8g= z8XBsZ7-CiuFaaLPTqMwnwG3p(Tkk@M8=^8ZY0a$jfa5sFZQIV(YBjJd>xz+)k+W^x zLXP9C<(wai?q&ek>v`T2NtT(+d^Ve1ZQJ&zK@ezaVb*(5yL{h&wk-leh}#%rgR!!) z-o}ycWB?|u5kee6#QvzURVT7DpU*$n76Dr9x~`5AwlG1XcF2!WhdBwD!8{c>SB1ZE zamr-tO|Hy|6DOz@-*66@CtIp@CbQ^DWTm=uAQG)%MbMFP`o;Kc1Ocn|yw XSBkD)Smm6n00000NkvXXu0mjf7bUV0 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..6569f87c414e63b6bd06782ac2034f50bbe2332f GIT binary patch literal 1981 zcmV;u2SWIXP)Px+cS%G+RA@u(S$k|8#Toy;ncE9dupM4~S3oL+u!wUvbH*Hs6t`+2;t>i`f(GXQNhCDnZ?#VB_6y?qZ0EXwn8G+Nx687@r+q zZg;01ch?%TwK$&w|xfq{XKS`E1608**cMV#|r0Kf_WaH2mS044xnfH8K9>$?AH6_8c}Kq=*& zh}fsKuBsm*g4TL648v=3x!lfHfM^*2Ddn|{vFE}ttgDv+5{BVgrPQvvi|Z_C6#yos z4D7Rvl8iA3f?$ku-e!Q6dFD{5R62inczFDHK(qvalyVpVR>q2GtwTh7{^-%8n?^=P z3h8wEOvc#bhOGlrrVCp+^X@kukPC_Cl0D zTa;2;8xjyLY8pT)l}b5|lZ!iUR7v`X=$R51W}5fNv4h}QZK zM0ELr0LWxAKS9JT7T?iY>u)Qi9xFdk2yq+d{8#4pFbpSr-@jn*-o5+E*GVaVkBFC9 z2JyAl8{hn}05%d)sc8=gA?`y&bK#f<8da0;5YeM^#bwm3p9X+$ z#ruLFxKAndqk2gxgm{E=eutgVzVD}UxtuX%#Z%J*U0q$DaU4ehz!&3~48!n4rPPc! z=1_)9DIZ0|+fCj?G~uSHz1!*mh`jy|0DRfXg%63S>bW%mNGX5G7~5pI^C)9%ZKJ$h z2yr1IKCZPkmF10MvAAL1zJ0U0bqz3Py0K-d;u&vECv@cbdx+@a@;y}nq|@naB9VA2 zRz8{{Y*R|z+ze+=rBcha*2_wz(&$`wgmR_2y1JG*j`J=6oMpW`?EC(j@@`%YfU!Ux z0J^Nr|7DC_;<~O|F9huOot>R0cXV_lM@L5sBO@cnn%OIaxP~$ILfH`D5hA+F=2R5` zq?E?WhQn|x_WP7lO|i`=giIKG9spDj1e^2u{E=orNGV@qj9qDkae;HbdT3~9CZT5m z=;`TcpJI=Hu{$CF_(WtzgbhEYvla@4=K$d9IElkBe3*#tX;_F+B9%IeG4{^XwC`lg zn7fryYhpRG07xk>=A7?}FX_>U{{aiV~8LK z?o>+sv>7>OZBI|nXMNu{H2gHn7!MNB0~G+IlsQC9#fhV}Zm9WGQ!45sKhRpAhlnq< zwY5D{kC@d0XD(4%>#P+?GD&?;s+>X-+tZl`B`C;y8}E za$Xc$FOf)q@B3dMqJLHZh|1`n0YJ=@Da7d{48w3g090j!3*Z`a`CrC4|4M93%lfnK z2-OM>HIm`PNpI3rQ*0Gsbop0ku9Cok%2+@`o8? z>s;40W1X3&CL1-$!#OvTg$n@SBmhX9NTs8*O#d+)YWMi~_znB_@2?m;*1b|joaS5r zSl$d1Z2?%E8Ww+mhzDHPt(YgxPull 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 83071f619..b22937da0 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 0b3c17129..813230c49 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 5e6be0fa4..fe1e5b20f 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 571e9d67c..7a8983b7e 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 e5b9736b6..4a983c46a 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 e8a4c64bb..fc6c67943 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 000000000..7c630f379 --- /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 751ae514d..a36218bb7 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 793d8b80f..a816b1330 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 567b843be..c777397c0 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 2b1c94eb9..db724e0c2 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 f84b33988..088b98a30 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 06d49475e..d8394c230 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 aebd1e440..764d71f69 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 From d130c1565ce5da617cd3183dcdc0e4d588d5ef65 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 18 Mar 2024 10:57:42 +0800 Subject: [PATCH 2/5] =?UTF-8?q?add=20=E5=90=8D=E7=89=87=E5=9C=A8=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=8A=E7=9A=84=E8=A1=A8=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/adapters/InternalShareAdapter.java | 5 +++++ .../com/yunbao/share/platform/Internal.java | 5 +++-- .../com/yunbao/share/ui/SharePopDialog.java | 4 ++-- .../message/content/MessageChatCardContent.java | 17 ++++++++++++++--- .../live/activity/LiveAudienceActivity.java | 1 + .../adapter/MainConversationListAdapter.java | 10 ++++++++++ main/src/main/res/values-zh/strings.xml | 1 + main/src/main/res/values/strings.xml | 1 + 8 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java b/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java index d245fc17d..8944dfc9d 100644 --- a/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java +++ b/Share/src/main/java/com/yunbao/share/adapters/InternalShareAdapter.java @@ -3,6 +3,7 @@ package com.yunbao.share.adapters; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.CompoundButton; import android.widget.RadioButton; import android.widget.TextView; @@ -75,6 +76,10 @@ public class InternalShareAdapter extends RecyclerView.Adapter { + selectPosition = position; + notifyDataSetChanged(); + }); itemView.setOnClickListener(view -> { selectPosition = position; notifyDataSetChanged(); 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 fec95780c..56cb0ec55 100644 --- a/Share/src/main/java/com/yunbao/share/platform/Internal.java +++ b/Share/src/main/java/com/yunbao/share/platform/Internal.java @@ -36,7 +36,8 @@ public class Internal extends AbsShareInterface { } }).showDialog(); } - void sendMessage(ShareBean builder){ + + void sendMessage(ShareBean builder) { MessageChatCardContent.sendMessage(Conversation.ConversationType.PRIVATE, builder.getUid(), MessageChatCardContent.obtain( builder.getCover(), @@ -44,7 +45,7 @@ public class Internal extends AbsShareInterface { builder.getAnchorAvatar(), builder.getAnchorName(), builder.getAnchorId(), - "1", + builder.getShareType() + "", builder.getAnchorId() ), new OnSendMessageListener() { 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 75b16edc1..81fd55240 100644 --- a/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java +++ b/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java @@ -27,8 +27,8 @@ 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; + public static final int TYPE_LIVE = 1; + public static final int TYPE_DYNAMIC = 0; private ShareAppAdapter adapter; private RecyclerView list; private RoundedImageView avatar; diff --git a/common/src/main/java/com/yunbao/common/message/content/MessageChatCardContent.java b/common/src/main/java/com/yunbao/common/message/content/MessageChatCardContent.java index 138313281..1137d1d3d 100644 --- a/common/src/main/java/com/yunbao/common/message/content/MessageChatCardContent.java +++ b/common/src/main/java/com/yunbao/common/message/content/MessageChatCardContent.java @@ -6,6 +6,7 @@ import android.os.Parcelable; import androidx.annotation.NonNull; import com.yunbao.common.interfaces.OnSendMessageListener; +import com.yunbao.common.utils.ToastUtil; import org.json.JSONException; import org.json.JSONObject; @@ -14,6 +15,7 @@ import java.io.UnsupportedEncodingException; import io.rong.common.ParcelUtils; import io.rong.imkit.IMCenter; +import io.rong.imlib.IRongCallback; import io.rong.imlib.MessageTag; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; @@ -31,20 +33,29 @@ public class MessageChatCardContent extends MessageContent implements Parcelable private String extraData; public static void sendMessage(Conversation.ConversationType type, String targetId, MessageChatCardContent tipsContent, OnSendMessageListener listener) { - IMCenter.getInstance().insertOutgoingMessage(type, targetId, Message.SentStatus.SENT, tipsContent, System.currentTimeMillis(), new RongIMClient.ResultCallback() { + ToastUtil.show("发送给:"+targetId); + Message message=Message.obtain(targetId, type,tipsContent); + IMCenter.getInstance().sendMessage(message,null,null,new IRongCallback.ISendMessageCallback(){ + + @Override + public void onAttached(Message message) { + + } + @Override public void onSuccess(Message message) { + ToastUtil.show("发送成功"); if (listener != null) { listener.onSuccess(null, null); } } @Override - public void onError(RongIMClient.ErrorCode e) { + public void onError(Message message, RongIMClient.ErrorCode e) { + ToastUtil.show("发送失败:"+e.getMessage()); if (listener != null) { listener.onError(e.code, e.msg); } - } }); } 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 4a983c46a..161c2b19e 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1463,6 +1463,7 @@ public class LiveAudienceActivity extends LiveActivity { new SharePopDialog(mContext) .setShareType(SharePopDialog.TYPE_LIVE) .setShareData(ShareBean.ShareBuilder.create() + .setShareType(SharePopDialog.TYPE_LIVE) .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()) diff --git a/main/src/main/java/com/yunbao/main/adapter/MainConversationListAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainConversationListAdapter.java index 90a1d0f96..835ab895e 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainConversationListAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainConversationListAdapter.java @@ -2,6 +2,7 @@ package com.yunbao.main.adapter; import android.content.Context; import android.text.Html; +import android.text.SpannableString; import android.text.Spanned; import android.text.TextUtils; import android.util.Log; @@ -14,6 +15,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.message.content.MessageChatCardContent; import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.ListUtils; import com.yunbao.common.utils.StringUtil; @@ -30,6 +32,7 @@ import io.rong.imkit.conversationlist.model.BaseUiConversation; import io.rong.imkit.conversationlist.model.SingleConversation; import io.rong.imkit.utils.RouteUtils; import io.rong.imkit.widget.adapter.ViewHolder; +import io.rong.imlib.model.Conversation; public class MainConversationListAdapter extends ConversationListAdapter { public static final int TYPE_SEARCH_TITLE = 500; @@ -125,7 +128,14 @@ public class MainConversationListAdapter extends ConversationListAdapter { for (BaseUiConversation item : data) { BaseUiConversation cn = new SingleConversation(mContext, item.mCore); srcList.add(cn); + + if (item.mCore.getConversationType() == Conversation.ConversationType.PRIVATE) { + if (item.mCore.getLatestMessage() instanceof MessageChatCardContent) { + item.mConversationContent = new SpannableString(WordUtil.getNewString(R.string.activity_msg_chat_list_card)); + } + } } + super.setDataCollection(data); } diff --git a/main/src/main/res/values-zh/strings.xml b/main/src/main/res/values-zh/strings.xml index b2244e61f..552011a0a 100644 --- a/main/src/main/res/values-zh/strings.xml +++ b/main/src/main/res/values-zh/strings.xml @@ -73,4 +73,5 @@ 在线 离线 + [名片] \ 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 764d71f69..ec58876e5 100644 --- a/main/src/main/res/values/strings.xml +++ b/main/src/main/res/values/strings.xml @@ -73,4 +73,5 @@ Day Online Offline + [Card] From 3127a5faaf6fb1a6116269971ad70204e7d3e45d Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 19 Mar 2024 10:04:42 +0800 Subject: [PATCH 3/5] =?UTF-8?q?add=20=E6=B3=A8=E5=86=8C=E5=90=8E=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E8=B5=84=E6=96=99=E5=BC=95=E5=AF=BC=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shayu/phonelive/AppContext.java | 6 +- .../activity/CompleteUserInfoActivity.java | 64 ++++++++++++++++++- .../main/activity/RegisterActivity.java | 13 ++-- 3 files changed, 74 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index a05b83b02..dd2740281 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -62,6 +62,7 @@ import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.views.PortraitLiveManager; import com.yunbao.live.views.RecommendLiveRoomProvider; +import com.yunbao.main.activity.CompleteUserInfoActivity; import com.yunbao.main.activity.MainActivity; import com.yunbao.main.activity.MainHomeCommunityActivity; import com.yunbao.main.activity.MsgSettActivity; @@ -264,6 +265,9 @@ public class AppContext extends CommonAppContext { } else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息 EventBus.getDefault().post(message); + if(AppManager.getInstance().getLastActivity() instanceof CompleteUserInfoActivity){ + return false; + } MessageChatNotifyManager.getInstance().push(AppManager.getInstance().getLastActivity() , message.getTargetId(), content.getContent() @@ -362,9 +366,9 @@ public class AppContext extends CommonAppContext { activity.get().finish(); } } + setFirebaseCrashData(); Process.killProcess(Process.myPid()); System.exit(0); - setFirebaseCrashData(); new Handler(Looper.getMainLooper()).postDelayed(() -> { throw new RuntimeException(e); }, 100); diff --git a/main/src/main/java/com/yunbao/main/activity/CompleteUserInfoActivity.java b/main/src/main/java/com/yunbao/main/activity/CompleteUserInfoActivity.java index 243b7ccb8..38f3fc68e 100644 --- a/main/src/main/java/com/yunbao/main/activity/CompleteUserInfoActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/CompleteUserInfoActivity.java @@ -1,29 +1,38 @@ package com.yunbao.main.activity; import android.app.Dialog; +import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.Color; import android.os.Bundle; +import android.view.KeyEvent; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; +import com.alibaba.fastjson.JSON; import com.bigkoo.pickerview.builder.TimePickerBuilder; import com.bigkoo.pickerview.listener.OnTimeSelectListener; import com.bigkoo.pickerview.view.TimePickerView; import com.lxj.xpopup.XPopup; +import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.ImageResultCallback; import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.L; +import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.ProcessImageUtil; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ViewUtils; @@ -62,6 +71,19 @@ public class CompleteUserInfoActivity extends AbsActivity { initView(); } + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_ESCAPE || keyCode == KeyEvent.KEYCODE_BACK) { + //onBackPressed(); + return true; + } + return super.onKeyDown(keyCode, event); + } + + @Override + public void onBackPressed() { + // super.onBackPressed(); + } int year; int month; @@ -102,8 +124,15 @@ public class CompleteUserInfoActivity extends AbsActivity { new HttpCallback>() { @Override public void onSuccess(List data) { - ToastUtil.show("註冊成功"); - finish(); + String anchorId = getIntent().getStringExtra("anchor_id"); + if (StringUtil.isEmpty(anchorId)) { + Intent intent = new Intent(CompleteUserInfoActivity.this, MainActivity.class); + intent.putExtra(Constants.SHOW_INVITE, false); + startActivity(intent); + finish(); + } else { + gotoLive(anchorId); + } } @Override @@ -200,6 +229,7 @@ public class CompleteUserInfoActivity extends AbsActivity { } + void initSexView() { ViewUtils.findViewById(man, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_select); ViewUtils.findViewById(man, R.id.sex_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#00A3FF"))); @@ -237,4 +267,34 @@ public class CompleteUserInfoActivity extends AbsActivity { woman.setTag("man"); }); } + + private void gotoLive(final String live_id) { + LiveHttpUtil.getLiveInfo(live_id, new com.yunbao.common.http.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); + if (liveBean == null) { + return; + } + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + NoviceInstructorManager.get(mContext).setFrist(false); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + + + } else { + MainActivity.forward(CompleteUserInfoActivity.this, false); + } + } + }); + } } diff --git a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java index 11491f72a..de7274143 100644 --- a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java @@ -404,7 +404,7 @@ public class RegisterActivity extends AbsActivity { //获取自定义数据 if (appData.getData() != null && !appData.getData().equals("")) { JSONObject data = JSON.parseObject(appData.getData()); - if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2|| CommonAppConfig.IS_GOOGLE_PLAY == 3) { + if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2 || CommonAppConfig.IS_GOOGLE_PLAY == 3) { yqm_view.setVisibility(View.VISIBLE); MainHttpUtil.getDeviceLoginType(new HttpCallback() { @Override @@ -496,13 +496,13 @@ public class RegisterActivity extends AbsActivity { home_zdy_img_us = obj.getString("home_zdy_img_us"); home_zdy_img_cn = obj.getString("home_zdy_img_cn"); } - gotoLive(obj.getString("anchor_id")); + // gotoLive(obj.getString("anchor_id")); if (obj.containsKey("home_zdy_pop")) { NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop")); } - jumpMain(false); + jumpMain(false, obj.getString("anchor_id")); } else { - jumpMain(false); + jumpMain(false, null); } EventBus.getDefault().post(new RegSuccessEvent()); } @@ -510,9 +510,10 @@ public class RegisterActivity extends AbsActivity { } }; - private void jumpMain(boolean showInvite) { - Intent intent = new Intent(activity, MainActivity.class); + private void jumpMain(boolean showInvite, String anchorId) { + Intent intent = new Intent(activity, CompleteUserInfoActivity.class); intent.putExtra(Constants.SHOW_INVITE, showInvite); + intent.putExtra("anchor_id", anchorId); startActivity(intent); } From 938bee4fdb195387173bb3f5592862588140b5f1 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Wed, 20 Mar 2024 11:03:29 +0800 Subject: [PATCH 4/5] =?UTF-8?q?add=20=E7=BC=96=E8=BE=91=E8=B5=84=E6=96=99-?= =?UTF-8?q?=E8=81=8C=E4=B8=9A=E3=80=81=E8=BA=AB=E9=AB=98=E3=80=81=E7=88=B1?= =?UTF-8?q?=E5=A5=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/bean/CareerBean.java | 76 + .../com/yunbao/common/http/PDLiveApi.java | 21 + .../common/http/live/LiveNetManager.java | 97 +- .../main/res/layout/view_title_not_color.xml | 69 + common/src/main/res/values/style.xml | 7 + main/src/main/AndroidManifest.xml | 1 + .../main/activity/EditProfileActivity.java | 142 +- .../main/activity/EditUserHobbyActivity.java | 126 ++ .../main/adapter/EditUserHobbyAdapter.java | 86 ++ .../main/res/layout/activity_edit_profile.xml | 1324 ++++++++++------- .../res/layout/activity_edit_user_hobby.xml | 76 + .../main/res/layout/item_edit_user_hobby.xml | 15 + .../main/res/mipmap-xxhdpi/ic_edit_avatar.png | Bin 0 -> 1931 bytes .../res/mipmap-xxhdpi/ic_edit_birthday.png | Bin 0 -> 2382 bytes .../main/res/mipmap-xxhdpi/ic_edit_city.png | Bin 0 -> 2948 bytes .../main/res/mipmap-xxhdpi/ic_edit_height.png | Bin 0 -> 2482 bytes .../main/res/mipmap-xxhdpi/ic_edit_hobby.png | Bin 0 -> 2904 bytes .../main/res/mipmap-xxhdpi/ic_edit_name.png | Bin 0 -> 1832 bytes .../res/mipmap-xxhdpi/ic_edit_occupation.png | Bin 0 -> 2786 bytes .../main/res/mipmap-xxhdpi/ic_edit_phone.png | Bin 0 -> 909 bytes .../main/res/mipmap-xxhdpi/ic_edit_sex.png | Bin 0 -> 2554 bytes .../main/res/mipmap-xxhdpi/ic_edit_sign.png | Bin 0 -> 1895 bytes main/src/main/res/values-zh/strings.xml | 5 + main/src/main/res/values/strings.xml | 5 + 24 files changed, 1473 insertions(+), 577 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/bean/CareerBean.java create mode 100644 common/src/main/res/layout/view_title_not_color.xml create mode 100644 main/src/main/java/com/yunbao/main/activity/EditUserHobbyActivity.java create mode 100644 main/src/main/java/com/yunbao/main/adapter/EditUserHobbyAdapter.java create mode 100644 main/src/main/res/layout/activity_edit_user_hobby.xml create mode 100644 main/src/main/res/layout/item_edit_user_hobby.xml create mode 100644 main/src/main/res/mipmap-xxhdpi/ic_edit_avatar.png create mode 100644 main/src/main/res/mipmap-xxhdpi/ic_edit_birthday.png create mode 100644 main/src/main/res/mipmap-xxhdpi/ic_edit_city.png create mode 100644 main/src/main/res/mipmap-xxhdpi/ic_edit_height.png create mode 100644 main/src/main/res/mipmap-xxhdpi/ic_edit_hobby.png create mode 100644 main/src/main/res/mipmap-xxhdpi/ic_edit_name.png create mode 100644 main/src/main/res/mipmap-xxhdpi/ic_edit_occupation.png create mode 100644 main/src/main/res/mipmap-xxhdpi/ic_edit_phone.png create mode 100644 main/src/main/res/mipmap-xxhdpi/ic_edit_sex.png create mode 100644 main/src/main/res/mipmap-xxhdpi/ic_edit_sign.png diff --git a/common/src/main/java/com/yunbao/common/bean/CareerBean.java b/common/src/main/java/com/yunbao/common/bean/CareerBean.java new file mode 100644 index 000000000..405785447 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/CareerBean.java @@ -0,0 +1,76 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class CareerBean extends BaseModel { + int id; + int pid; + @SerializedName("cn_title") + String titleCn; + @SerializedName("en_title") + String titleEn; + @SerializedName("create_time") + long createTime; + @SerializedName("uplong_time") + long uplongTime; + @SerializedName("children") + List children; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getPid() { + return pid; + } + + public void setPid(int pid) { + this.pid = pid; + } + + public String getTitleCn() { + return titleCn; + } + + public void setTitleCn(String titleCn) { + this.titleCn = titleCn; + } + + public String getTitleEn() { + return titleEn; + } + + public void setTitleEn(String titleEn) { + this.titleEn = titleEn; + } + + public long getCreateTime() { + return createTime; + } + + public void setCreateTime(long createTime) { + this.createTime = createTime; + } + + public long getUplongTime() { + return uplongTime; + } + + public void setUplongTime(long uplongTime) { + this.uplongTime = uplongTime; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } +} diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 39a114f28..1f85509a1 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -10,6 +10,7 @@ import com.yunbao.common.bean.BattlePassPoints; import com.yunbao.common.bean.BattlePassTask; import com.yunbao.common.bean.BattlePassUserInfoBean; import com.yunbao.common.bean.BlindBoxInfoModel; +import com.yunbao.common.bean.CareerBean; import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.CheckRemainingBalance; import com.yunbao.common.bean.ContributeModel; @@ -1267,4 +1268,24 @@ public interface PDLiveApi { @GET("/api/public/?service=Pdluserhome.getUserHomeInfo") Observable> getUserHomeExhibitInfo(@Query("select_uid") String tuid); + @GET("/api/public/?service=Pdlinfos.getCareer") + Observable>> getCareer(); + + @GET("/api/public/?service=Pdlinfos.setCareer") + Observable>> setCareer( + @Query("career") String career, + @Query("en_career") String en + ); + + @GET("/api/public/?service=Pdlinfos.setHeight") + Observable>> setUserHeight( + @Query("height") String height + ); + + @GET("/api/public/?service=Pdllable.get") + Observable>> getHobby(); + @GET("/api/public/?service=Pdlinfos.setLabel") + Observable>> setHobby( + @Query("labels") String labelsId + ); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 512cf203b..8998844cb 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -15,6 +15,7 @@ import com.yunbao.common.bean.BattlePassPoints; import com.yunbao.common.bean.BattlePassTask; import com.yunbao.common.bean.BattlePassUserInfoBean; import com.yunbao.common.bean.BlindBoxInfoModel; +import com.yunbao.common.bean.CareerBean; import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.CheckRemainingBalance; import com.yunbao.common.bean.CoolConfig; @@ -3381,7 +3382,101 @@ public class LiveNetManager { } }).isDisposed(); } - + public void getCareer(HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .getCareer() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(roomMicStatusModelResponseModel -> { + if (callback != null) { + callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo()); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + public void setCareer(String career,String careerEn, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .setCareer(career,careerEn) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) { + callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg())); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + public void setUserHeight(String height, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .setUserHeight(height) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) { + callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg())); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + public void getHobby(HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .getHobby() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(roomMicStatusModelResponseModel -> { + if (callback != null) { + callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo()); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + public void setHobby(String ids, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .setHobby(ids) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) { + callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg())); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } private MultipartBody.Part createUploadFile(File file) { RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); return MultipartBody.Part.createFormData("file", file.getName(), requestBody); diff --git a/common/src/main/res/layout/view_title_not_color.xml b/common/src/main/res/layout/view_title_not_color.xml new file mode 100644 index 000000000..82f5bf9a9 --- /dev/null +++ b/common/src/main/res/layout/view_title_not_color.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + diff --git a/common/src/main/res/values/style.xml b/common/src/main/res/values/style.xml index c444de78d..0511f2543 100644 --- a/common/src/main/res/values/style.xml +++ b/common/src/main/res/values/style.xml @@ -98,6 +98,13 @@ 15dp @color/white +