|
|
@@ -3,18 +3,15 @@ package com.yingyang.workbenches
|
|
|
import android.annotation.SuppressLint
|
|
|
import androidx.recyclerview.widget.GridLayoutManager
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
-import com.bumptech.glide.Glide
|
|
|
import com.yingyang.workbenches.adapter.GameAdapter
|
|
|
import com.yingyang.workbenches.databinding.ActivityWorkbenchesBinding
|
|
|
-import com.yingyang.workbenches.entity.Record
|
|
|
import com.yingyangfly.baselib.dialog.TipDialogFragment
|
|
|
+import com.yingyangfly.baselib.ext.loge
|
|
|
import com.yingyangfly.baselib.ext.setOnSingleClickListener
|
|
|
import com.yingyangfly.baselib.ext.toast
|
|
|
import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
|
-import com.yingyangfly.baselib.permissions.EsayPermissions
|
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
import com.yingyangfly.baselib.utils.JumpUtil
|
|
|
-import com.yingyangfly.baselib.utils.User
|
|
|
|
|
|
/**
|
|
|
* 工作台
|
|
|
@@ -33,7 +30,7 @@ class WorkbenchesActivity : BaseMVVMActivity<ActivityWorkbenchesBinding, Workben
|
|
|
rvGame.adapter = gameAdapter
|
|
|
}
|
|
|
gameAdapter.onGameImageClickListener = { bean ->
|
|
|
-// if (bean.currentLevel == bean.totalLevel) {
|
|
|
+ if (bean.currentLevel == bean.totalLevel) {
|
|
|
TipDialogFragment.TipDialogBuilder()
|
|
|
.title("当前游戏已通关,是否重新开始?", 0)
|
|
|
.leftBtnText("确定")
|
|
|
@@ -50,12 +47,12 @@ class WorkbenchesActivity : BaseMVVMActivity<ActivityWorkbenchesBinding, Workben
|
|
|
}, true)
|
|
|
.outCancel(true)
|
|
|
.show(supportFragmentManager)
|
|
|
-// } else {
|
|
|
-// jumpWebView(
|
|
|
-// bean.gameUrl, bean.desn ?: "",
|
|
|
-// bean.currentLevel ?: ""
|
|
|
-// )
|
|
|
-// }
|
|
|
+ } else {
|
|
|
+ jumpWebView(
|
|
|
+ bean.gameUrl, bean.desn ?: "",
|
|
|
+ bean.currentLevel ?: ""
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -125,10 +122,12 @@ class WorkbenchesActivity : BaseMVVMActivity<ActivityWorkbenchesBinding, Workben
|
|
|
|
|
|
override fun onResume() {
|
|
|
super.onResume()
|
|
|
- //加载游戏列表
|
|
|
- getGameList()
|
|
|
//获取脑力值和训练时长接口
|
|
|
getCountTrain()
|
|
|
+ //查询是否有进行中的任务
|
|
|
+ getFindMyTask()
|
|
|
+ //加载游戏列表
|
|
|
+ getGameList()
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -142,6 +141,21 @@ class WorkbenchesActivity : BaseMVVMActivity<ActivityWorkbenchesBinding, Workben
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询是否有进行中的任务
|
|
|
+ */
|
|
|
+ private fun getFindMyTask() {
|
|
|
+ viewModel.getFindMyTask(fail = {
|
|
|
+ it.toast()
|
|
|
+ }, success = {
|
|
|
+ if (it.isNullOrEmpty().not()) {
|
|
|
+ "有正在进行中的任务".loge()
|
|
|
+ } else {
|
|
|
+ "没有正在进行中的任务".loge()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 跳转游戏列表
|
|
|
*/
|