|
@@ -12,6 +12,7 @@ import com.nova.brain.glass.helper.AsrHelper
|
|
|
import com.nova.brain.glass.helper.IntentRecognizeHelper
|
|
import com.nova.brain.glass.helper.IntentRecognizeHelper
|
|
|
import com.nova.brain.glass.helper.OfflineCmdListener
|
|
import com.nova.brain.glass.helper.OfflineCmdListener
|
|
|
import com.nova.brain.glass.helper.OfflineCmdServiceHelper
|
|
import com.nova.brain.glass.helper.OfflineCmdServiceHelper
|
|
|
|
|
+import com.nova.brain.glass.model.RecognizeParams
|
|
|
import com.nova.brain.glass.viewmodel.WelcomeVM
|
|
import com.nova.brain.glass.viewmodel.WelcomeVM
|
|
|
import com.xuqm.base.ui.BaseActivity
|
|
import com.xuqm.base.ui.BaseActivity
|
|
|
|
|
|
|
@@ -59,13 +60,15 @@ class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {
|
|
|
IntentRecognizeHelper.recognize(
|
|
IntentRecognizeHelper.recognize(
|
|
|
text = "查看我的任务列表?",
|
|
text = "查看我的任务列表?",
|
|
|
onSuccess = { action ->
|
|
onSuccess = { action ->
|
|
|
- if (action.name == "goToDecisionCenter") {
|
|
|
|
|
- startActivity(
|
|
|
|
|
|
|
+ when (action.name) {
|
|
|
|
|
+ "goToDecisionCenter" -> startActivity(
|
|
|
Intent(this, ChatActivity::class.java)
|
|
Intent(this, ChatActivity::class.java)
|
|
|
.putExtra("question", action.params.question)
|
|
.putExtra("question", action.params.question)
|
|
|
)
|
|
)
|
|
|
- } else {
|
|
|
|
|
- Log.d("WelcomeActivity", "triggerRecognize onSuccess: $action")
|
|
|
|
|
|
|
+ "goToTaskCenter" -> startActivity(
|
|
|
|
|
+ intentForTaskList(action.params)
|
|
|
|
|
+ )
|
|
|
|
|
+ else -> Log.d("WelcomeActivity", "triggerRecognize onSuccess: $action")
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onComplete = {
|
|
onComplete = {
|
|
@@ -101,14 +104,29 @@ class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {
|
|
|
.putExtra("question", action.params.question)
|
|
.putExtra("question", action.params.question)
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
+ AsrHelper.onGoToTaskCenter = { action ->
|
|
|
|
|
+ startActivity(intentForTaskList(action.params))
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private fun intentForTaskList(params: RecognizeParams) =
|
|
|
|
|
+ Intent(this, TaskListActivity::class.java).apply {
|
|
|
|
|
+ putExtra("taskType", params.taskType ?: "")
|
|
|
|
|
+ putExtra("keyword", params.keyword ?: "")
|
|
|
|
|
+ putExtra("dateRange", params.dateRange ?: 0)
|
|
|
|
|
+ putExtra("dateType", params.dateTpye ?: 0)
|
|
|
|
|
+ putExtra("isOverdue", params.isOverdue ?: 2)
|
|
|
|
|
+ putExtra("tenantId", params.tenantId ?: 1)
|
|
|
|
|
+ putExtra("userId", params.userId ?: "")
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
override fun onPause() {
|
|
override fun onPause() {
|
|
|
super.onPause()
|
|
super.onPause()
|
|
|
OfflineCmdServiceHelper.removeOnLineListener(offlineCmdListener)
|
|
OfflineCmdServiceHelper.removeOnLineListener(offlineCmdListener)
|
|
|
OfflineCmdServiceHelper.removeListenerWelcome()
|
|
OfflineCmdServiceHelper.removeListenerWelcome()
|
|
|
dotsHandler.removeCallbacks(dotsRunnable)
|
|
dotsHandler.removeCallbacks(dotsRunnable)
|
|
|
AsrHelper.onGoToDecisionCenter = null
|
|
AsrHelper.onGoToDecisionCenter = null
|
|
|
|
|
+ AsrHelper.onGoToTaskCenter = null
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onDestroy() {
|
|
override fun onDestroy() {
|