|
|
@@ -1,10 +1,20 @@
|
|
|
package com.yingyangfly.game.introduction
|
|
|
|
|
|
+import android.annotation.SuppressLint
|
|
|
import android.os.Bundle
|
|
|
import android.text.TextUtils
|
|
|
+import android.view.MotionEvent
|
|
|
+import android.view.View
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
+import com.tencent.liteav.demo.superplayer.SuperPlayerModel
|
|
|
+import com.yingyangfly.baselib.bean.Record
|
|
|
+import com.yingyangfly.baselib.config.AccountConfig
|
|
|
+import com.yingyangfly.baselib.ext.getEndAnimation
|
|
|
+import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
|
import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
+import com.yingyangfly.baselib.utils.JumpUtil
|
|
|
+import com.yingyangfly.game.R
|
|
|
import com.yingyangfly.game.databinding.ActivityGameIntroductionBinding
|
|
|
|
|
|
/**
|
|
|
@@ -12,7 +22,8 @@ import com.yingyangfly.game.databinding.ActivityGameIntroductionBinding
|
|
|
*/
|
|
|
@Route(path = RouterUrlCommon.gameIntroduction)
|
|
|
class GameIntroductionActivity :
|
|
|
- BaseMVVMActivity<ActivityGameIntroductionBinding, GameIntroductionViewModel>() {
|
|
|
+ BaseMVVMActivity<ActivityGameIntroductionBinding, GameIntroductionViewModel>(),
|
|
|
+ View.OnTouchListener {
|
|
|
|
|
|
private var url: String = ""
|
|
|
|
|
|
@@ -26,8 +37,12 @@ class GameIntroductionActivity :
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @SuppressLint("ClickableViewAccessibility")
|
|
|
override fun initListener() {
|
|
|
-
|
|
|
+ binding {
|
|
|
+ homeImage.setOnTouchListener(this@GameIntroductionActivity)
|
|
|
+ btnStartGame.setOnTouchListener(this@GameIntroductionActivity)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override fun initData() {
|
|
|
@@ -42,8 +57,43 @@ class GameIntroductionActivity :
|
|
|
}, success = {
|
|
|
if (it != null) {
|
|
|
binding.data = it
|
|
|
+ if (TextUtils.isEmpty(it.gameVideoUrl).not()) {
|
|
|
+ initPalyer(it)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化播放器
|
|
|
+ */
|
|
|
+ private fun initPalyer(bean: Record) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressLint("ClickableViewAccessibility")
|
|
|
+ override fun onTouch(v: View, event: MotionEvent): Boolean {
|
|
|
+ when (event.action) {
|
|
|
+ MotionEvent.ACTION_DOWN -> {
|
|
|
+ if (v.id == R.id.homeImage || v.id == R.id.btnStartGame) {
|
|
|
+ v.startAnimation(getScaleAnimation())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ MotionEvent.ACTION_UP -> {
|
|
|
+ v.startAnimation(getEndAnimation())
|
|
|
+ if (v.id == R.id.homeImage) {
|
|
|
+ JumpUtil.jumpActivity(RouterUrlCommon.home, mContext)
|
|
|
+ } else if (v.id == R.id.btnStartGame) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ MotionEvent.ACTION_CANCEL -> {
|
|
|
+ if (v.id == R.id.homeImage || v.id == R.id.btnStartGame) {
|
|
|
+ v.startAnimation(getEndAnimation())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
}
|