From 5bcbe7cd9a769bf0da5f631ffbc0c8b1df44e18d Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 5 Sep 2022 16:49:10 +0800 Subject: [PATCH] =?UTF-8?q?add:=E7=9B=B4=E6=92=AD=E9=97=B4=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=A7=81=E4=BF=A1=E6=82=AC=E6=B5=AE=E7=AA=97=20update?= =?UTF-8?q?:=E4=BC=9A=E8=AF=9D=E9=A1=B5=E9=9D=A2=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=8D=8A=E5=B1=8F=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shayu/phonelive/AppContext.java | 5 + .../yunbao/common/activity/AbsActivity.java | 12 +- live/src/main/AndroidManifest.xml | 1 + .../yunbao/live/activity/LiveActivity.java | 9 + .../activity/MyConversationListFragment.java | 54 ++++++ .../live/activity/PDLIiveChatActivity.java | 50 ++++-- .../activity/PDLiveConversationActivity.java | 59 +++++- .../dialog/LiveUserMoreDialogFragment.java | 4 - .../yunbao/live/views/LiveRoomViewHolder.java | 169 +++++++++++++++++- .../live/views/SystemMessageViewHolder.java | 1 + live/src/main/res/anim/view_room_msg_in.xml | 18 ++ live/src/main/res/anim/view_room_msg_out.xml | 18 ++ .../main/res/drawable/bg_live_room_msg.xml | 9 + .../main/res/drawable/bg_room_msg_unread.xml | 10 ++ .../main/res/layout/activity_conversation.xml | 13 +- .../main/res/layout/view_live_chat_dialog.xml | 41 +++++ live/src/main/res/layout/view_live_room.xml | 84 ++++++++- .../res/mipmap-mdpi/icon_live_room_msg.png | Bin 0 -> 2013 bytes live/src/main/res/values-en/strings.xml | 1 + live/src/main/res/values/strings.xml | 1 + live/src/main/res/values/style.xml | 12 ++ .../ConversationIMListManager.java | 9 +- 22 files changed, 542 insertions(+), 38 deletions(-) create mode 100644 live/src/main/java/com/yunbao/live/activity/MyConversationListFragment.java create mode 100644 live/src/main/res/anim/view_room_msg_in.xml create mode 100644 live/src/main/res/anim/view_room_msg_out.xml create mode 100644 live/src/main/res/drawable/bg_live_room_msg.xml create mode 100644 live/src/main/res/drawable/bg_room_msg_unread.xml create mode 100644 live/src/main/res/layout/view_live_chat_dialog.xml create mode 100644 live/src/main/res/mipmap-mdpi/icon_live_room_msg.png diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index a8375fc82..c9bfb737c 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -40,12 +40,15 @@ import java.io.File; import java.io.IOException; import io.rong.imlib.RongIMClient; +import io.rong.imlib.model.Conversation; import io.rong.message.TextMessage; import io.rong.push.RongPushClient; import io.rong.push.pushconfig.PushConfig; import static com.yunbao.live.socket.SocketClient.mSocketHandler; +import org.greenrobot.eventbus.EventBus; + //import cn.tillusory.sdk.TiSDK; //import com.squareup.leakcanary.LeakCanary; @@ -185,6 +188,8 @@ public class AppContext extends CommonAppContext { if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketRyClient.mSocketHandler != null) { SocketRyClient.mSocketHandler.sendMessage(msg); } + }else if(message.getConversationType()== Conversation.ConversationType.PRIVATE){//私聊信息 + EventBus.getDefault().post(message); } } } catch (Exception e) { diff --git a/common/src/main/java/com/yunbao/common/activity/AbsActivity.java b/common/src/main/java/com/yunbao/common/activity/AbsActivity.java index aa49fd96f..73ff1f34d 100644 --- a/common/src/main/java/com/yunbao/common/activity/AbsActivity.java +++ b/common/src/main/java/com/yunbao/common/activity/AbsActivity.java @@ -2,6 +2,7 @@ package com.yunbao.common.activity; import android.app.Activity; import android.content.Context; +import android.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Rect; @@ -52,10 +53,13 @@ public abstract class AbsActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - isFullWindow=getIntent().getBooleanExtra("isFull",false); - if(isFullWindow){ - getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); + Intent intent=getIntent(); + if(intent!=null) { + isFullWindow = getIntent().getBooleanExtra("isFull", false); + if (isFullWindow) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); + } } super.onCreate(savedInstanceState); mTag = this.getClass().getSimpleName(); diff --git a/live/src/main/AndroidManifest.xml b/live/src/main/AndroidManifest.xml index 263ecc166..65847c0d8 100644 --- a/live/src/main/AndroidManifest.xml +++ b/live/src/main/AndroidManifest.xml @@ -85,6 +85,7 @@ android:name=".activity.PDLiveConversationActivity" android:hardwareAccelerated="true" android:screenOrientation="portrait" + android:theme="@style/DialogNotTitleActivity" android:windowSoftInputMode="stateAlwaysHidden|adjustResize"/> = 0) { + BaseUiConversation baseUiConversation = (BaseUiConversation)this.mAdapter.getItem(position); + ConversationListBehaviorListener listBehaviorListener = RongConfigCenter.conversationListConfig().getListener(); + view.setTag(bundle); + if (listBehaviorListener != null && listBehaviorListener.onConversationClick(view.getContext(), view, baseUiConversation)) { + RLog.d(this.TAG, "ConversationList item click event has been intercepted by App."); + } else { + if (baseUiConversation != null && baseUiConversation.mCore != null) { + if (baseUiConversation instanceof GatheredConversation) { + RouteUtils.routeToSubConversationListActivity(view.getContext(), + ((GatheredConversation)baseUiConversation).mGatheredType, + baseUiConversation.mCore.getConversationTitle()); + } else { + RouteUtils.routeToConversationActivity(view.getContext(), + baseUiConversation.mCore.getConversationType(), + baseUiConversation.mCore.getTargetId(),bundle); + } + } else { + RLog.e(this.TAG, "invalid conversation."); + } + + } + view.setTag(null); + } + } +} diff --git a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java index fd810069a..190848f67 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java @@ -1,5 +1,6 @@ package com.yunbao.live.activity; +import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; @@ -25,12 +26,14 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.InstructorRemarkManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager; +import com.yunbao.common.utils.DpUtil; import com.yunbao.live.R; import com.yunbao.live.adapter.SystemChatMessageAdapter; import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.http.ImHttpUtil; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -43,9 +46,11 @@ import io.rong.imlib.model.UserInfo; * 直播页面聊天列表 */ public class PDLIiveChatActivity extends FragmentActivity { - private ConversationListFragment conversationListFragment; + private MyConversationListFragment conversationListFragment; private FrameLayout container; private PDLIiveChatActivity mContext; + private boolean isGetSystemMsg=true;//是否展示系统消息,默认为true + private boolean isDialogWindow=false;//是否为半屏展示,默认为false @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -53,6 +58,14 @@ public class PDLIiveChatActivity extends FragmentActivity { requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_pd_chat); mContext = this; + Intent intent = getIntent(); + if(intent!=null) { + isGetSystemMsg =intent.getBooleanExtra("systemMsg",true); + isDialogWindow =intent.getBooleanExtra("dialogWindow",false); + }else{ + isGetSystemMsg=true; + isDialogWindow=false; + } windowColor(); initView(); initData(); @@ -91,20 +104,24 @@ public class PDLIiveChatActivity extends FragmentActivity { private void initData() { IMLoginManager.get(mContext).checkInstructor(); //获取系统消息列表 - ImHttpUtil.getImUserInfo("", new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - container.post(new Runnable() { - @Override - public void run() { - List listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class); - addSystemMessagesView(listUserBean); - } - }); + if(isGetSystemMsg) { + ImHttpUtil.getImUserInfo("", new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + container.post(new Runnable() { + @Override + public void run() { + List listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class); + addSystemMessagesView(listUserBean); + } + }); + } } - } - }); + }); + }else{ + addSystemMessagesView(new ArrayList<>()); + } //刷新列表内用户信息 addUserInfoProvider(); @@ -121,7 +138,10 @@ public class PDLIiveChatActivity extends FragmentActivity { //倒序展示 Collections.reverse(listUserBean); //展示会话列表 - conversationListFragment = new ConversationListFragment(); + conversationListFragment = new MyConversationListFragment(); + Bundle bundle=new Bundle(); + bundle.putBoolean("dialogWindow",isDialogWindow); + conversationListFragment.setBundle(bundle); FragmentManager manager = getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(R.id.container, conversationListFragment); diff --git a/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java index 883cac258..d058fae4e 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java @@ -6,10 +6,15 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.text.TextUtils; import android.util.Log; +import android.view.Gravity; import android.view.View; +import android.view.ViewGroup; +import android.view.Window; import android.view.WindowManager; +import android.view.animation.AnimationUtils; import android.view.inputmethod.InputMethodManager; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.TextView; import androidx.core.app.ActivityCompat; @@ -32,7 +37,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager; -import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.DpUtil; import com.yunbao.live.R; import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.dialog.MenuPopuwWindow; @@ -48,16 +53,10 @@ import org.greenrobot.eventbus.ThreadMode; import java.util.ArrayList; import io.rong.imkit.IMCenter; -import io.rong.imkit.model.ResultCallback; import io.rong.imkit.userinfo.RongUserInfoManager; -import io.rong.imkit.userinfo.UserDataProvider; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; import io.rong.imlib.model.UserInfo; -import okhttp3.internal.http2.ErrorCode; - -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; /** * 聊天会话界面 @@ -74,6 +73,8 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl private final int SELECT_IMAGE_REQUEST = 0x0001; private ArrayList mSelectImages = new ArrayList<>(); private String targetId = ""; + private LinearLayout mRootLayout; + private boolean isDialogWindow=true; @Override @@ -87,6 +88,11 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl EventBus.getDefault().register(this); mContext = this; getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); + Intent intent = getIntent(); + if(intent!=null){ + isDialogWindow=intent.getBooleanExtra("dialogWindow",false); + } + configWindow(); initView(); initData(); WindowSoftModeAdjustResizeExecutor.assistActivity(this); @@ -94,6 +100,42 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl MessageIMManager.get(this).addConversationClickListener(); } + /** + * 配置窗口参数 + */ + public void configWindow() { + + Window window = getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(getResources().getColor(R.color.transparent)); + + getWindow().setGravity(Gravity.BOTTOM);//设置显示在底部 默认在中间 + WindowManager.LayoutParams lp = getWindow().getAttributes(); + lp.width = WindowManager.LayoutParams.MATCH_PARENT;//设置宽度满屏 + if(isDialogWindow) { + lp.height = WindowManager.LayoutParams.WRAP_CONTENT; + }else{ + lp.height = WindowManager.LayoutParams.MATCH_PARENT; + } + getWindow().setAttributes(lp); + setFinishOnTouchOutside(true);//允许点击空白处关闭 + + } + + /** + * ui展示后再调整大小 + */ + @Override + public void onWindowFocusChanged(boolean hasFocus) { + super.onWindowFocusChanged(hasFocus); + if(hasFocus&&isDialogWindow){ + ViewGroup.LayoutParams params = mRootLayout.getLayoutParams(); + params.height= DpUtil.dp2px(400); + mRootLayout.setLayoutParams(params); + } + } + + /** * 数据的设置 */ @@ -157,6 +199,9 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl titleView = findViewById(R.id.titleView); imgMore = findViewById(R.id.img_more); imBack = findViewById(R.id.btn_back); + mRootLayout = findViewById(R.id.root_layout); + //来个底部弹出的动画,不然太突兀了 + mRootLayout.startAnimation(AnimationUtils.loadAnimation(mContext,R.anim.bottomview_anim_enter)); imgMore.setOnClickListener(this); imBack.setOnClickListener(this); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java index 07bc7db60..0d8a630d0 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java @@ -310,12 +310,8 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie } for (Object o : rank) { JSONObject item= (JSONObject) o; - UserBean.DressBean dressBean=new UserBean.DressBean(); - dressBean.setAvatar_frame(item.getString("dressHead")); - dressBean.setMedal(""); LiveUserRankBean bean=JSON.parseObject(item.getString("userinfo"),LiveUserRankBean.class); bean.setTotal(item.getLong("total")); - bean.setDress(dressBean); data.add(bean); } if(data.size()==0){ diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 3ad320a14..05b49a105 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -16,6 +16,8 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.view.WindowManager; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; @@ -24,6 +26,7 @@ import android.widget.TextView; import android.widget.ViewFlipper; import androidx.annotation.Nullable; +import androidx.constraintlayout.widget.ConstraintLayout; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -119,6 +122,10 @@ import java.util.List; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; +import io.rong.imkit.userinfo.RongUserInfoManager; +import io.rong.imlib.RongIMClient; +import io.rong.imlib.model.Conversation; +import io.rong.imlib.model.UserInfo; import pl.droidsonroids.gif.GifImageView; import static com.yunbao.common.CommonAppContext.logger; @@ -260,6 +267,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private ViewFlipper wishListFlipper; private List wishlist = new ArrayList<>(); private TextView mHourRank, mHotText; + private LinearLayout msg; //默认悬浮窗布局 + private View msg2; //悬浮窗来私信的布局 + private ConstraintLayout msgLayout; //悬浮窗 + private TextView msgNumber;//悬浮窗左上角数标 + private RoundedImageView msgUserIcon; //悬浮窗icon public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); @@ -635,6 +647,14 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mic_ico2 = (RoundedImageView) findViewById(R.id.mic_ico2); dr_pk_end_gif = (GifImageView) findViewById(R.id.dr_pk_end_gif); + msg = (LinearLayout) findViewById(R.id.room_msg); + msg2 = (View) findViewById(R.id.room_msg_user); + msgNumber = (TextView) findViewById(R.id.room_msg_num); + msgUserIcon = (RoundedImageView) findViewById(R.id.room_msg_user_icon); + msgLayout= (ConstraintLayout) findViewById(R.id.room_msg_layout); + ViewClicksAntiShake.clicksAntiShake(msg, this::openChatWindow); + ViewClicksAntiShake.clicksAntiShake(msg2, this::openChatWindow); + mHandler = new Handler() { @Override public void handleMessage(Message msg) { @@ -712,11 +732,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis gif_view = (LinearLayout) findViewById(R.id.gif_view); chat_view = (RelativeLayout) findViewById(R.id.chat_view); + int topMargin=mScreenWdith * 720 / 960 + 210; RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) chat_view.getLayoutParams(); - params.topMargin = mScreenWdith * 720 / 960 + 210; + params.topMargin = topMargin; chat_view.setLayoutParams(params); + + RelativeLayout.LayoutParams msgLayoutLayoutParams = (RelativeLayout.LayoutParams) msgLayout.getLayoutParams(); + msgLayoutLayoutParams.topMargin=topMargin+DpUtil.dp2px(50); + msgLayout.setLayoutParams(msgLayoutLayoutParams); + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) mChatRecyclerView.getLayoutParams(); params1.topMargin = 180; @@ -945,16 +971,28 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }) .start(); } + reloadIM(); } + /** + * 刷新UI + */ + @Override + public void onResume() { + super.onResume(); + changeMsgView(msg2,msg); + reloadIM(); + } + + public void setLiveUid(String liveUid) { mLiveUid = liveUid; LiveHttpUtil.geteEvent(mLiveUid, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && imgEvent != null) { - for (int i = 0; i < info.length; i++) { - JSONObject obj = JSONObject.parseObject(info[i]); + for (String s : info) { + JSONObject obj = JSONObject.parseObject(s); if (obj.getString("is_hidden").equals("0")) { BannerBean bannerBean = new BannerBean(); bannerBean.setImageUrl(obj.getString("img")); @@ -1637,10 +1675,135 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } else if (i == R.id.user_guard) { // ((LiveActivity) mContext).openUserMoreListWindow(2, true); ((LiveActivity) mContext).openNewGuardListWindow(); + } else if (i==R.id.room_msg){ + changeMsgView(msg,msg2); + }else if (i==R.id.room_msg_user){ + changeMsgView(msg2,msg); } } + /** + * 私信的切换动画 + * @param out 隐去的view + * @param in 展示的view + */ + private void changeMsgView(View out,View in){ + if(in.getVisibility()==View.VISIBLE){ + return; + } + Animation animation= AnimationUtils.loadAnimation(mContext,R.anim.view_room_msg_out); + animation.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + out.setVisibility(View.GONE); + + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + out.startAnimation(animation); + Animation start=AnimationUtils.loadAnimation(mContext,R.anim.view_room_msg_in); + start.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + in.setVisibility(View.VISIBLE); + } + + @Override + public void onAnimationEnd(Animation animation) { + + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + in.startAnimation(start); + } + + /** + * 从右侧私聊悬浮窗打开私聊界面 + */ + private void openChatWindow(){ + /*LiveChatListDialogFragment chat=new LiveChatListDialogFragment(); + chat.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoomChatDialogFragment");*/ + Bundle bundle=new Bundle(); + bundle.putBoolean("systemMsg",false); + bundle.putBoolean("dialogWindow",true); + ((LiveActivity) mContext).openChatListWindow(bundle); + + } + + /** + * 更新左上角数标 + * @param number 数字 + */ + public void onMessageIMEvent(int number) { + String num=""; + if(number!=0){ + changeMsgView(msg,msg2); + if(number>99){ + num="99+"; + }else{ + num=number+""; + } + msgNumber.setText(num); + } + } + + /** + * 刷新im消息,以便更新私信悬浮窗UI + */ + public void reloadIM(){ + RongIMClient.getInstance().getConversationListByPage(new RongIMClient.ResultCallback>() { + @Override + public void onSuccess(List conversations) { + if(!conversations.isEmpty()){ + Conversation conversation = conversations.get(0); + UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(conversation.getTargetId()); + if(userInfo!=null){ + ImgLoader.display(mContext,userInfo.getPortraitUri().toString(),msgUserIcon); + } + } + } + + @Override + public void onError(RongIMClient.ErrorCode errorCode) { + Log.e("IM","IM会话获取失败 = "+errorCode); + + } + },0,10, Conversation.ConversationType.PRIVATE); + RongIMClient.getInstance().getUnreadCount(new Conversation.ConversationType[]{Conversation.ConversationType.PRIVATE},true,new RongIMClient.ResultCallback() { + @Override + public void onSuccess(Integer integer) { + onMessageIMEvent(integer); + + } + + @Override + public void onError(RongIMClient.ErrorCode errorCode) { + + } + }); + } + + /** + * 私信来消息了,刷新悬浮窗UI + */ + @Subscribe(threadMode = ThreadMode.MAIN) + public void sendMessage(io.rong.imlib.model.Message bean){ + reloadIM(); + } /** * 关注主播 */ diff --git a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java index 915c7a8e6..bd0e195e1 100644 --- a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java @@ -292,6 +292,7 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli @Override public void onSuccess(List messages) { Collections.reverse(messages); + EventBus.getDefault().post(messages); if (messages.size() > 0) { if (messages.size() < 20) { moretext = false; diff --git a/live/src/main/res/anim/view_room_msg_in.xml b/live/src/main/res/anim/view_room_msg_in.xml new file mode 100644 index 000000000..0b9802a1d --- /dev/null +++ b/live/src/main/res/anim/view_room_msg_in.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/live/src/main/res/anim/view_room_msg_out.xml b/live/src/main/res/anim/view_room_msg_out.xml new file mode 100644 index 000000000..d115bbd27 --- /dev/null +++ b/live/src/main/res/anim/view_room_msg_out.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/live/src/main/res/drawable/bg_live_room_msg.xml b/live/src/main/res/drawable/bg_live_room_msg.xml new file mode 100644 index 000000000..2bcf36265 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_room_msg.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_room_msg_unread.xml b/live/src/main/res/drawable/bg_room_msg_unread.xml new file mode 100644 index 000000000..669f224c4 --- /dev/null +++ b/live/src/main/res/drawable/bg_room_msg_unread.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/activity_conversation.xml b/live/src/main/res/layout/activity_conversation.xml index 6b8cbda9f..54f2625a2 100644 --- a/live/src/main/res/layout/activity_conversation.xml +++ b/live/src/main/res/layout/activity_conversation.xml @@ -20,8 +20,15 @@ android:layout_height="0.5dp" android:background="@color/gray3" /> - + + android:background="@color/white" + android:layout_height="wrap_content"> + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_chat_dialog.xml b/live/src/main/res/layout/view_live_chat_dialog.xml new file mode 100644 index 000000000..f40e28358 --- /dev/null +++ b/live/src/main/res/layout/view_live_chat_dialog.xml @@ -0,0 +1,41 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index e71f357c1..f8568dce7 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -10,8 +10,9 @@ android:paddingTop="15dp"> @@ -693,6 +694,87 @@ android:src="@mipmap/icon_red_pack_4" android:visibility="invisible" /> + + + + + + + + + + + + + + + + + + + Px+mq|oHRA@uZnF*-nWf{hwC$rqLOf#3%+)A@@0~56nEg^70BeV>cQd1jy|B>kt9Sy|HRlGc~Bk)+ki_z$%lz+NA&h|IA4Q|Wk8Z|O4_e-`rS$c^8Qgt zg#K}UxBbsyUYcYrNuQOpi6l~y-$^N=^TDc_t8HI9XurM&B%u&bl(bnXO$sb8=|xEw zO1j^6iIkg(b-zk_a%Ko(tj%jG3IZQPPI(~=qckGkmQq+&X9z+*o?J!>6&3Y zvpCjNr1!0cfU~G4qI$gTfA!k4rvXXu#A%W?D31_UTHpD$X@4V=B(&onR!b&biTG2J zPOwen$4Hj}Nj@s+=he^gJcV_Gqzi0QtRt5s6!#A#?JkLiK_oaojmDyia-^i)ByqlA#NCq4w2e^<{_ABEVngs0sxx!Jb z9T!bj3V*s%_?|)0PeLd9PC5KZ445qmfc`+)$9YVAg z*gl}Wwmg4ci_AA`?*rYoF-#Iz8EfGj4OC%Yh|y2_ME6UQNF$ogyBGlL!2?79^6;k) zrSSem#gf{Om^gf|9fjh{N7Y{KwRE?`Y||tbN)iSFziQFW=F#htjv9~MCD{>2mjQ2M z096hCCknr|ePf3K5SuH8%! zC@Hi61I}(0=kINw-y?;fgwz0%Gew++c(Bt=2-D!{OvZnsG~x6LPN?K#ExNTFtu z@n_qo_DLbg&K~uA9tHp-INji)PuQja$4HVjieP}5kcW%lywqbYhH_%!VfK80-rb8$ zC81MM#B@Q{-U%YM&4i<;B!Qdo4l-sA2JBQojxWJ>K%rgXE0(lq($GAA ztQX!=`MONOiGmSO%w0-((s+8q2llC4O@nD@Fm-iZV*qnb zx(B&Mca|IJ(HgZ-tDM-+FCz6xzAK5L5+@vK#qodBs1+M#|3b{PY#I$` z48ygH`EKV_f@0=Sqla^#oH*)1)*u6tY+f9I5hRV~CEK*=h0Viewers Guard Fans + News \ No newline at end of file diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml index 6174a9171..7f282c6f6 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -11,4 +11,5 @@ 觀眾 觀眾 粉絲 + 私信 diff --git a/live/src/main/res/values/style.xml b/live/src/main/res/values/style.xml index 60e586ccc..d3a58fc54 100644 --- a/live/src/main/res/values/style.xml +++ b/live/src/main/res/values/style.xml @@ -10,4 +10,16 @@ 0.3 false + \ No newline at end of file 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 c6b14e4a0..9a5850d2b 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 @@ -48,6 +48,7 @@ import io.rong.sight.SightExtensionModule; public class ConversationIMListManager { private static ConversationIMListManager manager; private Context mContext; + private Bundle bundle;//用户传输配置给会话界面 private ConversationIMListManager(Context context) { mContext = context; @@ -172,7 +173,7 @@ public class ConversationIMListManager { if (null != userInfo){ context.runOnUiThread(() -> { Conversation.ConversationType type = Conversation.ConversationType.PRIVATE; - RouteUtils.routeToConversationActivity(context, type, userId, null); + RouteUtils.routeToConversationActivity(context, type, userId, bundle); }); }else { CommonHttpUtil.getUserBaseinfo(userId, new HttpCallback() { @@ -246,6 +247,12 @@ public class ConversationIMListManager { */ @Override public boolean onConversationClick(Context context, View view, BaseUiConversation baseUiConversation) { + Object tag = view.getTag(); + if(tag!=null){ + bundle= (Bundle) tag; + }else{ + bundle=null; + } ViewClicksAntiShake.clicksAntiShake(view, () -> jumpConversation((Activity) context, baseUiConversation.mCore.getTargetId())); return true; }