|
|
@@ -108,9 +108,7 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
tvPause.setOnTouchListener(this@PlayGameActivity)
|
|
|
tvPauses.setOnTouchListener(this@PlayGameActivity)
|
|
|
tvFullScreen.setOnTouchListener(this@PlayGameActivity)
|
|
|
- tvReduce.setOnSingleClickListener {
|
|
|
- setReduce(true)
|
|
|
- }
|
|
|
+ tvReduce.setOnTouchListener(this@PlayGameActivity)
|
|
|
}
|
|
|
binding.gameLayout.viewTreeObserver.addOnGlobalLayoutListener(object :
|
|
|
ViewTreeObserver.OnGlobalLayoutListener {
|
|
|
@@ -226,30 +224,36 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
override fun onTouch(v: View, event: MotionEvent): Boolean {
|
|
|
when (event.action) {
|
|
|
MotionEvent.ACTION_DOWN -> {
|
|
|
- if (v.id == R.id.tvPause || v.id == R.id.tvPauses || v.id == R.id.tvFullScreen) {
|
|
|
+ if (v.id == R.id.tvPause || v.id == R.id.tvPauses || v.id == R.id.tvFullScreen || v.id == R.id.tvReduce) {
|
|
|
v.startAnimation(getScaleAnimation())
|
|
|
}
|
|
|
}
|
|
|
MotionEvent.ACTION_UP -> {
|
|
|
v.startAnimation(getEndAnimation())
|
|
|
- if (v.id == R.id.tvPause || v.id == R.id.tvPauses) {
|
|
|
- runOnUiThread {
|
|
|
- binding.webView.evaluateJavascript(
|
|
|
- "javascript:CallPauseGame()"
|
|
|
- ) {
|
|
|
- ARouter.getInstance().build(RouterUrlCommon.gameIntroduction)
|
|
|
- .withString("gameCode", gameCode)
|
|
|
- .withString("playClass", playClass)
|
|
|
- .withTransition(R.anim.leftin, R.anim.leftout)
|
|
|
- .navigation(mContext)
|
|
|
+ when (v.id) {
|
|
|
+ R.id.tvPause, R.id.tvPauses -> {
|
|
|
+ runOnUiThread {
|
|
|
+ binding.webView.evaluateJavascript(
|
|
|
+ "javascript:CallPauseGame()"
|
|
|
+ ) {
|
|
|
+ ARouter.getInstance().build(RouterUrlCommon.gameIntroduction)
|
|
|
+ .withString("gameCode", gameCode)
|
|
|
+ .withString("playClass", playClass)
|
|
|
+ .withTransition(R.anim.leftin, R.anim.leftout)
|
|
|
+ .navigation(mContext)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- } else if (v.id == R.id.tvFullScreen) {
|
|
|
- setReduce(false)
|
|
|
+ R.id.tvFullScreen -> {
|
|
|
+ setReduce(false)
|
|
|
+ }
|
|
|
+ R.id.tvReduce -> {
|
|
|
+ setReduce(true)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
MotionEvent.ACTION_CANCEL -> {
|
|
|
- if (v.id == R.id.tvPause || v.id == R.id.tvPauses || v.id == R.id.tvFullScreen) {
|
|
|
+ if (v.id == R.id.tvPause || v.id == R.id.tvPauses || v.id == R.id.tvFullScreen || v.id == R.id.tvReduce) {
|
|
|
v.startAnimation(getEndAnimation())
|
|
|
}
|
|
|
}
|
|
|
@@ -427,6 +431,12 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
LiveEventBusUtil.observer<String>(this, RxBusCodes.COUNTDOWNSUCCESS) {
|
|
|
countdownSuccess = true
|
|
|
}
|
|
|
+ //游戏设置全屏
|
|
|
+ LiveEventBusUtil.observer<String>(this, RxBusCodes.GAMEFULLSCREEN) {
|
|
|
+ binding.webView.post {
|
|
|
+ setReduce(false)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|