소스 검색

feat: 观众展示和私信等级

tongmengxiao 6 달 전
부모
커밋
ea1bb5b96e

+ 13 - 0
baseswago/src/main/java/com/swago/baseswago/model/UserInfoModel.java

@@ -94,6 +94,11 @@ public class UserInfoModel {
      */
     private int is_password;
 
+    /**
+     * 是否充值用户
+     */
+    private int is_recharge;
+
     public String getUser_constellation() {
         return user_constellation;
     }
@@ -381,4 +386,12 @@ public class UserInfoModel {
     public void setIs_password(int is_password) {
         this.is_password = is_password;
     }
+
+    public int getIs_recharge() {
+        return is_recharge;
+    }
+
+    public void setIs_recharge(int is_recharge) {
+        this.is_recharge = is_recharge;
+    }
 }

+ 14 - 0
baseswago/src/main/java/com/swago/baseswago/model/live/RoomModel.java

@@ -1,5 +1,9 @@
 package com.swago.baseswago.model.live;
 
+import com.swago.baseswago.model.im.CusNewMsgBean;
+
+import java.util.List;
+
 /**
  * @date 2021/10/18 16:59
  * description:房间模型
@@ -51,6 +55,8 @@ public class RoomModel {
 
     private String broadcast_bg_url;
 
+    private CusNewMsgBean<RoomUserChangeModel> join_im_data;
+
     public String getRtc_token() {
         return rtc_token;
     }
@@ -266,4 +272,12 @@ public class RoomModel {
     public void setBroadcast_bg_url(String broadcast_bg_url) {
         this.broadcast_bg_url = broadcast_bg_url;
     }
+
+    public CusNewMsgBean<RoomUserChangeModel> getJoin_im_data() {
+        return join_im_data;
+    }
+
+    public void setJoin_im_data(CusNewMsgBean<RoomUserChangeModel> join_im_data) {
+        this.join_im_data = join_im_data;
+    }
 }

BIN
baseswago/src/main/res/mipmap-xxhdpi/default_avatar.png


+ 3 - 22
home/src/main/java/com/swago/home/HomeFragment.kt

@@ -94,25 +94,6 @@ class HomeFragment : BaseXFragment<FragmentHomeBinding>() {
                 startActivity(Intent(activity,SearchActivity::class.java))
             }
         })
-        binding.tvStartLive.setOnClickListener(object : NoDoubleClickListener() {
-            override fun onClick() {
-                binding.tvStartLive.isEnabled = false
-                PermissionX.init(this@HomeFragment)
-                    .permissions(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO)
-                    .request { allGranted, grantedList, deniedList ->
-                        if (allGranted) {
-                            ARouter.getInstance().build(ARouteConstant.Room.anchor).navigation()
-                        } else {
-                            binding.tvStartLive.isEnabled = true
-                            Toast.makeText(
-                                AppContext.getContext(),
-                                "These permissions are denied: $deniedList",
-                                Toast.LENGTH_LONG
-                            ).show()
-                        }
-                    }
-            }
-        })
 
         binding.ivRanking.setOnClickListener(object :NoDoubleClickListener(){
             override fun onClick() {
@@ -124,14 +105,14 @@ class HomeFragment : BaseXFragment<FragmentHomeBinding>() {
 
         binding.mtvLive.setOnClickListener(object :NoDoubleClickListener(){
             override fun onClick() {
-                binding.tvStartLive.isEnabled = false
+                binding.mtvLive.isEnabled = false
                 PermissionX.init(this@HomeFragment)
                     .permissions(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO)
                     .request { allGranted, grantedList, deniedList ->
                         if (allGranted) {
                             ARouter.getInstance().build(ARouteConstant.Room.anchor).navigation()
                         } else {
-                            binding.tvStartLive.isEnabled = true
+                            binding.mtvLive.isEnabled = true
                             Toast.makeText(
                                 AppContext.getContext(),
                                 "These permissions are denied: $deniedList",
@@ -179,6 +160,6 @@ class HomeFragment : BaseXFragment<FragmentHomeBinding>() {
 
     override fun onResume() {
         super.onResume()
-        binding.tvStartLive.isEnabled = true
+        binding.mtvLive.isEnabled = true
     }
 }

+ 0 - 32
home/src/main/res/layout/fragment_home.xml

@@ -42,27 +42,6 @@
         android:layout_marginEnd="10dp"
         android:src="@mipmap/ic_live"/>
 
-    <com.swago.baseswago.cusview.MediumTextView
-        android:id="@+id/tvStartLive"
-        android:gravity="center_vertical"
-        android:drawablePadding="4dp"
-        android:paddingStart="8dp"
-        android:paddingEnd="8dp"
-        android:paddingTop="5dp"
-        android:paddingBottom="5dp"
-        android:textSize="14dp"
-        android:textColor="@color/_000000"
-        android:drawableStart="@mipmap/icon_start_live"
-        app:layout_constraintTop_toTopOf="@+id/magicIndicator"
-        app:layout_constraintBottom_toBottomOf="@+id/magicIndicator"
-        app:layout_constraintEnd_toEndOf="parent"
-        android:layout_marginEnd="10dp"
-        android:background="@drawable/shape_white_20"
-        android:text="@string/live"
-        android:visibility="gone"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"/>
-
     <com.duolingo.open.rtlviewpager.RtlViewPager
         android:id="@+id/viewPager"
         app:layout_constraintTop_toBottomOf="@+id/magicIndicator"
@@ -70,17 +49,6 @@
         android:layout_width="match_parent"
         android:layout_height="0dp"/>
 
-    <ImageView
-        android:id="@+id/ivLive"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:src="@drawable/ic_add_contact"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        android:layout_marginRight="10dp"
-        android:layout_marginBottom="10dp"
-        android:visibility="gone"/>
-
     <com.swago.baseswago.cusview.MediumTextView
         android:id="@+id/mtv_live"
         android:layout_width="wrap_content"

BIN
home/src/main/res/mipmap-xxhdpi/ic_voice.png


+ 9 - 1
room/src/main/java/com/swago/room/base/BaseComFragment.kt

@@ -345,6 +345,14 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
             }
         }
 
+        roomVm.joinRoomUserDataLiveData.observe(this) {
+            it?.let {
+                roomUserList.clear()
+                roomUserList.addAll(it.users)
+                (iHeader as ComHeaderView).updateRoomUser(roomUserList, it.count)
+            }
+        }
+
         msgVm.updateUserRoom = { data, count ->
             roomUserList.clear()
             roomUserList.addAll(data)
@@ -787,7 +795,7 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
 
     override fun changeRoom(iRoomInfo: IRoomInfo) {
         binding.likeLayout.clear()
-       binding.rvAudio.visibility = View.GONE
+        binding.rvAudio.visibility = View.GONE
     }
 
     override fun leaveRoom(iRoomInfo: IRoomInfo) {

+ 4 - 7
room/src/main/java/com/swago/room/piaotiao/WaftView.kt

@@ -42,6 +42,7 @@ class WaftView : FrameLayout {
 
     private fun initView(context: Context) {
         binding = ViewWaftBinding.inflate(LayoutInflater.from(context), this, true)
+        SoundPoolPlayer.init(context)
     }
 
 
@@ -122,10 +123,7 @@ class WaftView : FrameLayout {
                     val multiple = "<font color='#FFDB43'>${next.multiple}</font>"
                     binding?.ll?.setBackgroundResource(R.mipmap.waft_big_prize)
                     binding?.marqueeTextView?.text = Html.fromHtml("\u200E${AppContext.getContext().resources.getString(R.string.big_prize).format(sendName,giftName,multiple)}")
-                    with(SoundPoolPlayer){
-                        init(context)
-                        playSound()
-                    }
+                    SoundPoolPlayer.playSound()
                 }else{
                     val sendName = "<font color='#FFDB43'>${next.senderName}</font>"
                     val giftName = "<font color='#FFDB43'>${localName}</font>"
@@ -170,9 +168,8 @@ class WaftView : FrameLayout {
         imGiftModelList.clear()
         animatorSet = null
         binding?.ll?.visibility = View.INVISIBLE
-        with( SoundPoolPlayer){
-            release()
-        }
+        SoundPoolPlayer.release()
+
     }
 
 }

+ 9 - 0
room/src/main/java/com/swago/room/vm/RoomVm.kt

@@ -60,6 +60,10 @@ class RoomVm(application: Application) : AbsRoomVm(application) {
                 val roomModel = ApiManager.roomApi.joinRoom(iRoomInfo.getRoomId())
                 val roomInfo = iRoomInfo as UserRoomModel
                 roomInfo.roomModel = roomModel
+                roomModel.join_im_data?.let {
+                    joinRoomUserDataLiveData.value = roomModel.join_im_data.data
+                }
+
                 callback.invoke(true)
             }
 
@@ -138,6 +142,11 @@ class RoomVm(application: Application) : AbsRoomVm(application) {
         MutableLiveData<RoomUserModel?>()
     }
 
+    //进入直播间观众列表
+    val joinRoomUserDataLiveData by lazy {
+        MutableLiveData<RoomUserChangeModel?>()
+    }
+
     fun loadRoomData(page:Int=1) {
         requestData2 {
             requestData {

BIN
room/src/main/res/raw/gift_sound.mp3


BIN
room/src/main/res/raw/gift_sound.wav


+ 17 - 0
tuikit/src/main/java/com/tencent/qcloud/tim/uikit/component/dialog/TUIKitDialog.java

@@ -29,6 +29,7 @@ public class TUIKitDialog {
     private Button mSureButton;
     private ImageView mLineImg;
     private Display mDisplay;
+    private TextView mContentTv;
 
     /**
      * 是否显示title
@@ -44,6 +45,11 @@ public class TUIKitDialog {
      */
     private boolean showNegBtn = false;
 
+    /***
+     * 是否显示内容按钮
+     * */
+    private boolean showContentBtn = false;
+
     /**
      * dialog  宽度
      */
@@ -69,6 +75,8 @@ public class TUIKitDialog {
         mSureButton.setVisibility(View.GONE);
         mLineImg = (ImageView) view.findViewById(R.id.img_line);
         mLineImg.setVisibility(View.GONE);
+        mContentTv = (TextView) view.findViewById(R.id.tv_content);
+        mContentTv.setVisibility(View.GONE);
 
         dialog = new Dialog(mContext, R.style.TUIKit_AlertDialogStyle);
         dialog.setContentView(view);
@@ -126,6 +134,12 @@ public class TUIKitDialog {
         return this;
     }
 
+    public TUIKitDialog setContentButton(String text){
+        showContentBtn = true;
+        mContentTv.setText(text);
+        return this;
+    }
+
     public TUIKitDialog setPositiveButton(final View.OnClickListener listener) {
         setPositiveButton(TUIKit.getAppContext().getString(R.string.sure), listener);
         return this;
@@ -190,6 +204,9 @@ public class TUIKitDialog {
         if (!showPosBtn && showNegBtn) {
             mCancelButton.setVisibility(View.VISIBLE);
         }
+        if (showContentBtn){
+            mContentTv.setVisibility(View.VISIBLE);
+        }
     }
 
     public void show() {

+ 40 - 9
tuikit/src/main/java/com/tencent/qcloud/tim/uikit/modules/chat/layout/input/InputLayout.java

@@ -1,6 +1,7 @@
 package com.tencent.qcloud.tim.uikit.modules.chat.layout.input;
 
 import android.annotation.SuppressLint;
+import android.app.Dialog;
 import android.content.Context;
 import android.content.Intent;
 import android.graphics.Bitmap;
@@ -30,6 +31,7 @@ import com.tencent.qcloud.tim.uikit.R;
 import com.tencent.qcloud.tim.uikit.TUIKit;
 import com.tencent.qcloud.tim.uikit.base.IUIKitCallBack;
 import com.tencent.qcloud.tim.uikit.component.AudioPlayer;
+import com.tencent.qcloud.tim.uikit.component.dialog.TUIKitDialog;
 import com.tencent.qcloud.tim.uikit.component.face.Emoji;
 import com.tencent.qcloud.tim.uikit.component.face.FaceFragment;
 import com.tencent.qcloud.tim.uikit.component.face.FaceManager;
@@ -40,6 +42,7 @@ import com.tencent.qcloud.tim.uikit.modules.chat.base.ChatInfo;
 import com.tencent.qcloud.tim.uikit.modules.chat.interfaces.IChatLayout;
 import com.tencent.qcloud.tim.uikit.modules.chat.layout.inputmore.InputMoreFragment;
 import com.tencent.qcloud.tim.uikit.modules.conversation.base.DraftInfo;
+import com.tencent.qcloud.tim.uikit.modules.forward.ForwardSelectActivity;
 import com.tencent.qcloud.tim.uikit.modules.message.MessageInfo;
 import com.tencent.qcloud.tim.uikit.modules.message.MessageInfoUtil;
 import com.tencent.qcloud.tim.uikit.utils.FileUtil;
@@ -541,19 +544,24 @@ public class InputLayout extends InputLayoutUI implements View.OnClickListener,
                     if (UserInfo.INSTANCE.getUserInfo().getPrivate_msg_status()==1){
                         Toast.makeText(AppContext.getContext(), AppContext.getContext().getResources().getString(R.string.you_are_been_forbid), Toast.LENGTH_SHORT).show();
                     }else {
-                        if (mMessageHandler != null) {
-                            if(mChatLayout.getChatInfo().getType() == V2TIMConversation.V2TIM_GROUP && !atUserInfoMap.isEmpty()) {
-                                //发送时通过获取输入框匹配上@的昵称list,去从map中获取ID list。
-                                List<String> atUserList = updateAtUserList(mTextInput.getMentionList(true));
-                                if (atUserList == null || atUserList.isEmpty()) {
-                                    mMessageHandler.sendMessage(MessageInfoUtil.buildTextMessage(mTextInput.getText().toString().trim()));
+                        if (Integer.parseInt(UserInfo.INSTANCE.getUserInfo().getUser_level()) >=5 || Integer.parseInt(UserInfo.INSTANCE.getUserInfo().getUser_wealth_level()) >=5 || UserInfo.INSTANCE.getUserInfo().getIs_recharge() ==1){
+                            if (mMessageHandler != null) {
+                                if(mChatLayout.getChatInfo().getType() == V2TIMConversation.V2TIM_GROUP && !atUserInfoMap.isEmpty()) {
+                                    //发送时通过获取输入框匹配上@的昵称list,去从map中获取ID list。
+                                    List<String> atUserList = updateAtUserList(mTextInput.getMentionList(true));
+                                    if (atUserList == null || atUserList.isEmpty()) {
+                                        mMessageHandler.sendMessage(MessageInfoUtil.buildTextMessage(mTextInput.getText().toString().trim()));
+                                    }else {
+                                        mMessageHandler.sendMessage(MessageInfoUtil.buildTextAtMessage(atUserList, mTextInput.getText().toString().trim()));
+                                    }
                                 }else {
-                                    mMessageHandler.sendMessage(MessageInfoUtil.buildTextAtMessage(atUserList, mTextInput.getText().toString().trim()));
+                                    mMessageHandler.sendMessage(MessageInfoUtil.buildTextMessage(mTextInput.getText().toString().trim()));
                                 }
-                            }else {
-                                mMessageHandler.sendMessage(MessageInfoUtil.buildTextMessage(mTextInput.getText().toString().trim()));
                             }
+                        } else {
+                            showLevelDialog();
                         }
+
                     }
                 }else {
                     if (mMessageHandler != null) {
@@ -575,6 +583,29 @@ public class InputLayout extends InputLayoutUI implements View.OnClickListener,
         }
     }
 
+    private void showLevelDialog() {
+        TUIKitDialog tipsDialog = new TUIKitDialog(getContext())
+                .builder()
+                .setCancelable(true)
+                .setCancelOutside(true)
+                .setTitle(getContext().getString(R.string.use_chats_fulfilment_of_one_condition))
+                .setDialogWidth(0.75f)
+                .setContentButton(getContext().getString(R.string.use_chats_condition_content))
+                .setPositiveButton(getContext().getString(R.string.recharge), new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+
+                    }
+                })
+                .setNegativeButton(getContext().getString(R.string.ok), new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+
+                    }
+                });
+        tipsDialog.show();
+    }
+
     private List<String> updateAtUserList(List<String> atMentionList){
         if (atMentionList == null || atMentionList.isEmpty()){
             return null;

+ 10 - 0
tuikit/src/main/res/layout/view_dialog.xml

@@ -18,6 +18,16 @@
         android:textSize="16sp"
         android:textStyle="bold" />
 
+    <TextView
+        android:id="@+id/tv_content"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="18dp"
+        android:layout_marginRight="18dp"
+        android:layout_marginTop="15dp"
+        android:textColor="@color/black"
+        android:textSize="16sp"
+        android:visibility="gone"/>
 
     <LinearLayout
         android:id="@+id/ll_alert"

+ 4 - 0
tuikit/src/main/res/values-zh-rCN/strings.xml

@@ -207,6 +207,10 @@
     <string name="video_extra">[视频]</string>
     <string name="audio_extra">[语音]</string>
     <string name="file_extra">[文件]</string>
+    <string name="use_chats_fulfilment_of_one_condition">使用聊天功能需满足以下一个条件:</string>
+    <string name="use_chats_condition_content">\n1. 充值金额>0 \n2. 等级≥5级</string>
+    <string name="recharge">充值</string>
+    <string name="ok">好的</string>
 
     <string name="etc">等</string>
     <string name="join_group">加入群组</string>

+ 4 - 0
tuikit/src/main/res/values/strings.xml

@@ -207,6 +207,10 @@
     <string name="video_extra">[Video]</string>
     <string name="audio_extra">[Voice]</string>
     <string name="file_extra">[File]</string>
+    <string name="use_chats_fulfilment_of_one_condition">Use of the chat function is subject to one of the following conditions:</string>
+    <string name="use_chats_condition_content">1. Recharge amount > 0 \n2. Level ≥5</string>
+    <string name="recharge">recharge</string>
+    <string name="ok">ok</string>
 
     <string name="etc">, etc.</string>
     <string name="join_group">Join Group</string>