Ver código fonte

feat: 不同入口小黑屋

tongmengxiao 5 meses atrás
pai
commit
0ceca2dca2

+ 27 - 0
baseswago/src/main/java/com/swago/baseswago/model/BlackListModel.java

@@ -53,6 +53,9 @@ public class BlackListModel {
         private int is_official;
         private int is_crown;
         private int is_cup;
+        private int user_broadcast_status;
+        private int broadcast_password_status;
+        private int user_broadcast_type; //直播间类型(1视频2语音)
 
         public String getUser_name() {
             return user_name;
@@ -141,5 +144,29 @@ public class BlackListModel {
         public void setIs_cup(int is_cup) {
             this.is_cup = is_cup;
         }
+
+        public int getUser_broadcast_status() {
+            return user_broadcast_status;
+        }
+
+        public void setUser_broadcast_status(int user_broadcast_status) {
+            this.user_broadcast_status = user_broadcast_status;
+        }
+
+        public int getBroadcast_password_status() {
+            return broadcast_password_status;
+        }
+
+        public void setBroadcast_password_status(int broadcast_password_status) {
+            this.broadcast_password_status = broadcast_password_status;
+        }
+
+        public int getUser_broadcast_type() {
+            return user_broadcast_type;
+        }
+
+        public void setUser_broadcast_type(int user_broadcast_type) {
+            this.user_broadcast_type = user_broadcast_type;
+        }
     }
 }

+ 5 - 13
home/src/main/java/com/swago/home/innerhome/FollowFragment.kt

@@ -43,19 +43,11 @@ class FollowFragment : BaseListFragment<FragmentHotBinding, MomentModel>(){
         smartRecyclerView.recyclerView?.addItemDecoration(ComGridItemDecoration())
         adapter.setOnItemClickListener { _, _, position ->
             if (adapter.data.size>position){
-                if (adapter.data[position].user_broadcast_status == 1){
-                    ARouter.getInstance()
-                        .build(ARouteConstant.Room.user)
-                        .withInt("position",position)
-                        .withParcelableArrayList("data",adapter.data as ArrayList<MomentModel>)
-                        .navigation()
-                }else{
-                    ARouter.getInstance()
-                        .build(ARouteConstant.Room.user)
-                        .withInt("position",position)
-                        .withParcelableArrayList("data",adapter.data as ArrayList<MomentModel>)
-                        .navigation()
-                }
+                ARouter.getInstance()
+                    .build(ARouteConstant.Room.user)
+                    .withInt("position",position)
+                    .withParcelableArrayList("data",adapter.data as ArrayList<MomentModel>)
+                    .navigation()
             }
 
         }

+ 5 - 12
home/src/main/java/com/swago/home/search/SearchActivity.kt

@@ -71,18 +71,11 @@ class SearchActivity : BaseListActivity<ActivitySearchBinding, MomentModel>() {
 
         adapter.setOnItemClickListener { _, _, position ->
             if (adapter.data.size>position){
-                if (adapter.data[position].user_broadcast_status == 1){
-                    ARouter.getInstance()
-                        .build(ARouteConstant.Room.user)
-                        .withInt("position",position)
-                        .withParcelableArrayList("data",adapter.data as ArrayList<MomentModel>)
-                        .navigation()
-                }else{
-                    PersonDataDFragment.newInstance(adapter.data[position].id,
-                        isAnchor = true,
-                        inRoom = false
-                    ).show(supportFragmentManager,"PersonDataDFragment")
-                }
+                ARouter.getInstance()
+                    .build(ARouteConstant.Room.user)
+                    .withInt("position",position)
+                    .withParcelableArrayList("data",adapter.data as ArrayList<MomentModel>)
+                    .navigation()
             }
         }
     }

+ 2 - 0
home/src/main/res/layout/activity_search.xml

@@ -32,6 +32,8 @@
         android:textSize="12dp"
         android:paddingStart="10dp"
         android:hint="@string/search_name_or_id"
+        android:supportsRtl="true"
+        android:textDirection="locale"
         android:textColorHint="#868686"
         android:background="@drawable/shape_white_20"
         app:layout_constraintBottom_toBottomOf="@+id/toolbar"

+ 3 - 1
room/src/main/java/com/swago/room/anchor/AnchorRoomActivity.kt

@@ -102,7 +102,7 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
 
     private lateinit var countDownTimer: CountDownTimer
     private var startFaceShowTimer = true
-    private var liveNoFaceTime:Long = 600000
+    private var liveNoFaceTime:Long =  600000
 
     override fun initLiveData() {
         PKStateManager.resetData()
@@ -170,6 +170,8 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
                 if (roomType == RoomType.AUDIO) return
                 AgoraManager.setVideoAudio(pullVideo = false, pullAudio = true, pushVideo = false, pushAudio = true)
                 roomType = RoomType.AUDIO
+                startFaceShowTimer = true
+                countDownTimer.cancel()
                 binding.viewAudio.visibility = View.VISIBLE
                 binding.viewVideo.visibility = View.INVISIBLE
                 binding.tvVideo.setTextColor(ContextCompat.getColor(AppContext.getContext(),R.color._d4ffffff))

+ 0 - 232
room/src/main/java/com/swago/room/black/BlackRoomActivity.kt

@@ -1,232 +0,0 @@
-package com.swago.room.black
-
-import android.view.View
-import android.view.ViewGroup
-import android.view.WindowManager
-import android.widget.FrameLayout
-import android.widget.ImageView
-import android.widget.Toast
-import androidx.activity.viewModels
-import androidx.constraintlayout.widget.ConstraintLayout
-import com.alibaba.android.arouter.facade.annotation.Autowired
-import com.alibaba.android.arouter.facade.annotation.Route
-import com.alibaba.android.arouter.launcher.ARouter
-import com.bumptech.glide.Glide
-import com.bumptech.glide.request.RequestOptions
-import com.gyf.immersionbar.ImmersionBar
-import com.swago.baseswago.SwagoAdapter
-import com.swago.baseswago.agora.AgoraManager
-import com.swago.baseswago.baseroom.IRoomInfo
-import com.swago.baseswago.baseroom.SwagoRoomManager
-import com.swago.baseswago.baseroom.ui.AbsUserActivity
-import com.swago.baseswago.constant.ARouteConstant
-import com.swago.baseswago.databinding.ActivityAbsRoomUserBinding
-import com.swago.baseswago.model.MomentModel
-import com.swago.baseswago.util.*
-import com.swago.room.R
-import com.swago.room.audio.AudioRoomManager
-import com.swago.room.base.NoContentFragment
-import com.swago.room.bean.UserRoomModel
-import com.swago.room.data.RoomDataManager
-import com.swago.room.enum.RoomType
-import com.swago.room.lianmai.LianMaiManager
-import com.swago.room.pk.PKStateManager
-import com.swago.room.user.UserRoomFragment
-import com.swago.room.vm.MsgVm
-import com.swago.room.vm.RoomVm
-import com.swago.room.widget.ChoiceViewPager
-import com.swago.room.widget.UserShowAnchorCloseView
-import jp.wasabeef.glide.transformations.BlurTransformation
-import java.util.concurrent.CopyOnWriteArrayList
-
-@Route(path = ARouteConstant.Room.black)
-class BlackRoomActivity : AbsUserActivity<ActivityAbsRoomUserBinding, UserRoomModel>(){
-
-    private val roomVm by viewModels<RoomVm>()
-    private val msgVm by viewModels<MsgVm>()
-
-    private val fragments by lazy{
-        listOf(NoContentFragment(), UserRoomFragment())
-    }
-
-    @Autowired
-    @JvmField
-    var position: Int = 0
-
-    @Autowired
-    @JvmField
-    var data: ArrayList<MomentModel>? = null
-
-    private var userRoomFragment: UserRoomFragment? = null
-
-    private var ivClose: ImageView? = null
-    private var ivCover: ImageView? = null
-    private var userShowAnchorCloseView: UserShowAnchorCloseView? = null
-    private var flRoot: FrameLayout? = null
-    private var peerFl: FrameLayout? = null
-    private var choiceViewPager:ChoiceViewPager? = null
-
-    override val roomCoverView: ViewGroup by lazy {
-        val userRoomView = layoutInflater.inflate(R.layout.layout_user_room, null) as ViewGroup
-        choiceViewPager = userRoomView.findViewById<ChoiceViewPager>(R.id.viewPager)
-        ivClose = userRoomView.findViewById(R.id.ivClose)
-        userShowAnchorCloseView = userRoomView.findViewById(R.id.userShowAnchorCloseView)
-//        ivCover = userRoomView.findViewById(R.id.ivCover)
-        flRoot = userRoomView.findViewById(R.id.flRoot)
-        peerFl = userRoomView.findViewById(R.id.peerFl)
-        choiceViewPager?.adapter = SwagoAdapter(fragments, supportFragmentManager)
-        choiceViewPager?.currentItem = 1
-        userRoomView
-    }
-
-
-    override var mCurrentPosition: Int = position
-    override var iRoomInfos: CopyOnWriteArrayList<UserRoomModel> = RoomDataManager.data
-
-    override fun initUserRoomView() {
-        ARouter.getInstance().inject(this)
-        mCurrentPosition = position
-        RoomDataManager.initData(data)
-        userRoomFragment = fragments[1] as UserRoomFragment
-
-        roomVm.init()
-        msgVm.init()
-        initPeerAnchorLayoutParams()
-        window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
-
-        ivClose?.setOnClickListener(object : NoDoubleClickListener() {
-            override fun onClick() {
-
-                finish()
-
-            }
-        })
-
-
-    }
-
-    override fun initLiveData() {
-        msgVm.anchorRoomClosed = {
-            userShowAnchorCloseView?.visibility = View.VISIBLE
-            it?.let { userShowAnchorCloseView?.setData(it) }
-            SwagoRoomManager.receiveStopLive()
-        }
-
-        msgVm.kickFromRoom = {
-            Toast.makeText(
-                AppContext.getContext(),
-                AppContext.getContext().resources.getString(R.string.be_kick_out),
-                Toast.LENGTH_SHORT
-            ).show()
-            SwagoRoomManager.closeRoom()
-        }
-
-        roomVm.roomClosedLiveData.observe(this) {
-            userShowAnchorCloseView?.visibility = View.VISIBLE
-            it?.let { userShowAnchorCloseView?.setData(it) }
-        }
-
-        roomVm.momentModelLiveData.observe(this) {
-            val userRoomModel = UserRoomModel()
-            userRoomModel.momentModel = it
-            iRoomInfos.add(userRoomModel)
-            scrollToPosition(iRoomInfos.lastIndex)
-        }
-    }
-
-    override fun changeRoom(iRoomInfo: IRoomInfo) {
-        isRobot = iRoomInfo.getIsRobot()
-        ivCover?.let {
-            Glide.with(this)
-                .load(iRoomInfo.getRoomCover())
-                .dontAnimate()
-                .apply(RequestOptions.bitmapTransform(BlurTransformation(5, 100)))
-                .into(it)
-        }
-        ivCover?.visibility = View.VISIBLE
-        userShowAnchorCloseView?.visibility = View.INVISIBLE
-
-        when(iRoomInfo.getRoomType()){
-            RoomType.VIDEO.type -> {
-                choiceViewPager?.setCanScroll(true)
-                AgoraManager.setVideoAudio(
-                    pullVideo = true,
-                    pullAudio = true,
-                    pushVideo = false,
-                    pushAudio = false
-                )
-            }
-
-            RoomType.AUDIO.type -> {
-                choiceViewPager?.setCanScroll(false)
-                AgoraManager.setVideoAudio(
-                    pullVideo = false,
-                    pullAudio = true,
-                    pushVideo = false,
-                    pushAudio = false
-                )
-            }
-
-            RoomType.NULL.type -> {}
-        }
-    }
-
-    override fun leaveRoom(iRoomInfo: IRoomInfo) {
-
-    }
-
-    override fun joinedRoom(iRoomInfo: IRoomInfo) {
-            ivCover?.visibility = View.GONE
-    }
-
-    override fun receiveStopLive() {
-        AudioRoomManager.resetData()
-        SwagoRoomManager.iRoomInfo?.let {
-            if (it.getRoomType() == RoomType.AUDIO.type){
-                AgoraManager.setVideoAudio(
-                    pullVideo = false,
-                    pullAudio = false,
-                    pushVideo = false,
-                    pushAudio = false
-                )
-            }
-        }
-    }
-
-    override fun endRoom(iRoomInfo: IRoomInfo?) {
-    }
-
-    override fun closeRoomed() {
-    }
-
-    override fun onBackPressed() {
-        SwagoRoomManager.closeRoom()
-    }
-
-    override fun onDestroy() {
-        super.onDestroy()
-    }
-
-    private var isRobot = false
-
-
-    private val marginTopValue by lazy {
-        ImmersionBar.getStatusBarHeight(this) + DpPxUtil.dip2px(78f)
-    }
-
-    private fun initPeerAnchorLayoutParams() {
-        val x = DpPxUtil.getScreenWidth() / 2
-        val y = DpPxUtil.getScreenWidth() * 275 / 360
-        val params = ConstraintLayout.LayoutParams(x, y)
-        params.topToTop = R.id.rootUserView
-        params.endToEnd = R.id.rootUserView
-        params.width = x
-        params.height = y
-        params.topMargin = marginTopValue
-        peerFl?.layoutParams = params
-    }
-
-    override fun moveTaskToBack(nonRoot: Boolean): Boolean {
-        return super.moveTaskToBack(true)
-    }
-}

+ 2 - 2
room/src/main/res/layout/dialog_anchor_close.xml

@@ -190,7 +190,7 @@
         android:textSize="16dp"
         android:textColor="#fff"
         android:text="@string/video_valid_days_this_week"
-        android:layout_marginBottom="100dp"
+        android:layout_marginBottom="80dp"
         android:layout_marginStart="32dp"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintBottom_toTopOf="@+id/tvClose"
@@ -202,7 +202,7 @@
         android:textSize="16dp"
         android:textColor="#fff"
         tools:text="100"
-        android:layout_marginBottom="100dp"
+        android:layout_marginBottom="80dp"
         android:layout_marginEnd="32dp"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintBottom_toTopOf="@+id/tvClose"

+ 4 - 1
user/src/main/java/com/swago/user/FollowAndFansActivity.kt

@@ -96,10 +96,13 @@ class FollowAndFansActivity : BaseListActivity<LayoutListBinding, BlackListModel
                     momentModel.user_name = adapter.data[position].user_name
                     momentModel.user_head_img_url = adapter.data[position].user_head_img_url
                     momentModel.user_sex = adapter.data[position].user_sex
+                    momentModel.user_broadcast_status = adapter.data[position].user_broadcast_status
+                    momentModel.broadcast_password_status = adapter.data[position].broadcast_password_status
+                    momentModel.user_broadcast_type = adapter.data[position].user_broadcast_type
                     momentModelList.clear()
                     momentModelList.add(momentModel)
                     ARouter.getInstance()
-                        .build(ARouteConstant.Room.black)
+                        .build(ARouteConstant.Room.user)
                         .withInt("position",0)
                         .withParcelableArrayList("data",momentModelList)
                         .navigation()