直播间聊天框修改

This commit is contained in:
18401019693 2022-09-05 16:44:30 +08:00
parent 7281296d8e
commit a969abc2bf
3 changed files with 58 additions and 28 deletions

View File

@ -76,6 +76,15 @@ public class PDLIiveChatActivity extends FragmentActivity {
getWindow().setAttributes(lp); getWindow().setAttributes(lp);
setFinishOnTouchOutside(true);//允许点击空白处关闭 setFinishOnTouchOutside(true);//允许点击空白处关闭
//展示会话列表
conversationListFragment = new ConversationListFragment();
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.container, conversationListFragment);
transaction.commit();
//自定义空数据背景View
conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg);
} }
/** /**
@ -90,21 +99,21 @@ public class PDLIiveChatActivity extends FragmentActivity {
*/ */
private void initData() { private void initData() {
IMLoginManager.get(mContext).checkInstructor(); IMLoginManager.get(mContext).checkInstructor();
//获取系统消息列表 // //获取系统消息列表
ImHttpUtil.getImUserInfo("", new HttpCallback() { // ImHttpUtil.getImUserInfo("", new HttpCallback() {
@Override // @Override
public void onSuccess(int code, String msg, String[] info) { // public void onSuccess(int code, String msg, String[] info) {
if (code == 0) { // if (code == 0) {
container.post(new Runnable() { // container.post(new Runnable() {
@Override // @Override
public void run() { // public void run() {
List<ImUserBean> listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class); // List<ImUserBean> listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class);
addSystemMessagesView(listUserBean); // addSystemMessagesView(listUserBean);
} // }
}); // });
} // }
} // }
}); // });
//刷新列表内用户信息 //刷新列表内用户信息
addUserInfoProvider(); addUserInfoProvider();

View File

@ -1,24 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<TextView <androidx.cardview.widget.CardView
android:id="@+id/top_noback" android:id="@+id/top_card"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="18dp" app:cardBackgroundColor="@color/white"
android:text="@string/message" app:cardCornerRadius="8dp"
android:textColor="@color/black3" app:cardElevation="0dp">
android:textSize="24sp"
android:textStyle="bold" /> <TextView
android:id="@+id/top_noback"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:text="@string/message"
android:textColor="@color/black3"
android:textSize="24sp"
android:textStyle="bold" />
</androidx.cardview.widget.CardView>
<FrameLayout <FrameLayout
android:id="@+id/container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="400dp" android:layout_height="400dp"
android:layout_below="@id/top_card"
android:layout_marginTop="-10dp"
android:background="@color/white" android:background="@color/white"
android:paddingTop="10dp" /> android:paddingTop="10dp" />
</LinearLayout> </RelativeLayout>

View File

@ -36,6 +36,7 @@ import com.yunbao.common.bean.ImUserInfoModel;
import com.yunbao.common.custom.TabButtonGroup; import com.yunbao.common.custom.TabButtonGroup;
import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.event.UpdateTablePointMe; import com.yunbao.common.event.UpdateTablePointMe;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
@ -89,6 +90,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
private String type = null; private String type = null;
private List<ImUserBean> listUserBean = new ArrayList<>(); private List<ImUserBean> listUserBean = new ArrayList<>();
private LinearLayout topLayout; private LinearLayout topLayout;
private ImageView imgNewsNotice, imgNewsInteraction, imgNewsOnline;
@Override @Override
@ -169,6 +171,9 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
textNewsOnline = findViewById(R.id.text_news_online); textNewsOnline = findViewById(R.id.text_news_online);
newsIconClearance = findViewById(R.id.news_icon_clearance); newsIconClearance = findViewById(R.id.news_icon_clearance);
topLayout = findViewById(R.id.top_layout); topLayout = findViewById(R.id.top_layout);
imgNewsNotice = findViewById(R.id.img_news_notice);
imgNewsInteraction = findViewById(R.id.img_news_interaction);
imgNewsOnline = findViewById(R.id.img_news_online);
mTabButtonGroup.setCurPosition(2); mTabButtonGroup.setCurPosition(2);
findViewById(R.id.btn_start).setOnClickListener(v -> { findViewById(R.id.btn_start).setOnClickListener(v -> {
//防止重新加载多个 //防止重新加载多个
@ -256,7 +261,8 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
textNewsNotice.setVisibility(View.VISIBLE); textNewsNotice.setVisibility(View.VISIBLE);
textNewsNotice.setText(userBean.getNum()); textNewsNotice.setText(userBean.getNum());
} }
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.img_news_notice), () -> { ImgLoader.display(mContext, userBean.getImage(), imgNewsNotice);
ViewClicksAntiShake.clicksAntiShake(imgNewsNotice, () -> {
type = userBean.getType(); type = userBean.getType();
netHandler.post(systemNumberRunnable); netHandler.post(systemNumberRunnable);
startActivity(new Intent(mContext, SystemMessageActivity.class) startActivity(new Intent(mContext, SystemMessageActivity.class)
@ -274,7 +280,8 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
textNewsInteraction.setVisibility(View.VISIBLE); textNewsInteraction.setVisibility(View.VISIBLE);
textNewsInteraction.setText(userBean.getNum()); textNewsInteraction.setText(userBean.getNum());
} }
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.img_news_interaction), () -> { ImgLoader.display(mContext, userBean.getImage(), imgNewsInteraction);
ViewClicksAntiShake.clicksAntiShake(imgNewsInteraction, () -> {
type = userBean.getType(); type = userBean.getType();
netHandler.post(systemNumberRunnable); netHandler.post(systemNumberRunnable);
startActivity(new Intent(mContext, SystemMessageActivity.class) startActivity(new Intent(mContext, SystemMessageActivity.class)
@ -292,7 +299,8 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
textNewsOnline.setVisibility(View.VISIBLE); textNewsOnline.setVisibility(View.VISIBLE);
textNewsOnline.setText(userBean.getNum()); textNewsOnline.setText(userBean.getNum());
} }
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.img_news_online), () -> { ImgLoader.display(mContext, userBean.getImage(), imgNewsOnline);
ViewClicksAntiShake.clicksAntiShake(imgNewsOnline, () -> {
type = userBean.getType(); type = userBean.getType();
netHandler.post(systemNumberRunnable); netHandler.post(systemNumberRunnable);
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null); FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);