[8.2.8][i18n] mogo-hardware-device 中文抽取
This commit is contained in:
@@ -9,6 +9,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
|
||||
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||
import com.mogo.support.device.DevicesManager
|
||||
import com.mogo.support.device.IWriteChainLogListener
|
||||
import com.mogo.support.device.led.LedSourceManager
|
||||
@@ -68,7 +69,7 @@ object IotManager : IMoGoCloudListener, IWriteChainLogListener {
|
||||
paramIndexes = [0, 1, 2]
|
||||
)
|
||||
override fun onWriteChainLog(tag: String, title: String, info: String) {
|
||||
if(DebugConfig.isDebug()) {
|
||||
if (DebugConfig.isDebug()) {
|
||||
try {
|
||||
i("${tag}_${EVENT_KEY_HARDWARE_DEVICES}", "${title}_${info}")
|
||||
val params = HashMap<String, Any>()
|
||||
@@ -82,4 +83,8 @@ object IotManager : IMoGoCloudListener, IWriteChainLogListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onGetString(id: Int): String {
|
||||
return StringUtils.getString(id)
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.mogo.support.device
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
interface IWriteChainLogListener {
|
||||
|
||||
fun onWriteChainLog(tag: String, title: String, info: String)
|
||||
|
||||
fun onGetString(@StringRes id: Int): String
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.mogo.support.device.led
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.support.device.IWriteChainLogListener
|
||||
import com.mogo.support.device.R
|
||||
import com.mogo.support.device.manager.cpower5a.LedScreenCpower5aManager
|
||||
import com.mogo.support.device.manager.cpower5a.common.LedScreen
|
||||
import com.mogo.support.device.manager.cpower5a.common.Program
|
||||
@@ -101,7 +102,8 @@ open class BackLedUIViewModel(writeChainLogListener: IWriteChainLogListener) : B
|
||||
LedScreenCpower5aManager.getInstance()
|
||||
.playProgramLineStationReportHint(
|
||||
LedScreen.OUTWARD_BACK,
|
||||
"车辆进站"
|
||||
// "车辆进站"
|
||||
writeChainLogListener.onGetString(R.string.module_device_vehicle_arrive_station)
|
||||
)
|
||||
writeChainLogListener.onWriteChainLog(
|
||||
TAG,
|
||||
@@ -114,7 +116,8 @@ open class BackLedUIViewModel(writeChainLogListener: IWriteChainLogListener) : B
|
||||
LedScreenCpower5aManager.getInstance()
|
||||
.playProgramLineStationReportHint(
|
||||
LedScreen.OUTWARD_BACK,
|
||||
"车辆起步"
|
||||
// "车辆起步"
|
||||
writeChainLogListener.onGetString(R.string.module_device_vehicle_start)
|
||||
)
|
||||
writeChainLogListener.onWriteChainLog(
|
||||
TAG,
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.support.device.led
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.support.device.IWriteChainLogListener
|
||||
import com.mogo.support.device.R
|
||||
import com.mogo.support.device.manager.cpower5a.LedScreenCpower5aManager
|
||||
import com.mogo.support.device.manager.cpower5a.common.LedScreen
|
||||
import com.mogo.support.device.manager.cpower5a.common.Program
|
||||
@@ -94,7 +95,8 @@ class FrontLedUIViewModel(writeChainLogListener: IWriteChainLogListener) : BaseL
|
||||
LedScreenCpower5aManager.getInstance()
|
||||
.playProgramLineStationReportHint(
|
||||
LedScreen.OUTWARD_FRONT,
|
||||
"车辆进站"
|
||||
// "车辆进站"
|
||||
writeChainLogListener.onGetString(R.string.module_device_vehicle_arrive_station)
|
||||
)
|
||||
writeChainLogListener.onWriteChainLog(
|
||||
TAG,
|
||||
@@ -107,7 +109,8 @@ class FrontLedUIViewModel(writeChainLogListener: IWriteChainLogListener) : BaseL
|
||||
LedScreenCpower5aManager.getInstance()
|
||||
.playProgramLineStationReportHint(
|
||||
LedScreen.OUTWARD_FRONT,
|
||||
"车辆起步"
|
||||
// "车辆起步"
|
||||
writeChainLogListener.onGetString(R.string.module_device_vehicle_start)
|
||||
)
|
||||
writeChainLogListener.onWriteChainLog(
|
||||
TAG,
|
||||
|
||||
@@ -4,7 +4,9 @@ package com.mogo.support.device.led
|
||||
import android.content.Context
|
||||
import android.os.CountDownTimer
|
||||
import android.text.TextUtils
|
||||
import androidx.annotation.StringRes
|
||||
import com.mogo.support.device.IWriteChainLogListener
|
||||
import com.mogo.support.device.R
|
||||
import com.mogo.support.device.manager.cpower5a.LedScreenCpower5aManager
|
||||
import com.mogo.support.device.manager.cpower5a.OnLedScreenCpower5aListener
|
||||
import com.mogo.support.device.manager.cpower5a.common.Cpower5aState.Execute
|
||||
@@ -297,20 +299,24 @@ object LedSourceManager : IWriteChainLogListener {
|
||||
//结束
|
||||
frontViewModel.reset()
|
||||
backViewModel.reset()
|
||||
receiveUI(FinishUI())
|
||||
// receiveUI(FinishUI())
|
||||
receiveUI(FinishUI(writeChainLogListener?.onGetString(R.string.module_device_thank_you_for_accompanying_all_the_way) ?: "感谢一路相伴"))
|
||||
} else if (type == 3) {
|
||||
//出站
|
||||
if (arrivalStopName.isNotEmpty()) {
|
||||
updateStationReportUI(arrivalStopName, "下一站")
|
||||
// updateStationReportUI(arrivalStopName, "下一站")
|
||||
updateStationReportUI(arrivalStopName, writeChainLogListener?.onGetString(R.string.module_device_next_station) ?: "下一站")
|
||||
}
|
||||
} else if (type == 4) {
|
||||
//进站
|
||||
if (arrivalStopName.isNotEmpty()) {
|
||||
updateStationReportUI(
|
||||
arrivalStopName, if (isLastStop) {
|
||||
"终点站"
|
||||
// "终点站"
|
||||
writeChainLogListener?.onGetString(R.string.module_device_destination) ?: "终点站"
|
||||
} else {
|
||||
"已到达"
|
||||
// "已到达"
|
||||
writeChainLogListener?.onGetString(R.string.module_device_have_arrived) ?: "已到达"
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -344,6 +350,10 @@ object LedSourceManager : IWriteChainLogListener {
|
||||
writeChainLogListener?.onWriteChainLog(tag, title, info)
|
||||
}
|
||||
|
||||
override fun onGetString(@StringRes id: Int): String {
|
||||
return writeChainLogListener?.onGetString(id) ?: ""
|
||||
}
|
||||
|
||||
|
||||
private val cpower5aListener: OnLedScreenCpower5aListener =
|
||||
object : OnLedScreenCpower5aListener() {
|
||||
@@ -459,23 +469,28 @@ object LedSourceManager : IWriteChainLogListener {
|
||||
): String {
|
||||
var temp = when (state) {
|
||||
Execute.EXECUTE_SUCCEED -> {
|
||||
"欢迎语更改成功"
|
||||
// "欢迎语更改成功"
|
||||
writeChainLogListener?.onGetString(R.string.module_device_welcome_msg_update_success) ?: "欢迎语更改成功"
|
||||
}
|
||||
|
||||
Execute.CONNECT_FAILED -> {
|
||||
"欢迎语更改失败,无法连接到设备"
|
||||
// "欢迎语更改失败,无法连接到设备"
|
||||
writeChainLogListener?.onGetString(R.string.module_device_welcome_msg_update_fail_connect_failed) ?: "欢迎语更改失败,无法连接到设备"
|
||||
}
|
||||
|
||||
Execute.DATA_EXCEPTION -> {
|
||||
"欢迎语更改失败,数据异常"
|
||||
// "欢迎语更改失败,数据异常"
|
||||
writeChainLogListener?.onGetString(R.string.module_device_welcome_msg_update_fail_data_exception) ?: "欢迎语更改失败,数据异常"
|
||||
}
|
||||
|
||||
Execute.EXECUTE_EXCEPTION -> {
|
||||
"欢迎语更改失败,解析或发送异常"
|
||||
// "欢迎语更改失败,解析或发送异常"
|
||||
writeChainLogListener?.onGetString(R.string.module_device_welcome_msg_update_fail_execute_exception) ?: "欢迎语更改失败,解析或发送异常"
|
||||
}
|
||||
|
||||
else -> {
|
||||
"欢迎语更改失败"
|
||||
// "欢迎语更改失败"
|
||||
writeChainLogListener?.onGetString(R.string.module_device_welcome_msg_update_fail) ?: "欢迎语更改失败"
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(errMsg)) {
|
||||
@@ -483,15 +498,18 @@ object LedSourceManager : IWriteChainLogListener {
|
||||
}
|
||||
val device = when (LedScreen.getLedScreen(ip)) {
|
||||
LedScreen.OUTWARD_FRONT -> {
|
||||
"前屏"
|
||||
// "前屏"
|
||||
writeChainLogListener?.onGetString(R.string.module_device_front_screen) ?: "前屏"
|
||||
}
|
||||
|
||||
LedScreen.OUTWARD_BACK -> {
|
||||
"后屏"
|
||||
// "后屏"
|
||||
writeChainLogListener?.onGetString(R.string.module_device_back_screen) ?: "后屏"
|
||||
}
|
||||
|
||||
else -> {
|
||||
"未知屏幕"
|
||||
// "未知屏幕"
|
||||
writeChainLogListener?.onGetString(R.string.module_device_unknown_screen) ?: "未知屏幕"
|
||||
}
|
||||
}
|
||||
return device + temp
|
||||
|
||||
@@ -49,7 +49,8 @@ class WelcomeUI(val hintMsg: String? = null, val isForever: Boolean = false) :
|
||||
}
|
||||
|
||||
//结束提示
|
||||
class FinishUI(val hintMsg: String = "感谢一路相伴") :
|
||||
//class FinishUI(val hintMsg: String = "感谢一路相伴") :
|
||||
class FinishUI(val hintMsg: String) :
|
||||
LedUICountDown(priority = 5, countDownSeconds = 10)
|
||||
|
||||
//线路信息提示
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<resources>
|
||||
<string name="module_device_thank_you_for_accompanying_all_the_way">感谢一路相伴</string>
|
||||
<string name="module_device_next_station">下一站</string>
|
||||
<string name="module_device_destination">终点站</string>
|
||||
<string name="module_device_have_arrived">已到达</string>
|
||||
<string name="module_device_front_screen">前屏</string>
|
||||
<string name="module_device_back_screen">后屏</string>
|
||||
<string name="module_device_unknown_screen">未知屏幕</string>
|
||||
<string name="module_device_welcome_msg_update_success">欢迎语更改成功</string>
|
||||
<string name="module_device_welcome_msg_update_fail_connect_failed">欢迎语更改失败,无法连接到设备</string>
|
||||
<string name="module_device_welcome_msg_update_fail_data_exception">欢迎语更改失败,数据异常</string>
|
||||
<string name="module_device_welcome_msg_update_fail_execute_exception">欢迎语更改失败,解析或发送异常</string>
|
||||
<string name="module_device_welcome_msg_update_fail">欢迎语更改失败</string>
|
||||
<string name="module_device_vehicle_arrive_station">车辆进站</string>
|
||||
<string name="module_device_vehicle_start">车辆起步</string>
|
||||
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user