|
@@ -13,6 +13,8 @@ import com.yingyang.livebroadcast.R
|
|
|
import com.yingyang.livebroadcast.databinding.ActivityLiveBroadcastBinding
|
|
import com.yingyang.livebroadcast.databinding.ActivityLiveBroadcastBinding
|
|
|
import com.yingyangfly.baselib.ext.getEndAnimation
|
|
import com.yingyangfly.baselib.ext.getEndAnimation
|
|
|
import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
|
|
|
+import com.yingyangfly.baselib.ext.show
|
|
|
|
|
+import com.yingyangfly.baselib.ext.toast
|
|
|
import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
import com.yingyangfly.baselib.utils.User
|
|
import com.yingyangfly.baselib.utils.User
|
|
@@ -43,11 +45,17 @@ class LiveBroadcastActivity :
|
|
|
initPlayer()
|
|
initPlayer()
|
|
|
//上报直播间心跳
|
|
//上报直播间心跳
|
|
|
initTask()
|
|
initTask()
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
|
override fun initListener() {
|
|
override fun initListener() {
|
|
|
- binding.backLayout.setOnTouchListener(this@LiveBroadcastActivity)
|
|
|
|
|
|
|
+ binding {
|
|
|
|
|
+ backLayout.setOnTouchListener(this@LiveBroadcastActivity)
|
|
|
|
|
+ btnYes.setOnTouchListener(this@LiveBroadcastActivity)
|
|
|
|
|
+ btnNo.setOnTouchListener(this@LiveBroadcastActivity)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun initData() {
|
|
override fun initData() {
|
|
@@ -90,18 +98,26 @@ class LiveBroadcastActivity :
|
|
|
override fun onTouch(v: View, event: MotionEvent): Boolean {
|
|
override fun onTouch(v: View, event: MotionEvent): Boolean {
|
|
|
when (event.action) {
|
|
when (event.action) {
|
|
|
MotionEvent.ACTION_DOWN -> {
|
|
MotionEvent.ACTION_DOWN -> {
|
|
|
- if (v.id == R.id.backLayout) {
|
|
|
|
|
|
|
+ if (v.id == R.id.backLayout || v.id == R.id.btnYes || v.id == R.id.btnNo) {
|
|
|
v.startAnimation(getScaleAnimation())
|
|
v.startAnimation(getScaleAnimation())
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
MotionEvent.ACTION_UP -> {
|
|
MotionEvent.ACTION_UP -> {
|
|
|
v.startAnimation(getEndAnimation())
|
|
v.startAnimation(getEndAnimation())
|
|
|
- if (v.id == R.id.backLayout) {
|
|
|
|
|
- finish()
|
|
|
|
|
|
|
+ when (v.id) {
|
|
|
|
|
+ R.id.backLayout -> {
|
|
|
|
|
+ finish()
|
|
|
|
|
+ }
|
|
|
|
|
+ R.id.btnYes -> {
|
|
|
|
|
+ liveYesorno("0")
|
|
|
|
|
+ }
|
|
|
|
|
+ R.id.btnNo -> {
|
|
|
|
|
+ liveYesorno("1")
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
MotionEvent.ACTION_CANCEL -> {
|
|
MotionEvent.ACTION_CANCEL -> {
|
|
|
- if (v.id == R.id.backLayout) {
|
|
|
|
|
|
|
+ if (v.id == R.id.backLayout || v.id == R.id.btnYes || v.id == R.id.btnNo) {
|
|
|
v.startAnimation(getEndAnimation())
|
|
v.startAnimation(getEndAnimation())
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -138,4 +154,18 @@ class LiveBroadcastActivity :
|
|
|
|
|
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 直播统计是和否
|
|
|
|
|
+ */
|
|
|
|
|
+ private fun liveYesorno(status: String) {
|
|
|
|
|
+ viewModel.liveYesorno(liveId, status, fail = {
|
|
|
|
|
+ it.toast()
|
|
|
|
|
+ }, success = {
|
|
|
|
|
+ binding {
|
|
|
|
|
+ btnYes.show(false)
|
|
|
|
|
+ btnNo.show(false)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|