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