|
@@ -51,6 +51,9 @@ class PKLayoutView : ConstraintLayout, IRoomActiveListener, IPKListener,
|
|
|
//主播获取PK信息
|
|
|
var doGetPKInfoFun:(()->Unit)? = null
|
|
|
|
|
|
+ //跳转到对方Pk直播间
|
|
|
+ var doOtherRoomFun:((startPKModel: StartPKModel?)->Unit)? = null
|
|
|
+
|
|
|
constructor(context: Context) : this(context, null)
|
|
|
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
|
|
|
constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super(
|
|
@@ -70,9 +73,9 @@ class PKLayoutView : ConstraintLayout, IRoomActiveListener, IPKListener,
|
|
|
svgParserProgress = SVGAParser(context)
|
|
|
playProgress("laugh.svga")
|
|
|
binding?.let {
|
|
|
- it.rvSelf.layoutManager = LinearLayoutManager(context)
|
|
|
+ it.rvSelf.layoutManager = LinearLayoutManager(context,LinearLayoutManager.HORIZONTAL,false)
|
|
|
it.rvSelf.adapter = selfAdapter
|
|
|
- it.rvPeer.layoutManager = LinearLayoutManager(context)
|
|
|
+ it.rvPeer.layoutManager = LinearLayoutManager(context,LinearLayoutManager.HORIZONTAL,false)
|
|
|
it.rvPeer.adapter = peerAdapter
|
|
|
|
|
|
selfAdapter.setOnItemClickListener { _, _, position ->
|
|
@@ -81,6 +84,9 @@ class PKLayoutView : ConstraintLayout, IRoomActiveListener, IPKListener,
|
|
|
peerAdapter.setOnItemClickListener { _, _, position ->
|
|
|
|
|
|
}
|
|
|
+ it.clPeer.setOnClickListener {
|
|
|
+ doOtherRoomFun?.invoke(startPKModel)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -90,7 +96,7 @@ class PKLayoutView : ConstraintLayout, IRoomActiveListener, IPKListener,
|
|
|
svgProcessLayoutParams.startToStart = R.id.view
|
|
|
svgProcessLayoutParams.topToBottom = R.id.view
|
|
|
svgProcessLayoutParams.topMargin = DpPxUtil.dip2px(-3f)
|
|
|
- svgProcessLayoutParams.marginStart = DpPxUtil.getScreenWidth()/2
|
|
|
+ svgProcessLayoutParams.marginStart = DpPxUtil.getScreenWidth()/2- DpPxUtil.dip2px(10f)
|
|
|
svgProgress.layoutParams = svgProcessLayoutParams
|
|
|
}
|
|
|
|
|
@@ -254,13 +260,7 @@ class PKLayoutView : ConstraintLayout, IRoomActiveListener, IPKListener,
|
|
|
val svgProcessLayoutParams = ConstraintLayout.LayoutParams(DpPxUtil.dip2px(20f),DpPxUtil.dip2px(20f))
|
|
|
svgProcessLayoutParams.startToStart = R.id.view
|
|
|
svgProcessLayoutParams.topToBottom = R.id.view
|
|
|
- if (mProgress>50){
|
|
|
- svgProcessLayoutParams.marginStart = DpPxUtil.getScreenWidth()/100*mProgress + DpPxUtil.dip2px(10f)
|
|
|
- }else if(mProgress<50){
|
|
|
- svgProcessLayoutParams.marginStart = DpPxUtil.getScreenWidth()/100*mProgress - DpPxUtil.dip2px(10f)
|
|
|
- }else{
|
|
|
- svgProcessLayoutParams.marginStart = DpPxUtil.getScreenWidth()/100*mProgress
|
|
|
- }
|
|
|
+ svgProcessLayoutParams.marginStart = (DpPxUtil.getScreenWidth()/100f*mProgress).toInt() - DpPxUtil.dip2px(10f)
|
|
|
|
|
|
svgProcessLayoutParams.topMargin = DpPxUtil.dip2px(-3f)
|
|
|
svgProgress.layoutParams = svgProcessLayoutParams
|
|
@@ -288,13 +288,7 @@ class PKLayoutView : ConstraintLayout, IRoomActiveListener, IPKListener,
|
|
|
val svgProcessLayoutParams = ConstraintLayout.LayoutParams(DpPxUtil.dip2px(20f),DpPxUtil.dip2px(20f))
|
|
|
svgProcessLayoutParams.startToStart = R.id.view
|
|
|
svgProcessLayoutParams.topToBottom = R.id.view
|
|
|
- if (mProgress>50){
|
|
|
- svgProcessLayoutParams.marginStart = DpPxUtil.getScreenWidth()/100*mProgress + DpPxUtil.dip2px(10f)
|
|
|
- }else if(mProgress<50){
|
|
|
- svgProcessLayoutParams.marginStart = DpPxUtil.getScreenWidth()/100*mProgress - DpPxUtil.dip2px(10f)
|
|
|
- }else{
|
|
|
- svgProcessLayoutParams.marginStart = DpPxUtil.getScreenWidth()/100*mProgress
|
|
|
- }
|
|
|
+ svgProcessLayoutParams.marginStart = (DpPxUtil.getScreenWidth()/100f*mProgress).toInt() - DpPxUtil.dip2px(10f)
|
|
|
svgProcessLayoutParams.topMargin = DpPxUtil.dip2px(-3f)
|
|
|
svgProgress.layoutParams = svgProcessLayoutParams
|
|
|
}
|