开始画房间页面功能
This commit is contained in:
1
moduleroom/.gitignore
vendored
Normal file
1
moduleroom/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
54
moduleroom/build.gradle
Normal file
54
moduleroom/build.gradle
Normal file
@@ -0,0 +1,54 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.library)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.example.moduleroom'
|
||||
compileSdk 35
|
||||
|
||||
defaultConfig {
|
||||
minSdk 24
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
dataBinding {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation libs.appcompat
|
||||
implementation libs.material
|
||||
implementation libs.activity
|
||||
implementation libs.constraintlayout
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
androidTestImplementation libs.espresso.core
|
||||
|
||||
implementation project(':moduleUtil')
|
||||
|
||||
implementation 'com.alibaba:arouter-api:1.5.2'
|
||||
//annotationProcessor
|
||||
annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'
|
||||
}
|
||||
apply plugin: 'com.alibaba.arouter' // ⚠️ 添加这一行
|
||||
0
moduleroom/consumer-rules.pro
Normal file
0
moduleroom/consumer-rules.pro
Normal file
21
moduleroom/proguard-rules.pro
vendored
Normal file
21
moduleroom/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -1,4 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.moduleroom">
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name=".activity.RoomActivity"
|
||||
android:exported="false"
|
||||
android:launchMode="singleInstance"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/BaseAppTheme"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.example.moduleroom.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RoomContacts;
|
||||
import com.example.moduleroom.databinding.ActivityRoomBinding;
|
||||
import com.example.moduleroom.fragment.RoomFragment;
|
||||
import com.example.moduleroom.presenter.RoomPresenter;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.adapter.CommonPageAdapter;
|
||||
import com.qxcm.moduleutil.utils.ARouteConstants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Route(path = ARouteConstants.ROOM_DETAILS)
|
||||
public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBinding> implements RoomContacts.View {
|
||||
|
||||
private RoomFragment roomFragment;
|
||||
CommonPageAdapter commonPageAdapter;
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
|
||||
List<Fragment> fragments = new ArrayList<>();
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
// fragments.add(RoomOnlineFragment.newInstance(resp));
|
||||
fragments.add(roomFragment);
|
||||
// fragments.add(RoomRankingFragment.newInstance(roomId));
|
||||
commonPageAdapter = new CommonPageAdapter(getSupportFragmentManager(), fragments);
|
||||
mBinding.vpRoomPager.setAdapter(commonPageAdapter);
|
||||
mBinding.vpRoomPager.setCurrentItem(0);
|
||||
if (commonPageAdapter != null && commonPageAdapter.getCount() < 3) {
|
||||
// commonPageAdapter.addPage(0, RoomOnlineFragment.newInstance(roomId));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_room;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected RoomPresenter bindPresenter() {
|
||||
return new RoomPresenter(this, this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
|
||||
|
||||
public final class PublicScreenEaseChatContacts {
|
||||
|
||||
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
}
|
||||
|
||||
public interface IPublicScreenEaseChatPre extends IPresenter {
|
||||
void logEmchat(int code,String msg,String toChatUsername);
|
||||
|
||||
void switchPublicScreen(String room_id,String status);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
|
||||
public class RoomContacts {
|
||||
public interface View extends IView<Activity> {}
|
||||
public interface IRoomPre extends IPresenter {}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
|
||||
public class SingSongContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
}
|
||||
|
||||
public interface IEmotionRoomPre extends IPresenter {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,729 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.blankj.utilcode.util.ThreadUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.PublicScreenEaseChatContacts;
|
||||
import com.example.moduleroom.databinding.RoomFragementTransEaseChatBinding;
|
||||
import com.example.moduleroom.presenter.PublicScreenEaseChatPresenter;
|
||||
import com.qxcm.moduleutil.base.BaseMvpFragment;
|
||||
import com.qxcm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.qxcm.moduleutil.utils.logger.Logger;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEaseChatPresenter, RoomFragementTransEaseChatBinding>
|
||||
implements EMValueCallBack<EMChatRoom>, EMMessageListener, PublicScreenEaseChatContacts.View, EMConnectionListener {
|
||||
|
||||
private final static String TAG = "聊天室";
|
||||
|
||||
private boolean isBottom = true;
|
||||
private int count = 0;
|
||||
|
||||
private String toChatUsername;
|
||||
private EMConversation conversation;
|
||||
|
||||
private RoomInfoResp roomInfoResp;
|
||||
private EaseChatAdapter easeChatAdapter;
|
||||
private CountDownTimer countDownTimer;
|
||||
// private List<LuckyRankBean> oldList = new ArrayList<>();
|
||||
private static final int queueMessageNum = 20;//浇水礼物推送队列最大数
|
||||
// private RoomWinningRecordDialogFragment recordDialogFragment;
|
||||
|
||||
public static PublicScreenEaseChatFragment newInstance(RoomInfoResp roomInfoResp) {
|
||||
PublicScreenEaseChatFragment transEaseChatFragment = new PublicScreenEaseChatFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(EaseConstant.EXTRA_USER_ID, roomInfoResp);
|
||||
transEaseChatFragment.setArguments(bundle);
|
||||
return transEaseChatFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PublicScreenEaseChatPresenter bindPresenter() {
|
||||
return new PublicScreenEaseChatPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
roomInfoResp = (RoomInfoResp) arguments.getSerializable(EaseConstant.EXTRA_USER_ID);
|
||||
toChatUsername = roomInfoResp.getRoom_info().getChatrooms();
|
||||
Logger.e(TAG, "toChatUsername:" + toChatUsername);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
EMClient.getInstance().chatManager().addMessageListener(this);
|
||||
EMClient.getInstance().addConnectionListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
mBinding.recycleView.removeCallbacks(joinChatRoomTask);
|
||||
EMClient.getInstance().chatroomManager().leaveChatRoom(toChatUsername);
|
||||
EMClient.getInstance().removeConnectionListener(this);
|
||||
EMClient.getInstance().chatManager().removeMessageListener(this);
|
||||
EventBus.getDefault().unregister(this);
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
}
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
onChatRoomViewCreation();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initListener() {
|
||||
mBinding.recycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
//屏幕中最后一个可见子项的position
|
||||
int lastVisibleItemPosition = layoutManager.findLastVisibleItemPosition();
|
||||
//当前屏幕所看到的子项个数
|
||||
int visibleItemCount = layoutManager.getChildCount();
|
||||
//当前RecyclerView的所有子项个数
|
||||
int totalItemCount = layoutManager.getItemCount();
|
||||
//RecyclerView的滑动状态
|
||||
if (visibleItemCount > 0 && lastVisibleItemPosition == totalItemCount - 1) {
|
||||
if (mBinding.tvCount != null) {
|
||||
mBinding.tvCount.setVisibility(View.GONE);
|
||||
}
|
||||
isBottom = true;
|
||||
count = 0;
|
||||
} else {
|
||||
isBottom = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
||||
mBinding.recycleView.setLayoutManager(linearLayoutManager);
|
||||
mBinding.recycleView.setAdapter(easeChatAdapter = new EaseChatAdapter());
|
||||
easeChatAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
EMMessageInfo item = easeChatAdapter.getItem(position);
|
||||
if (view.getId() == R.id.tv_red_rain_detail) { //点击红包结果详情
|
||||
EMMessage emMessage = item != null ? item.getEmMessage() : null;
|
||||
if (emMessage == null) {
|
||||
return;
|
||||
}
|
||||
int red_rain_id = emMessage.getIntAttribute("record_id", 0);
|
||||
RainResultDetailFragment.Companion.newInstance(red_rain_id).show(getChildFragmentManager(), "红包雨详情");
|
||||
}
|
||||
});
|
||||
easeChatAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
EMMessageInfo item = easeChatAdapter.getItem(position);
|
||||
|
||||
String userId = item.getEmMessage().getStringAttribute("user_id", "");
|
||||
if (!TextUtils.isEmpty(userId)) {
|
||||
EventBus.getDefault().post(new UserInfoShowEvent(roomInfoResp.getRoom_info().getRoom_id(), userId));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//判断是否开启公屏
|
||||
setUpPublicScreen();
|
||||
//是否隐藏欢迎动画
|
||||
setEffectSwitch(SpUtils.getOpenEffect() == 1 ? new EffectEvent(true) : new EffectEvent(false));
|
||||
mBinding.tvCount.setOnClickListener(this::onClick);
|
||||
mBinding.llVerticalScroll.setOnClickListener(this::onSwitcher);
|
||||
|
||||
mBinding.tvTabAll.setOnClickListener(this::onClick);
|
||||
mBinding.tvTabUser.setOnClickListener(this::onClick);
|
||||
mBinding.tvTabSystem.setOnClickListener(this::onClick);
|
||||
|
||||
}
|
||||
|
||||
private void setUpPublicScreen() {
|
||||
if (roomInfoResp.getRoom_info().getChat_status() == 1) {
|
||||
//如果有数据或者recycle view有item view就删除;否则程序崩溃,找不到item
|
||||
if (mBinding.recycleView.getChildCount() > 0) {
|
||||
mBinding.recycleView.removeAllViews();
|
||||
easeChatAdapter.clearData();
|
||||
}
|
||||
mBinding.recycleView.setVisibility(View.VISIBLE);//开启消息列表
|
||||
mBinding.llHeadTab.setVisibility(View.VISIBLE);
|
||||
mBinding.tvClose.setVisibility(View.GONE);
|
||||
} else {
|
||||
mBinding.tvClose.setVisibility(View.VISIBLE);
|
||||
mBinding.llHeadTab.setVisibility(View.GONE);
|
||||
mBinding.recycleView.setVisibility(View.GONE);//隐藏消息列表
|
||||
}
|
||||
count = 0;//未读数0
|
||||
isBottom = true;
|
||||
}
|
||||
|
||||
private void initSwitcher(List<LuckyRankBean> list) {
|
||||
if (countDownTimer != null) {
|
||||
mBinding.vfSwitcher.removeAllViews();
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
mBinding.vfSwitcher.stopFlipping();
|
||||
// //队列最多保存十条数据
|
||||
// vfSwitcher.removeAllViews();
|
||||
// if (list.size() < queueMessageNum && oldList.size() > 0) {
|
||||
// for (int i = oldList.size() - 1; i > 0; i--) {
|
||||
// if (list.size() >= queueMessageNum) {
|
||||
// break;
|
||||
// } else {
|
||||
// list.add(oldList.get(i));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
for (LuckyRankBean data : list) {
|
||||
View view = getLayoutInflater().inflate(R.layout.room_integral_item_mall_flipper, null);
|
||||
TextView textView = view.findViewById(R.id.tv_flipper_msg);
|
||||
String p = "许愿池";
|
||||
if (!TextUtils.isEmpty(data.getTitle())) {
|
||||
p = data.getTitle();
|
||||
}
|
||||
textView.setText(String.format("%s在%s获得%sX%s", data.getNickname(), p, data.getGift_name(), data.getGift_number()));
|
||||
// if (vfSwitcher.getChildCount() >= queueMessageNum) {
|
||||
// break;
|
||||
// }
|
||||
mBinding.vfSwitcher.addView(view);
|
||||
}
|
||||
int count = mBinding.vfSwitcher.getChildCount();
|
||||
for (int i = 0; i < count - queueMessageNum; i++) {
|
||||
mBinding.vfSwitcher.removeViewAt(i);
|
||||
}
|
||||
mBinding.vfSwitcher.setInAnimation(requireContext(), R.anim.integral_flipper_in);
|
||||
mBinding.vfSwitcher.setOutAnimation(requireContext(), R.anim.integral_flipper_out);
|
||||
mBinding.vfSwitcher.setFlipInterval(5000);
|
||||
mBinding.vfSwitcher.setAutoStart(true);
|
||||
mBinding.vfSwitcher.startFlipping();
|
||||
mBinding.llVerticalScroll.setBackground(ResourcesCompat.getDrawable(getResources(),R.drawable.room_bg_screen_gift_push,null));
|
||||
mBinding.vfSwitcher.getInAnimation().setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
//最后一个
|
||||
if (mBinding.vfSwitcher.getDisplayedChild() == mBinding.vfSwitcher.getChildCount() - 1) {
|
||||
mBinding.vfSwitcher.stopFlipping();
|
||||
// oldList.clear();
|
||||
countDownTime(60);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送礼物显示计时
|
||||
*
|
||||
* @param longTime
|
||||
*/
|
||||
public void countDownTime(long longTime) {
|
||||
countDownTimer = new CountDownTimer(longTime * 1000, 1000) {
|
||||
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if(isAdded()) {
|
||||
if (mBinding.vfSwitcher != null) {
|
||||
mBinding.vfSwitcher.removeAllViews();
|
||||
}
|
||||
if (mBinding.llVerticalScroll != null) {
|
||||
mBinding.llVerticalScroll.setBackground(ResourcesCompat.getDrawable(getResources(), R.drawable.room_null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.room_fragement_trans_ease_chat;
|
||||
}
|
||||
|
||||
|
||||
public void onClick(View view) {
|
||||
int view_id = view.getId();
|
||||
if (view_id == R.id.tv_flipper_msg) {
|
||||
isBottom = true;
|
||||
mBinding.recycleView.scrollToPosition(easeChatAdapter.getItemCount() - 1);
|
||||
mBinding.tvCount.setVisibility(View.GONE);
|
||||
}else if(view_id == R.id.tv_tab_all){
|
||||
easeChatAdapter.setShowType(EaseChatAdapter.SHOW_TYPE_ALL);
|
||||
mBinding.tvTabAll.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabAll.setTextSize(14);
|
||||
|
||||
mBinding.tvTabUser.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabSystem.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabSystem.setBackgroundResource(0);
|
||||
mBinding.tvTabUser.setBackgroundResource(0);
|
||||
mBinding.tvTabUser.setTextSize(12);
|
||||
mBinding.tvTabSystem.setTextSize(12);
|
||||
|
||||
}else if(view_id == R.id.tv_tab_user){
|
||||
easeChatAdapter.setShowType(EaseChatAdapter.SHOW_TYPE_USER);
|
||||
mBinding.tvTabUser.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabUser.setTextSize(14);
|
||||
|
||||
mBinding.tvTabAll.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabSystem.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabSystem.setBackgroundResource(0);
|
||||
mBinding.tvTabAll.setBackgroundResource(0);
|
||||
mBinding.tvTabAll.setTextSize(12);
|
||||
mBinding.tvTabSystem.setTextSize(12);
|
||||
}else if(view_id == R.id.tv_tab_system){
|
||||
easeChatAdapter.setShowType(EaseChatAdapter.SHOW_TYPE_SYSTEM);
|
||||
|
||||
mBinding.tvTabSystem.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mBinding.tvTabSystem.setTextSize(14);
|
||||
|
||||
mBinding.tvTabAll.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabUser.setTextColor(Color.parseColor("#CCCCCC"));
|
||||
mBinding.tvTabUser.setBackgroundResource(0);
|
||||
mBinding.tvTabAll.setBackgroundResource(0);
|
||||
mBinding.tvTabAll.setTextSize(12);
|
||||
mBinding.tvTabUser.setTextSize(12);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录聊天室
|
||||
*/
|
||||
private void onChatRoomViewCreation() {
|
||||
if (EMClient.getInstance().isConnected()) {
|
||||
EMClient.getInstance().chatroomManager().joinChatRoom(toChatUsername, this);
|
||||
} else {
|
||||
UserBean userBean = BaseApplication.getInstance().getUser();
|
||||
EMClient.getInstance().login(userBean.getEmchat_username(), userBean.getEmchat_password(), new EMCallBack() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
EMClient.getInstance().chatroomManager().joinChatRoom(toChatUsername, PublicScreenEaseChatFragment.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int i, String s) {
|
||||
Logger.e("onError", i + s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(int i, String s) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(EMChatRoom emChatRoom) {
|
||||
Logger.e(TAG, "加入聊天室成功");
|
||||
if (getActivity() != null && !getActivity().isFinishing()) {
|
||||
getActivity().runOnUiThread(this::onConversationInit);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 房间信息
|
||||
*
|
||||
* @param resp
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void roomInfo(RoomInfoResp resp) {
|
||||
this.roomInfoResp = resp;
|
||||
onChatRoomViewCreation();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取聊天室数据
|
||||
*/
|
||||
private void onConversationInit() {
|
||||
if (conversation == null) {
|
||||
if (mBinding.recycleView != null) {
|
||||
mBinding.recycleView.removeCallbacks(joinChatRoomTask);
|
||||
}
|
||||
int chatType = EaseConstant.CHATTYPE_CHATROOM;
|
||||
conversation = EMClient.getInstance().chatManager().getConversation(toChatUsername, EaseCommonUtils.getConversationType(chatType), true);
|
||||
if (!TextUtils.isEmpty(roomInfoResp.getRoom_info().getOfficial_notice())) {
|
||||
appendMessage(1, 6013, roomInfoResp.getRoom_info().getOfficial_notice());
|
||||
}
|
||||
if (!TextUtils.isEmpty(roomInfoResp.getRoom_info().getGreeting())) {
|
||||
appendMessage(1, 6014, roomInfoResp.getRoom_info().getGreeting());
|
||||
}
|
||||
appendWelcomeMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加表情消息
|
||||
*
|
||||
* @param sendFaceEvent
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void sendFaceEvent(SendFaceEvent sendFaceEvent) {
|
||||
MvpPre.sendFace(sendFaceEvent.getRoom_id(), sendFaceEvent.getFace_id(), sendFaceEvent.getPitNumber(), sendFaceEvent.getType());
|
||||
RoomUserBean userBean = roomInfoResp.getUser_info();
|
||||
EMMessage txtSendMessage = EMMessage.createTextSendMessage(sendFaceEvent.getFace_special(), toChatUsername);
|
||||
txtSendMessage.setAttribute("action", 6);
|
||||
txtSendMessage.setAttribute("type", EMMessageInfo.SRLiveRoomChatMsgTypeCustomEmoji);
|
||||
txtSendMessage.setAttribute("face_pic", sendFaceEvent.getFace_pic());
|
||||
txtSendMessage.setAttribute("face_special", sendFaceEvent.getFace_special());
|
||||
txtSendMessage.setAttribute("user_id", userBean.getUser_id());
|
||||
txtSendMessage.setAttribute("rank_icon", userBean.getRank_icon());
|
||||
txtSendMessage.setAttribute("charm_icon", userBean.getCharm_icon());
|
||||
txtSendMessage.setAttribute("nobility_icon", userBean.getNobility_icon());
|
||||
txtSendMessage.setAttribute("user_title", BaseApplication.getInstance().getUser().getUser_title());
|
||||
txtSendMessage.setAttribute("nickname", userBean.getNickname());
|
||||
if (roomInfoResp.getRoom_info().getActual_role() == 5) {
|
||||
txtSendMessage.setAttribute("role", roomInfoResp.getRoom_info().getActual_role());
|
||||
} else {
|
||||
txtSendMessage.setAttribute("role", roomInfoResp.getRoom_info().getRole());
|
||||
}
|
||||
txtSendMessage.setAttribute("user_is_new", userBean.getUser_is_new());
|
||||
txtSendMessage.setMsgTime(System.currentTimeMillis());
|
||||
txtSendMessage.setLocalTime(System.currentTimeMillis());
|
||||
easeChatAdapter.addData(new EMMessageInfo(txtSendMessage));
|
||||
refreshSelectLast();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加文本消息
|
||||
*
|
||||
* @param roomInputEvent
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void sendTxtEvent(RoomInputEvent roomInputEvent) {
|
||||
RoomUserBean userBean = roomInfoResp.getUser_info();
|
||||
EMMessage txtSendMessage = EMMessage.createTextSendMessage(roomInputEvent.text, toChatUsername);
|
||||
|
||||
txtSendMessage.setAttribute("action", 2);
|
||||
txtSendMessage.setAttribute("type", EMMessageInfo.SRLiveRoomChatMsgTypeChat);
|
||||
txtSendMessage.setAttribute("user_id", userBean.getUser_id());
|
||||
txtSendMessage.setAttribute("rank_icon", userBean.getRank_icon());
|
||||
txtSendMessage.setAttribute("charm_icon", userBean.getCharm_icon());
|
||||
txtSendMessage.setAttribute("nobility_icon", userBean.getNobility_icon());
|
||||
txtSendMessage.setAttribute("user_title", BaseApplication.getInstance().getUser().getUser_title());
|
||||
txtSendMessage.setAttribute("nickname", userBean.getNickname());
|
||||
if (roomInfoResp.getRoom_info().getActual_role() == 5) {
|
||||
txtSendMessage.setAttribute("role", roomInfoResp.getRoom_info().getActual_role());
|
||||
} else {
|
||||
txtSendMessage.setAttribute("role", roomInfoResp.getRoom_info().getRole());
|
||||
}
|
||||
txtSendMessage.setAttribute("user_is_new", userBean.getUser_is_new());
|
||||
txtSendMessage.setMsgTime(System.currentTimeMillis());
|
||||
txtSendMessage.setLocalTime(System.currentTimeMillis());
|
||||
easeChatAdapter.addData(new EMMessageInfo(txtSendMessage));
|
||||
refreshSelectLast();
|
||||
}
|
||||
|
||||
private void appendWelcomeMessage() {
|
||||
RoomUserBean userBean = roomInfoResp.getUser_info();
|
||||
EMMessage txtSendMessage = EMMessage.createTxtSendMessage("加入直播间", toChatUsername);
|
||||
txtSendMessage.setAttribute("action", 3);
|
||||
txtSendMessage.setAttribute("charm_icon", userBean.getCharm_icon());
|
||||
txtSendMessage.setAttribute("type", EMMessageInfo.SRLiveRoomChatMsgTypeGoInRoom);
|
||||
txtSendMessage.setAttribute("user_id", userBean.getUser_id());
|
||||
txtSendMessage.setAttribute("rank_icon", userBean.getRank_icon());
|
||||
txtSendMessage.setAttribute("charm_icon", userBean.getCharm_icon());
|
||||
txtSendMessage.setAttribute("nobility_icon", userBean.getNobility_icon());
|
||||
txtSendMessage.setAttribute("user_title", BaseApplication.getInstance().getUser().getUser_title());
|
||||
txtSendMessage.setAttribute("nickname", userBean.getNickname());
|
||||
if (roomInfoResp.getRoom_info().getActual_role() == 5) {
|
||||
txtSendMessage.setAttribute("role", roomInfoResp.getRoom_info().getActual_role());
|
||||
} else {
|
||||
txtSendMessage.setAttribute("role", roomInfoResp.getRoom_info().getRole());
|
||||
}
|
||||
|
||||
txtSendMessage.setAttribute("user_is_new", userBean.getUser_is_new());
|
||||
txtSendMessage.setMsgTime(System.currentTimeMillis());
|
||||
txtSendMessage.setLocalTime(System.currentTimeMillis());
|
||||
easeChatAdapter.addData(new EMMessageInfo(txtSendMessage));
|
||||
}
|
||||
|
||||
private void appendMessage(int action, int type, String text) {
|
||||
EMMessage txtSendMessage = EMMessage.createTxtSendMessage(text, toChatUsername);
|
||||
txtSendMessage.setAttribute("action", action);
|
||||
txtSendMessage.setAttribute("type", type);
|
||||
txtSendMessage.setMsgTime(System.currentTimeMillis());
|
||||
txtSendMessage.setLocalTime(System.currentTimeMillis());
|
||||
easeChatAdapter.addData(new EMMessageInfo(txtSendMessage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int i, String s) {
|
||||
Logger.e(TAG, "加入聊天室失败:code=" + i + " 信息: " + s);
|
||||
if (mBinding.recycleView != null) {
|
||||
mBinding.recycleView.removeCallbacks(joinChatRoomTask);
|
||||
mBinding.recycleView.postDelayed(joinChatRoomTask, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(List<EMMessage> list) {
|
||||
if (conversation != null) {
|
||||
conversation.markAllMessagesAsRead();
|
||||
}
|
||||
|
||||
if (mBinding.recycleView.getVisibility() == View.GONE) {
|
||||
return;
|
||||
}
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<EMMessageInfo> items = new ArrayList<>();
|
||||
for (EMMessage item : list) {
|
||||
if (item.getChatType() != EMMessage.ChatType.ChatRoom) {
|
||||
continue;
|
||||
}
|
||||
if (toChatUsername != null && !toChatUsername.equals(item.getTo())) {
|
||||
continue;
|
||||
}
|
||||
//如果房间id不对应,则不接收
|
||||
String roomId = item.getStringAttribute("room_id", "");
|
||||
if (!TextUtils.isEmpty(roomId) && !roomId.equals(roomInfoResp.getRoom_info().getRoom_id())) {
|
||||
continue;
|
||||
}
|
||||
int type = item.getIntAttribute("type", 0);
|
||||
if (type > 6000 && type < 7000) { //屏蔽6000-7000之外的数据
|
||||
if (type == 6001 && item.getStringAttribute("user_id", "").equals(SpUtils.getUserId())) {//屏蔽自己加入房间消息
|
||||
continue;
|
||||
}
|
||||
if (type == 6010 && item.getStringAttribute("user_id", "").equals(SpUtils.getUserId())) {//屏蔽自己发送的表情消息
|
||||
continue;
|
||||
}
|
||||
if (type == 6012 && item.getStringAttribute("user_id", "").equals(SpUtils.getUserId())) {//屏蔽自己发送的文本消息
|
||||
continue;
|
||||
}
|
||||
items.add(new EMMessageInfo(item));
|
||||
}
|
||||
}
|
||||
easeChatAdapter.addData(items);
|
||||
if (easeChatAdapter.getItemCount() > 1000) {
|
||||
easeChatAdapter.clearSomeData();
|
||||
}
|
||||
if (isBottom) {
|
||||
count = 0;
|
||||
refreshSelectLast();
|
||||
} else if (items.size() > 0) {
|
||||
count += items.size();
|
||||
if (roomInfoResp.getRoom_info().getChat_status() == 1) {
|
||||
if (mBinding.tvCount != null) {
|
||||
mBinding.tvCount.setVisibility(View.VISIBLE);
|
||||
mBinding.tvCount.setText(count + "条新消息");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 球球大作战
|
||||
*
|
||||
* @param messages
|
||||
*/
|
||||
@Override
|
||||
public void onCmdMessageReceived(List<EMMessage> messages) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageRead(List<EMMessage> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageDelivered(List<EMMessage> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageRecalled(List<EMMessage> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageChanged(EMMessage emMessage, Object o) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户进入房间
|
||||
*
|
||||
* @param roomUserJoinModel
|
||||
*/
|
||||
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||
public void subscribeMessages(RoomUserJoinModel roomUserJoinModel) {
|
||||
mBinding.wav.addAnim(roomUserJoinModel);
|
||||
EventBus.getDefault().removeStickyEvent(roomUserJoinModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭公屏
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void subscribeMessages(ClosePublicScreenEvent closePublicScreenEvent) {
|
||||
mBinding.tvClose.setVisibility(View.VISIBLE);
|
||||
mBinding.llHeadTab.setVisibility(View.GONE);
|
||||
mBinding.recycleView.setVisibility(View.GONE);//隐藏消息列表
|
||||
mBinding.tvCount.setVisibility(View.GONE);//隐藏未读消息数
|
||||
count = 0;//未读消息数清零
|
||||
isBottom = true;
|
||||
MvpPre.switchPublicScreen(roomInfoResp.getRoom_info().getRoom_id(), "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启公屏
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void subscribeMessages(OpenPublicScreenEvent openPublicScreenEvent) {
|
||||
count = 0;//未读消息数清零
|
||||
isBottom = true;
|
||||
//如果有数据或者recycle view有item view就删除;否则程序崩溃,找不到item
|
||||
if (mBinding.recycleView.getChildCount() > 0) {
|
||||
mBinding.recycleView.removeAllViews();
|
||||
easeChatAdapter.clearData();
|
||||
}
|
||||
mBinding.recycleView.setVisibility(View.VISIBLE);//开启消息列表
|
||||
mBinding.tvClose.setVisibility(View.GONE);
|
||||
mBinding.llHeadTab.setVisibility(View.VISIBLE);
|
||||
MvpPre.switchPublicScreen(roomInfoResp.getRoom_info().getRoom_id(), "1");
|
||||
}
|
||||
|
||||
/**
|
||||
* 开关公屏 1开2关
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void subscribeMessages(PublicScreenEvent event) {
|
||||
if (roomInfoResp.getRoom_info().getRoom_id().equals(event.getRoom_id())) {
|
||||
roomInfoResp.getRoom_info().setChat_status(event.getStatus());
|
||||
setUpPublicScreen();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshSelectLast() {
|
||||
if (mBinding.recycleView != null) {
|
||||
mBinding.recycleView.scrollToPosition(easeChatAdapter.getItemCount() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 特效设置
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void setEffectSwitch(EffectEvent event) {
|
||||
if (event.isEffectOn()) {//特效开启
|
||||
if (!mBinding.wav.animEnded) {
|
||||
mBinding.wav.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
mBinding.wav.closeEffect();
|
||||
mBinding.wav.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 浇水礼物推送
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void setSwitcher(LuckyRankListBean listBean) {
|
||||
if (listBean != null) {
|
||||
// oldList = listBean;
|
||||
initSwitcher(listBean);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送区域
|
||||
*/
|
||||
public void onSwitcher(View view) {
|
||||
recordDialogFragment = RoomWinningRecordDialogFragment.newInstance();
|
||||
if (recordDialogFragment != null
|
||||
&& recordDialogFragment.getDialog() != null
|
||||
&& recordDialogFragment.getDialog().isShowing()
|
||||
&& !recordDialogFragment.isRemoving()) {
|
||||
//dialog is showing so do something
|
||||
} else {
|
||||
recordDialogFragment.show((getActivity()).getSupportFragmentManager(), "RoomWaterTreeRankDialog");
|
||||
//dialog is not showing
|
||||
}
|
||||
AppLogUtil.reportAppLog(AppLogEvent.D010604);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected() {
|
||||
onChatRoomViewCreation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected(int i) {
|
||||
Logger.e("onDisconnected", i);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重连任务
|
||||
*/
|
||||
private Runnable joinChatRoomTask = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onChatRoomViewCreation();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (mBinding.vfSwitcher != null) {
|
||||
mBinding.vfSwitcher.startFlipping();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (mBinding.vfSwitcher != null) {
|
||||
mBinding.vfSwitcher.stopFlipping();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.Manifest;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.blankj.utilcode.util.FragmentUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RoomContacts;
|
||||
import com.example.moduleroom.databinding.FragmentRoomBinding;
|
||||
import com.example.moduleroom.presenter.RoomPresenter;
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.base.BaseMvpFragment;
|
||||
import com.qxcm.moduleutil.bean.room.RoomBean;
|
||||
import com.qxcm.moduleutil.bean.room.RoomInfoResp;
|
||||
|
||||
import pub.devrel.easypermissions.EasyPermissions;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/9
|
||||
*@description:
|
||||
*/
|
||||
public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBinding> implements RoomContacts.View {
|
||||
|
||||
// public static RoomFragment newInstance(RoomInfoResp roomInfo, String password) {
|
||||
// Bundle args = new Bundle();
|
||||
// args.putSerializable("roomInfo", roomInfo);
|
||||
// args.putString("password", password);
|
||||
// RoomFragment fragment = new RoomFragment();
|
||||
// fragment.setArguments(args);
|
||||
// return fragment;
|
||||
// }
|
||||
private RoomInfoResp mRoomInfoResp;
|
||||
String[] permissions = {Manifest.permission.RECORD_AUDIO};
|
||||
public static RoomFragment newInstance() {
|
||||
|
||||
RoomFragment fragment = new RoomFragment();
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RoomPresenter bindPresenter() {
|
||||
return new RoomPresenter(this, getContext());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
if (!EasyPermissions.hasPermissions(getActivity(), permissions)) {
|
||||
EasyPermissions.requestPermissions(this, "请开启录音使用权限",
|
||||
1, permissions);
|
||||
}
|
||||
RoomBean roomBean = mRoomInfoResp.getRoom_info();
|
||||
|
||||
FragmentUtils.add(getChildFragmentManager(), SingSongFragment.newInstance(mRoomInfoResp), R.id.container);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_room;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,545 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.blankj.utilcode.util.ObjectUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.activity.RoomActivity;
|
||||
import com.example.moduleroom.contacts.SingSongContacts;
|
||||
import com.example.moduleroom.databinding.FragmentSingSongBinding;
|
||||
import com.example.moduleroom.presenter.SingSongPresenter;
|
||||
import com.luck.picture.lib.tools.DoubleUtils;
|
||||
import com.qxcm.moduleutil.base.BaseRoomFragment;
|
||||
import com.qxcm.moduleutil.bean.room.RoomUserJoinModel;
|
||||
import com.qxcm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.qxcm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.qxcm.moduleutil.utils.SpUtil;
|
||||
import com.qxcm.moduleutil.utils.logger.Logger;
|
||||
import com.qxcm.moduleutil.widget.RoomDefaultWheatView;
|
||||
import com.qxcm.moduleutil.widget.dialog.CommonDialog;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/9
|
||||
*@description: 点唱房
|
||||
*/
|
||||
public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, FragmentSingSongBinding> implements SingSongContacts.View, View.OnClickListener {
|
||||
protected String roomId;
|
||||
protected RoomInfoResp roomInfoResp;
|
||||
protected String pitNumber;//当前点击的麦序
|
||||
protected CommonDialog commonDialog;
|
||||
|
||||
public static SingSongFragment newInstance(RoomInfoResp roomInfo) {
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("roomInfo", roomInfo);
|
||||
SingSongFragment fragment = new SingSongFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
roomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfo");
|
||||
roomId = roomInfoResp == null ? "" : roomInfoResp.getRoom_info().getRoom_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SingSongPresenter bindPresenter() {
|
||||
return new SingSongPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
tzblChanged();
|
||||
mBinding.dhvHost.setRoomOwnerInfo(roomInfoResp.getRoom_info().getIs_owner_model(), roomInfoResp.getOwner_info().getStatus());
|
||||
mBinding.dhv8.setIsBossShow(roomInfoResp.getRoom_info().getIs_boss_pit());
|
||||
updateWheatData();
|
||||
initEM();
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
if (!TextUtils.isEmpty(roomInfoResp.getRoom_info().getBg_picture())) {
|
||||
((RoomActivity) getActivity()).changeBackgroundColor2(roomInfoResp.getRoom_info().getBg_picture());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateWheatData() {
|
||||
if (!ObjectUtils.isEmpty(roomInfoResp.getRoom_info().getPit_list())) {
|
||||
for (RoomPitBean bean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
EventBus.getDefault().post(bean);
|
||||
}
|
||||
}
|
||||
RoomBeckoningEvent event = new RoomBeckoningEvent(roomId, roomInfoResp.getRoom_info().getCardiac() == 1);
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
|
||||
private void initEM() {
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(i);
|
||||
List<String> list = new ArrayList<>();
|
||||
if (pitBean.getIs_online() == 1) {
|
||||
if (pitBean.getUser_id().equals(SpUtil.getUserId())) {
|
||||
pitBean.setIs_online(1);
|
||||
// updateWheatData();
|
||||
// showInOnWhatView(i, 1);
|
||||
EventBus.getDefault().post(pitBean);
|
||||
}
|
||||
if (pitBean.getEmchat_username() != null &&
|
||||
!pitBean.getEmchat_username().isEmpty() &&
|
||||
!pitBean.getEmchat_username().equals("0")) {
|
||||
list.add(pitBean.getEmchat_username());
|
||||
|
||||
//订阅房间内所有用户的状态
|
||||
int finalI = i;
|
||||
EMClient.getInstance().presenceManager().subscribePresences(list, 1 * 24 * 3600, new EMValueCallBack<List<EMPresence>>() {
|
||||
@Override
|
||||
public void onSuccess(List<EMPresence> presences) {
|
||||
Log.d("@@@", "订阅房间内所有用户的状态成功" + ":" + presences.get(0).getStatusList().values());
|
||||
String s = presences.get(0).getStatusList().values().toString();
|
||||
Log.d("@@@", "订阅房间内所有用户的状态成功" + ":" + s);
|
||||
if (!pitBean.getUser_id().equals(SpUtils.getUserId())) {
|
||||
if (s.equals("[0]")) {
|
||||
pitBean.setIs_online(2);
|
||||
// showInOnWhatView(finalI, 2);
|
||||
EventBus.getDefault().post(pitBean);
|
||||
} else {
|
||||
pitBean.setIs_online(1);
|
||||
// showInOnWhatView(finalI, 1);
|
||||
EventBus.getDefault().post(pitBean);
|
||||
}
|
||||
}
|
||||
// updateWheatData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int errorCode, String errorMsg) {
|
||||
Log.d("@@@", "订阅房间内所有用户的状态失败" + ":" + errorCode + ":" + errorMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EMPresenceListener listener = new EMPresenceListener() {
|
||||
@Override
|
||||
public void onPresenceUpdated(List<EMPresence> list) {
|
||||
Log.d("@@@", "onPresenceUpdated:" + list.get(0).getStatusList().values());
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i).getStatusList().values().toString().equals("[0]")) {
|
||||
for (int j = 0; j < roomInfoResp.getRoom_info().getPit_list().size(); j++) {
|
||||
RoomPitBean roomPitBean = roomInfoResp.getRoom_info().getPit_list().get(j);
|
||||
if (roomPitBean.getEmchat_username().equals(list.get(i).getPublisher())) {
|
||||
roomPitBean.setIs_online(2);
|
||||
// showInOnWhatView(j, 2);
|
||||
roomInfoResp.getRoom_info().getPit_list().set(j, roomPitBean);
|
||||
EventBus.getDefault().post(roomPitBean);
|
||||
}
|
||||
}
|
||||
// updateWheatData();
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
}
|
||||
};
|
||||
EMClient.getInstance().presenceManager().addListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tzblChanged() {
|
||||
super.tzblChanged();
|
||||
mBinding.dhvHost.updateTzbl(SpUtil.getTzbl(roomId));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_sing_song;
|
||||
}
|
||||
|
||||
public void onWheatClicked(View ii) {
|
||||
RoomDefaultWheatView view = (RoomDefaultWheatView) ii;
|
||||
if (view.isOn()) {
|
||||
EventBus.getDefault().post(new UserInfoShowEvent(roomId, view.pitBean.getUser_id()));
|
||||
} else {
|
||||
if (roomInfoResp.getRoom_info().getPit_list().get(8).getUser_id().equals(SpUtils.getUserId())) {
|
||||
if (!DoubleUtils.isFastDoubleClick()) {
|
||||
//弹出空麦位弹窗
|
||||
RoomWheatManageDialogFragment roomWheatManageDialogFragment = RoomWheatManageDialogFragment.newInstance(roomId, view.pitNumber, view.pitBean.getShutup(), false, true);
|
||||
roomWheatManageDialogFragment.show(getChildFragmentManager());
|
||||
}
|
||||
return;
|
||||
} else if (roomInfoResp.isWheatManager() || (roomInfoResp.isManager() && view.isLocked())) {
|
||||
if (!DoubleUtils.isFastDoubleClick()) {
|
||||
//弹出空麦位弹窗
|
||||
RoomWheatManageDialogFragment roomWheatManageDialogFragment = RoomWheatManageDialogFragment.newInstance(roomId, view.pitNumber, view.pitBean.getShutup(), false, true);
|
||||
roomWheatManageDialogFragment.show(getChildFragmentManager());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (roomInfoResp.isFreedomMode()) {//自由模式
|
||||
MvpPre.applyWheat(roomId, view.pitNumber);
|
||||
} else {//排麦模式
|
||||
//普通用户排麦模式弹出提示框
|
||||
if (!roomInfoResp.isManager()) {
|
||||
showConfirmApplyWait();
|
||||
} else {
|
||||
MvpPre.applyWheatWait(roomId, view.pitNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
pitNumber = view.pitNumber;
|
||||
}
|
||||
|
||||
protected void showConfirmApplyWait() {
|
||||
if (commonDialog == null) {
|
||||
commonDialog = new CommonDialog(requireContext());
|
||||
commonDialog.setContent("是否加入当前麦序队列");
|
||||
commonDialog.setmOnClickListener(new CommonDialog.OnClickListener() {
|
||||
@Override
|
||||
public void onLeftClick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick() {
|
||||
MvpPre.applyWheatWait(roomId, pitNumber);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!commonDialog.isShowing()) {
|
||||
commonDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 2025/3/26 进入房间
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void subscribeMessages(RoomUserJoinModel event) {
|
||||
Logger.e("@@@", "加入房间" + event);
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
if (event.getUser_id().equals(roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id())) {
|
||||
roomInfoResp.getRoom_info().getPit_list().get(i).setIs_online(1);
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(roomInfoResp.getRoom_info().getPit_list().get(i).getEmchat_username());
|
||||
EMClient.getInstance().presenceManager().subscribePresences(list, 1 * 24 * 3600, new EMValueCallBack<List<EMPresence>>() {
|
||||
@Override
|
||||
public void onSuccess(List<EMPresence> presences) {
|
||||
Log.d("@@@", "订阅房间内所有用户的状态成功" + ":" + presences.get(0).getStatusList().values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int errorCode, String errorMsg) {
|
||||
Log.d("@@@", "订阅房间内所有用户的状态失败" + ":" + errorCode + ":" + errorMsg);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
updateWheatData();
|
||||
}
|
||||
|
||||
// TODO: 2025/3/26 离开房间
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void subscribeMessages(RoomOwnerLeaveEvent event) {
|
||||
Logger.e("@@@", "离开房间" + event);
|
||||
if (roomInfoResp.getRoom_info().getFriend().getFriend_status() == 2) {
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
if (event.getUser_id().equals(roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id())) {
|
||||
roomInfoResp.getRoom_info().getPit_list().get(i).setIs_online(2);
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(roomInfoResp.getRoom_info().getPit_list().get(i).getEmchat_username());
|
||||
quxiao(list);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateWheatData();
|
||||
}
|
||||
|
||||
// TODO: 2025/3/28 取消订阅
|
||||
private void quxiao(List<String> userIds) {
|
||||
EMClient.getInstance().presenceManager().unsubscribePresences(userIds, new EMCallBack() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Logger.e("@@@", "取消订阅成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int errorCode, String errorMsg) {
|
||||
Logger.e("@@@", "取消订阅失败" + ":" + errorMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomInfoUpdate(RoomInfoResp resp) {
|
||||
roomInfoResp = resp;
|
||||
updateWheatData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerWheatViews() {
|
||||
mBinding.dhv1.register(this);
|
||||
mBinding.dhv2.register(this);
|
||||
mBinding.dhv3.register(this);
|
||||
mBinding.dhv4.register(this);
|
||||
mBinding.dhv5.register(this);
|
||||
mBinding.dhv6.register(this);
|
||||
mBinding.dhv7.register(this);
|
||||
mBinding.dhv8.register(this);
|
||||
mBinding.dhvHost.register(this);
|
||||
mBinding.dhvHost2.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegisterWheatViews() {
|
||||
mBinding.dhv1.unRegister(this);
|
||||
mBinding.dhv2.unRegister(this);
|
||||
mBinding.dhv3.unRegister(this);
|
||||
mBinding.dhv4.unRegister(this);
|
||||
mBinding.dhv5.unRegister(this);
|
||||
mBinding.dhv6.unRegister(this);
|
||||
mBinding.dhv7.unRegister(this);
|
||||
mBinding.dhv8.unRegister(this);
|
||||
mBinding.dhvHost.unRegister(this);
|
||||
mBinding.dhvHost2.unRegister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initListener() {
|
||||
super.initListener();
|
||||
mBinding.dhvHost.setOnClickListener(this::onWheatClicked);
|
||||
mBinding.dhvHost2.setOnClickListener(this::onWheatClicked);
|
||||
mBinding.dhv1.setOnClickListener(this::onWheatClicked);
|
||||
mBinding.dhv2.setOnClickListener(this::onWheatClicked);
|
||||
mBinding.dhv3.setOnClickListener(this::onWheatClicked);
|
||||
mBinding.dhv4.setOnClickListener(this::onWheatClicked);
|
||||
mBinding.dhv5.setOnClickListener(this::onWheatClicked);
|
||||
mBinding.dhv6.setOnClickListener(this::onWheatClicked);
|
||||
mBinding.dhv7.setOnClickListener(this::onWheatClicked);
|
||||
mBinding.dhv8.setOnClickListener(this::onWheatClicked);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 上麦模式变化通知 1自由2排麦
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void subscribeMessages(RoomWheatEvent roomWheatEvent) {
|
||||
if (roomId.equals(roomWheatEvent.getRoomId())) {
|
||||
roomInfoResp.getRoom_info().setWheat(roomWheatEvent.isFree() ? "1" : "2");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户下麦
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void subscribeMessages(UserDownWheatEvent event) {
|
||||
pitNumber = null;
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onShowOnWheatDialogEvent(ShowOnWheatDialogEvent event) {
|
||||
if (!isResumed()) {
|
||||
return;
|
||||
}
|
||||
MvpPre.checkShowOnWheatDlg(roomId);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSwitchPitEvent(RoomUpPitBean event) {
|
||||
if (event.getPit_number() != null && !event.getPit_number().equals("")) {
|
||||
RoomPitBean roomPitBean1 = GsonUtils.GsonToBean(GsonUtils.GsonString(event), RoomPitBean.class);
|
||||
RoomPitBean roomPitBean = roomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(event.getTo_pit_number()) - 1);
|
||||
roomPitBean1.setPit_number(event.getTo_pit_number());
|
||||
roomPitBean.setPit_number(event.getPit_number());
|
||||
roomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(event.getPit_number()) - 1, roomPitBean);
|
||||
roomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(event.getTo_pit_number()) - 1, roomPitBean1);
|
||||
}
|
||||
updateWheatData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void needShowOnWheatDlg(int pit) {
|
||||
if (!isResumed()) {
|
||||
return;
|
||||
}
|
||||
//麦位,0代表没有空麦位,大于0代表当前空的麦位
|
||||
if (pit > 0) {
|
||||
new RoomOnWheatDialog(() -> {
|
||||
switch (pit) {
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
onWheatClicked(mBinding.dhv1);
|
||||
break;
|
||||
case 2:
|
||||
onWheatClicked(mBinding.dhv2);
|
||||
break;
|
||||
case 3:
|
||||
onWheatClicked(mBinding.dhv3);
|
||||
break;
|
||||
case 4:
|
||||
onWheatClicked(mBinding.dhv4);
|
||||
break;
|
||||
case 5:
|
||||
onWheatClicked(mBinding.dhv5);
|
||||
break;
|
||||
case 6:
|
||||
onWheatClicked(mBinding.dhv6);
|
||||
break;
|
||||
case 7:
|
||||
onWheatClicked(mBinding.dhv7);
|
||||
break;
|
||||
case 8:
|
||||
onWheatClicked(mBinding.dhv8);
|
||||
break;
|
||||
case 9:
|
||||
onWheatClicked(mBinding.dhvHost2);
|
||||
break;
|
||||
}
|
||||
}).show(getChildFragmentManager());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void xqStateChangedSuccess(int status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideAllWheatMaozi() {
|
||||
mBinding.dhvHost.hideMaoziIcon();
|
||||
mBinding.dhvHost2.hideMaoziIcon();
|
||||
mBinding.dhv1.hideMaoziIcon();
|
||||
mBinding.dhv2.hideMaoziIcon();
|
||||
mBinding.dhv3.hideMaoziIcon();
|
||||
mBinding.dhv4.hideMaoziIcon();
|
||||
mBinding.dhv5.hideMaoziIcon();
|
||||
mBinding.dhv6.hideMaoziIcon();
|
||||
mBinding.dhv7.hideMaoziIcon();
|
||||
mBinding.dhv8.hideMaoziIcon();
|
||||
}
|
||||
|
||||
protected void showWheatMaozi(int wheat, int type) {
|
||||
switch (wheat) {
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
mBinding.dhvHost.showMaoziIcon(type);
|
||||
break;
|
||||
case 1:
|
||||
mBinding.dhv1.showMaoziIcon(type);
|
||||
break;
|
||||
case 2:
|
||||
mBinding.dhv2.showMaoziIcon(type);
|
||||
break;
|
||||
case 3:
|
||||
mBinding.dhv3.showMaoziIcon(type);
|
||||
break;
|
||||
case 4:
|
||||
mBinding.dhv4.showMaoziIcon(type);
|
||||
break;
|
||||
case 5:
|
||||
mBinding.dhv5.showMaoziIcon(type);
|
||||
break;
|
||||
case 6:
|
||||
mBinding.dhv6.showMaoziIcon(type);
|
||||
break;
|
||||
case 7:
|
||||
mBinding.dhv7.showMaoziIcon(type);
|
||||
break;
|
||||
case 8:
|
||||
mBinding.dhv8.showMaoziIcon(type);
|
||||
break;
|
||||
case 9:
|
||||
mBinding.dhvHost2.showMaoziIcon(type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWheatMaoziHuangguan(int wheat) {
|
||||
showWheatMaozi(wheat, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWheatMaoziBianbian(int... wheats) {
|
||||
for (int w : wheats) {
|
||||
showWheatMaozi(w, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] collectCurrentCardiacValues() {
|
||||
int[] cvs = new int[10];
|
||||
if (mBinding.dhvHost.isOn()) {
|
||||
cvs[0] = mBinding.dhvHost.getCardiac();
|
||||
} else {
|
||||
cvs[0] = -1;
|
||||
}
|
||||
if (mBinding.dhv1.isOn()) {
|
||||
cvs[1] = mBinding.dhv1.getCardiac();
|
||||
} else {
|
||||
cvs[1] = -1;
|
||||
}
|
||||
if (mBinding.dhv2.isOn()) {
|
||||
cvs[2] = mBinding.dhv2.getCardiac();
|
||||
} else {
|
||||
cvs[2] = -1;
|
||||
}
|
||||
if (mBinding.dhv3.isOn()) {
|
||||
cvs[3] = mBinding.dhv3.getCardiac();
|
||||
} else {
|
||||
cvs[3] = -1;
|
||||
}
|
||||
if (mBinding.dhv4.isOn()) {
|
||||
cvs[4] = mBinding.dhv4.getCardiac();
|
||||
} else {
|
||||
cvs[4] = -1;
|
||||
}
|
||||
if (mBinding.dhv5.isOn()) {
|
||||
cvs[5] = mBinding.dhv5.getCardiac();
|
||||
} else {
|
||||
cvs[5] = -1;
|
||||
}
|
||||
if (mBinding.dhv6.isOn()) {
|
||||
cvs[6] = mBinding.dhv6.getCardiac();
|
||||
} else {
|
||||
cvs[6] = -1;
|
||||
}
|
||||
if (mBinding.dhv7.isOn()) {
|
||||
cvs[7] = mBinding.dhv7.getCardiac();
|
||||
} else {
|
||||
cvs[7] = -1;
|
||||
}
|
||||
if (mBinding.dhv8.isOn()) {
|
||||
cvs[8] = mBinding.dhv8.getCardiac();
|
||||
} else {
|
||||
cvs[8] = -1;
|
||||
}
|
||||
if (mBinding.dhvHost2.isOn()) {
|
||||
cvs[9] = mBinding.dhvHost2.getCardiac();
|
||||
} else {
|
||||
cvs[9] = -1;
|
||||
}
|
||||
return cvs;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
import com.example.moduleroom.contacts.PublicScreenEaseChatContacts;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class PublicScreenEaseChatPresenter extends BasePresenter<PublicScreenEaseChatContacts.View> implements PublicScreenEaseChatContacts.IPublicScreenEaseChatPre {
|
||||
public PublicScreenEaseChatPresenter(PublicScreenEaseChatContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logEmchat(int code, String msg, String toChatUsername) {
|
||||
// ApiClient.getInstance().logEmchat(code, msg, toChatUsername, new BaseObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(String s) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchPublicScreen(String room_id, String status) {
|
||||
// ApiClient.getInstance().switchPublicScreen(room_id, status, new BaseObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(String s) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
public void sendFace(String roomId, String face_id, String pit, int type) {
|
||||
// ApiClient.getInstance().sendFace(roomId, face_id, pit, type, new BaseObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(String s) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.RoomContacts;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
public class RoomPresenter extends BasePresenter<RoomContacts.View> implements RoomContacts.IRoomPre{
|
||||
public RoomPresenter(RoomContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.SingSongContacts;
|
||||
import com.qxcm.moduleutil.base.BaseRoomPresenter;
|
||||
|
||||
public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View> implements SingSongContacts.IEmotionRoomPre {
|
||||
public SingSongPresenter(SingSongContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
}
|
||||
128
moduleroom/src/main/res/layout/activity_room.xml
Normal file
128
moduleroom/src/main/res/layout/activity_room.xml
Normal file
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
||||
tools:context=".activity.RoomActivity">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:keepScreenOn="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_bg_mask"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@color/color_40000000"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<include layout="@layout/room_top"
|
||||
android:id="@+id/room_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<com.qxcm.moduleutil.widget.ScrollViewPager
|
||||
android:id="@+id/vp_room_pager"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/room_top" />
|
||||
|
||||
|
||||
<com.qxcm.moduleutil.widget.MusicRotationView
|
||||
android:id="@+id/rl_music_min_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.35"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.qxcm.moduleutil.widget.MusicView
|
||||
android:id="@+id/music_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.qxcm.moduleutil.widget.AvatarFrameView
|
||||
android:id="@+id/svga_gift"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--礼物连送图标-->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/gift_show_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="200dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gift_show_progress_img"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@mipmap/default_avatar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.qxcm.moduleutil.widget.CircularProgressView
|
||||
android:id="@+id/gift_show_progress"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
app:backColor="#FF9800"
|
||||
app:backWidth="3dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:progColor="#888888"
|
||||
app:progWidth="3dp"
|
||||
app:progress="0" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
423
moduleroom/src/main/res/layout/fragment_room.xml
Normal file
423
moduleroom/src/main/res/layout/fragment_room.xml
Normal file
@@ -0,0 +1,423 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".fragment.RoomFragment">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_all_layout_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
tools:background="@mipmap/room_bg">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.qxcm.moduleutil.widget.RoomMessageInputMenu
|
||||
android:id="@+id/input_menu1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_15"
|
||||
android:animateLayoutChanges="true"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/dp_16"
|
||||
android:paddingRight="@dimen/dp_16"
|
||||
app:layout_constraintBottom_toTopOf="@+id/input_menu1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
android:layout_weight="1.4"
|
||||
android:background="@drawable/room_bottom_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/dp_5"
|
||||
android:paddingRight="@dimen/dp_5">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_emoji"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:src="@mipmap/mess" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iv_chat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:text="说点什么"
|
||||
android:textColor="#80ffffff"
|
||||
android:textSize="@dimen/sp_13" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="0.2" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_voive"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:layout_weight="0.3">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/room_voice_kg" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_mic"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:layout_weight="0.3"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_mic"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/room_microphone"
|
||||
android:visibility="visible"
|
||||
tools:visibility="visible" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_message"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:layout_weight="0.3"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_message"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/room_message"
|
||||
android:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_message_dot"
|
||||
android:layout_width="@dimen/dp_14"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@mipmap/room_ic_red_dot"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_more"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:layout_weight="0.3"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_more"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/room_pk" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_misc"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:layout_weight="0.3"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_misc"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/room_mis" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_gift"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:layout_weight="0.3"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gift"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/room_gift" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_sett"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.3"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_sett"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/room_sett" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/ease_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/ll_bottom"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/container">
|
||||
|
||||
<com.qxcm.moduleutil.widget.AvatarFrameView
|
||||
android:id="@+id/svga_ride"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_input"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toTopOf="@id/ll_bottom"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_notice"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="@dimen/dp_17"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_5"-->
|
||||
<!-- android:src="@mipmap/room_ic_notice"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_play"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="@dimen/dp_8"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_5"-->
|
||||
<!-- android:src="@mipmap/room_ic_play"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/iv_notice"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_collect"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="@dimen/dp_10"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_5"-->
|
||||
<!-- android:background="@mipmap/collect_g"-->
|
||||
<!-- android:padding="@dimen/dp_4"-->
|
||||
<!-- android:text="关注:1234"-->
|
||||
<!-- android:textColor="@color/color_FFFFF0F0"-->
|
||||
<!-- android:textSize="12sp"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/iv_play"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_colse"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="@dimen/dp_10"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_5"-->
|
||||
<!-- android:background="@mipmap/collect_g"-->
|
||||
<!-- android:drawableStart="@mipmap/image_243"-->
|
||||
<!-- android:drawablePadding="@dimen/dp_5"-->
|
||||
<!-- android:padding="@dimen/dp_4"-->
|
||||
<!-- android:text="0对在线"-->
|
||||
<!-- android:textColor="@color/color_FFFFF0F0"-->
|
||||
<!-- android:textSize="12sp"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/tv_collect"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<com.qxcm.moduleutil.widget.AvatarFrameView
|
||||
android:id="@+id/svga_nobility"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/container"
|
||||
app:layout_constraintEnd_toEndOf="@id/container"
|
||||
app:layout_constraintStart_toStartOf="@id/container"
|
||||
app:layout_constraintTop_toTopOf="@id/container" />
|
||||
|
||||
<!-- <com.qpyy.room.widget.GuardAnimView-->
|
||||
<!-- android:id="@+id/gav"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<!-- <com.qpyy.room.widget.BigGiftAnimView-->
|
||||
<!-- android:id="@+id/bgav"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<!-- <com.qpyy.room.widget.SmallGiftAnimLayout-->
|
||||
<!-- android:id="@+id/sgal"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:clipChildren="false"-->
|
||||
<!-- android:clipToPadding="false"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@id/ease_container" />-->
|
||||
|
||||
|
||||
<!-- <com.stx.xhb.xbanner.XBanner-->
|
||||
<!-- android:id="@+id/banner"-->
|
||||
<!-- android:layout_width="@dimen/dp_70"-->
|
||||
<!-- android:layout_height="@dimen/dp_80"-->
|
||||
<!-- android:layout_marginEnd="17dp"-->
|
||||
<!-- android:layout_marginBottom="18dp"-->
|
||||
<!-- android:scaleType="fitCenter"-->
|
||||
<!-- app:AutoPlayTime="3000"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@id/ll_bottom"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:pageChangeDuration="3000"-->
|
||||
<!-- app:pointContainerPosition="BOTTOM"-->
|
||||
<!-- app:pointNormal="@mipmap/room_ic_banner_point_normal"-->
|
||||
<!-- app:pointSelect="@mipmap/room_ic_banner_point_select"-->
|
||||
<!-- app:pointTopBottomPadding="@dimen/dp_2"-->
|
||||
<!-- app:pointsPosition="CENTER"-->
|
||||
<!-- app:pointsVisibility="true"-->
|
||||
<!-- android:clickable="true"-->
|
||||
<!-- android:focusable="true"-->
|
||||
<!-- />-->
|
||||
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
<!-- android:id="@+id/cl_first_charge"-->
|
||||
<!-- android:layout_width="@dimen/dp_60"-->
|
||||
<!-- android:layout_height="@dimen/dp_40"-->
|
||||
<!-- android:layout_marginBottom="@dimen/dp_12"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@+id/banner"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="@+id/banner"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="@+id/banner"-->
|
||||
<!-- tools:visibility="visible">-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_first_charge"-->
|
||||
<!-- android:layout_width="@dimen/dp_44"-->
|
||||
<!-- android:layout_height="@dimen/dp_33"-->
|
||||
<!-- android:scaleType="centerInside"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_first_sub"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="@dimen/dp_15"-->
|
||||
<!-- android:background="@drawable/index_first_charge_bg"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:maxWidth="@dimen/dp_60"-->
|
||||
<!-- android:minWidth="@dimen/dp_40"-->
|
||||
<!-- android:paddingLeft="@dimen/dp_3"-->
|
||||
<!-- android:paddingRight="@dimen/dp_3"-->
|
||||
<!-- android:textColor="@color/white"-->
|
||||
<!-- android:textSize="8sp"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="@id/iv_first_charge"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="@id/iv_first_charge"-->
|
||||
<!-- tools:text="待领取" />-->
|
||||
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_rain_world"-->
|
||||
<!-- android:layout_width="@dimen/dp_70"-->
|
||||
<!-- android:layout_height="@dimen/dp_70"-->
|
||||
<!-- android:src="@mipmap/rain_world_icon"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@id/banner"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- tools:visibility="visible" />-->
|
||||
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
<!-- android:id="@+id/cl_rain_room"-->
|
||||
<!-- android:layout_width="@dimen/dp_61"-->
|
||||
<!-- android:layout_height="@dimen/dp_61"-->
|
||||
<!-- android:layout_marginStart="@dimen/dp_20"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_50"-->
|
||||
<!-- android:background="@mipmap/rain_room_red_paper_icon"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent">-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_rain_room_time"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginBottom="@dimen/dp_10"-->
|
||||
<!-- android:includeFontPadding="false"-->
|
||||
<!-- android:text="00:00"-->
|
||||
<!-- android:textColor="#FEFFB3"-->
|
||||
<!-- android:textSize="9sp"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_rain_room_count"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_24"-->
|
||||
<!-- android:includeFontPadding="false"-->
|
||||
<!-- android:text="0"-->
|
||||
<!-- android:textColor="#FFFFFF"-->
|
||||
<!-- android:textSize="8sp"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</layout>
|
||||
15
moduleroom/src/main/res/layout/fragment_sing_song.xml
Normal file
15
moduleroom/src/main/res/layout/fragment_sing_song.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragment.SingSongFragment">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<
|
||||
|
||||
|
||||
</layout>
|
||||
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_head_tab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginBottom="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tab_all"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFF"
|
||||
android:gravity="center"
|
||||
android:text="全部"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tab_user"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:textSize="12sp"
|
||||
android:gravity="center"
|
||||
android:textColor="#ccc"
|
||||
android:text="聊天"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tab_system"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:textSize="12sp"
|
||||
android:gravity="center"
|
||||
android:textColor="#ccc"
|
||||
android:text="系统"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_vertical_scroll"
|
||||
android:layout_below="@+id/ll_head_tab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/dp_10"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_speaker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/room_integral_ic_speaker" />
|
||||
|
||||
<ViewFlipper
|
||||
android:id="@+id/vf_switcher"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_10" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycle_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/ll_vertical_scroll"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginRight="@dimen/dp_70" />
|
||||
|
||||
<com.qxcm.moduleutil.widget.WelcomeAnimView
|
||||
android:id="@+id/wav"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@mipmap/common_icon_newmsg"
|
||||
android:paddingLeft="@dimen/dp_18"
|
||||
android:paddingTop="@dimen/dp_7"
|
||||
android:paddingRight="@dimen/dp_18"
|
||||
android:paddingBottom="@dimen/dp_7"
|
||||
android:text="3条新消息"
|
||||
android:textColor="#333333"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_close"
|
||||
android:layout_width="@dimen/dp_95"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@mipmap/common_icon_newmsg"
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/room_ic_chat_close"
|
||||
android:text="公屏已关闭"
|
||||
android:textColor="@color/color_FF333333"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</RelativeLayout>
|
||||
</layout>
|
||||
189
moduleroom/src/main/res/layout/room_top.xml
Normal file
189
moduleroom/src/main/res/layout/room_top.xml
Normal file
@@ -0,0 +1,189 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/group_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:background="@drawable/bg_r73_33fffff"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/dp_7">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="@dimen/dp_26"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:layout_marginLeft="8dp">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/dp_26"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_oval="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:maxWidth="90dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
tools:text="123456789"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id_val"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_follow"
|
||||
android:layout_width="@dimen/dp_46"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:background="@mipmap/collect" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/group_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_alignTop="@id/group_1"
|
||||
android:layout_alignBottom="@id/group_1"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:gravity="center_vertical|right"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/user_recyclerView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_close_live"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:src="@mipmap/room_colse" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/btn_ranking"
|
||||
android:layout_width="@dimen/dp_66"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_below="@id/group_1"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:background="@drawable/bg_r73_33fffff"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_ra"
|
||||
android:layout_width="@dimen/dp_12"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
android:layout_marginStart="@dimen/dp_7"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/room_ranking_ist" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/votes_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_7"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_toEndOf="@+id/im_ra"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/sp_12"
|
||||
tools:text="排行榜" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/btn_notice"
|
||||
android:layout_width="@dimen/dp_55"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_alignTop="@id/btn_ranking"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_toEndOf="@id/btn_ranking"
|
||||
android:background="@drawable/bg_r73_33fffff"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_not"
|
||||
android:layout_width="@dimen/dp_12"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
android:layout_marginStart="@dimen/dp_7"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/room_notice" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_7"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_toEndOf="@+id/im_not"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/sp_12"
|
||||
tools:text="公告" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="@dimen/dp_55"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_alignTop="@id/btn_notice"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_toEndOf="@id/btn_notice"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@mipmap/room_xd" />
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
4
moduleroom/src/main/res/values/strings.xml
Normal file
4
moduleroom/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<resources>
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user