[8.2.8][i18n] mogo-core-data mogo-core-function-call mogo-core-function-network mogo-core-utils OCH/common 中文抽取

This commit is contained in:
xinfengkun
2025-11-27 16:13:53 +08:00
parent 64a4f00a73
commit 573ae14aa6
17 changed files with 197 additions and 73 deletions

View File

@@ -7,6 +7,7 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.utilcode.util.StringUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bridge.R
import com.mogo.och.bridge.autopilot.OCHAdasAbilityManager
@@ -76,7 +77,8 @@ object OchAutoPilotManager {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.AUTOPILOT,
AutopilotMsg(0, "自动驾驶启动失败", msg, System.currentTimeMillis())
// AutopilotMsg(0, "自动驾驶启动失败", msg, System.currentTimeMillis())
AutopilotMsg(0, StringUtils.getString(R.string.module_core_autonomous_driving_startup_failed), msg, System.currentTimeMillis())
)
)
} else {

View File

@@ -51,7 +51,7 @@ public class MarkerUserInfo implements Serializable {
char ageChar = ageChars[2];
// String ageString = "未设置";
String ageString = StringUtils.getString(R.string.module_core_age_unknown);
String ageString = StringUtils.getString(R.string.module_core_age_not_set);
switch (ageChar) {
case '0':
@@ -121,7 +121,7 @@ public class MarkerUserInfo implements Serializable {
public String getGender() {
if (TextUtils.isEmpty(gender)) {
// return "未设置";
return StringUtils.getString(R.string.module_core_gender_unknown);
return StringUtils.getString(R.string.module_core_age_not_set);
}
return gender;
}

View File

@@ -22,6 +22,7 @@ import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.AppStateManager
import com.mogo.eagle.core.utilcode.util.StringUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.mogo.adas.common.power.PowerUnitChannel
import com.zhjt.mogo.adas.data.Adas
@@ -109,24 +110,31 @@ object CallerAutoPilotControlManager {
var isPlayTTS = true
if (exceptionValue != 0) {
if (isShowTip) {
val sb = StringBuilder("请检查车辆")
// val sb = StringBuilder("请检查车辆")
val sb = StringBuilder(StringUtils.getString(R.string.module_core_check_vehicle))
if ((exceptionValue and 1) != 0) {
sb.append("FSM$")
// sb.append("FSM$")
sb.append(StringUtils.getString(R.string.module_core_fsm)).append("$")
}
if ((exceptionValue and (1 shl 1)) != 0) {
sb.append("方向盘$")
// sb.append("方向盘$")
sb.append(StringUtils.getString(R.string.module_core_chassis_steering)).append("$")
}
if (((exceptionValue and (1 shl 2)) != 0)) {
sb.append("油门$")
// sb.append("油门$")
sb.append(StringUtils.getString(R.string.module_core_chassis_throttle)).append("$")
}
if ((exceptionValue and (1 shl 3)) != 0) {
sb.append("刹车$")
// sb.append("刹车$")
sb.append(StringUtils.getString(R.string.module_core_chassis_brake)).append("$")
}
if ((exceptionValue and (1 shl 4)) != 0) {
sb.append("双闪$")
// sb.append("双闪$")
sb.append(StringUtils.getString(R.string.module_core_chassis_hazard_lights)).append("$")
}
if ((exceptionValue and (1 shl 5)) != 0) {
sb.append("档位$")
// sb.append("档位$")
sb.append(StringUtils.getString(R.string.module_core_chassis_gear)).append("$")
}
if ((exceptionValue and (1 shl 6)) != 0) {
if (!sb.contains("$")) {
@@ -141,7 +149,8 @@ object CallerAutoPilotControlManager {
if ((exceptionValue and (1 shl 7)) != 0 || ((exceptionValue and (1 shl 8)) != 0)) {
if (!sb.contains("$")) {
sb.setLength(0)
sb.append("轨迹未就绪,请稍后重试")
// sb.append("轨迹未就绪,请稍后重试")
sb.append(StringUtils.getString(R.string.module_core_trajectory_not_ready))
}
}

View File

@@ -5,9 +5,11 @@ import chassis.VehicleStateOuterClass
import com.google.protobuf.TextFormat
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
import com.mogo.eagle.core.function.call.R
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_D_C
import com.mogo.eagle.core.utilcode.util.StringUtils
import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
import org.json.JSONException
@@ -58,7 +60,8 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
UnableLaunchReason.UnableType.DISCONNECTED,
object : ArrayList<String>() {
init {
add("未连接自动驾驶系统")
// add("未连接自动驾驶系统")
add(StringUtils.getString(R.string.module_core_ununited_ipc))
}
}
)
@@ -97,28 +100,32 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
)
}
//制动踏板
var temp = "未知"
// var temp = "未知"
var temp = StringUtils.getString(R.string.module_core_unknown)
if (chassisStates!!.hasBrakeSystemStates()) {
val brake = chassisStates!!.brakeSystemStates.brakePedalResponsePosition
temp = brake.toString()
}
chassisStatesObject.put("brake", temp)
//油门踏板
temp = "未知"
// temp = "未知"
temp = StringUtils.getString(R.string.module_core_unknown)
if (chassisStates!!.hasDrivingSystemStates()) {
val throttle = chassisStates!!.drivingSystemStates.throttleResponsePosition
temp = throttle.toString()
}
chassisStatesObject.put("throttle", temp)
//档位
temp = "未知"
// temp = "未知"
temp = StringUtils.getString(R.string.module_core_unknown)
if (chassisStates!!.hasGearSystemStates()) {
val gear = chassisStates!!.gearSystemStates.gearPosition
temp = gear.name
}
chassisStatesObject.put("gear", temp)
//方向盘
temp = "未知"
// temp = "未知"
temp = StringUtils.getString(R.string.module_core_unknown)
if (chassisStates!!.hasSteerSystemStates()) {
val steerSystemStates = chassisStates!!.steerSystemStates
if (steerSystemStates.hasSteeringWheelAngle()) {
@@ -128,7 +135,8 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
}
chassisStatesObject.put("steering", temp)
//车灯
temp = "未知"
// temp = "未知"
temp = StringUtils.getString(R.string.module_core_unknown)
if (chassisStates!!.hasBcmSystemStates()) {
val bcm = chassisStates!!.bcmSystemStates
temp = bcm.turnLightState.name
@@ -150,35 +158,40 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
}
try {
//制动踏板
var temp = "未知"
// var temp = "未知"
var temp = StringUtils.getString(R.string.module_core_unknown)
if (vehicleState!!.hasBrake()) {
val brake = vehicleState!!.brake
temp = brake.toString()
}
vehicleStateObject.put("brake", temp)
//油门踏板
temp = "未知"
// temp = "未知"
temp = StringUtils.getString(R.string.module_core_unknown)
if (vehicleState!!.hasThrottle()) {
val throttle = vehicleState!!.throttle
temp = throttle.toString()
}
vehicleStateObject.put("throttle", temp)
//档位
temp = "未知"
// temp = "未知"
temp = StringUtils.getString(R.string.module_core_unknown)
if (vehicleState!!.hasGear()) {
val gear = vehicleState!!.gear
temp = gear.name
}
vehicleStateObject.put("gear", temp)
//方向盘
temp = "未知"
// temp = "未知"
temp = StringUtils.getString(R.string.module_core_unknown)
if (vehicleState!!.hasSteering()) {
val steering = vehicleState!!.steering
temp = steering.toString()
}
vehicleStateObject.put("steering", temp)
//车灯
temp = "未知"
// temp = "未知"
temp = StringUtils.getString(R.string.module_core_unknown)
if (vehicleState!!.hasLight()) {
val light = vehicleState!!.light
temp = light.name

View File

@@ -2,7 +2,9 @@ package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.call.R
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.util.StringUtils
import mogo.telematics.pad.MessagePad
/**
@@ -13,7 +15,11 @@ object CallerAutopilotCarConfigListenerManager : CallerBase<IMoGoAutopilotCarCon
private var mCarConfigResp: MessagePad.CarConfigResp? = null
@Volatile
private var certFileMsg = "未开启认证"
private var certFileMsg = ""
init {
certFileMsg = StringUtils.getString(R.string.module_core_authentication_not_enabled)
}
override fun doSomeAfterAddListener(tag: String, listener: IMoGoAutopilotCarConfigListener) {
mCarConfigResp?.let {

View File

@@ -5,9 +5,11 @@ import com.mogo.eagle.core.data.msgbox.FSMMsg
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener
import com.mogo.eagle.core.function.call.R
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.trace.CallerTrace
import com.mogo.eagle.core.utilcode.util.StringUtils
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
import kotlin.properties.Delegates
@@ -22,7 +24,8 @@ object CallerAutopilotStatisticsListenerManager : CallerBase<IMoGoAutopilotStati
MsgBoxType.FSM,
FSMMsg(
0,
"自动驾驶启动失败",
// "自动驾驶启动失败",
StringUtils.getString(R.string.module_core_autonomous_driving_startup_failed),
(it.failedMessage?.msg?:""),
System.currentTimeMillis()
)

View File

@@ -4,13 +4,15 @@ package com.mogo.eagle.core.network;
import android.content.Context;
import android.view.KeyEvent;
import com.haoyisheng.mobile.mogo_core_network.R;
import com.mogo.eagle.core.network.utils.Util;
import com.mogo.eagle.core.utilcode.util.StringUtils;
import java.util.Collections;
import java.util.Map;
public class RequestOptions {
private static final String DEFAULT_LOADING_MESSAGE = "正在加载中...";
// private static final String DEFAULT_LOADING_MESSAGE = "正在加载中...";
private Object caller;
private Context context;
@@ -27,7 +29,8 @@ public class RequestOptions {
this.caller = caller;
this.context = Util.getContext( caller );
this.parameter = Collections.emptyMap();
this.loadingMessage = DEFAULT_LOADING_MESSAGE;
// this.loadingMessage = DEFAULT_LOADING_MESSAGE;
this.loadingMessage = StringUtils.getString(R.string.module_core_loading_in_progress);
this.loading = false;
this.cancelable = true;
this.cancelableOnTouchOutside = false;

View File

@@ -1084,7 +1084,7 @@
<string name="module_core_alert_warning_left">正左方</string>
<string name="module_core_alert_warning_all">周边</string>
<string name="module_core_unknown_road">未知道路</string>
<string name="module_core_age_unknown">未设置</string>
<string name="module_core_age_not_set">未设置</string>
<string name="module_core_age_00">00后</string>
<string name="module_core_age_10">10后</string>
<string name="module_core_age_20">20后</string>
@@ -1095,7 +1095,6 @@
<string name="module_core_age_70">70后</string>
<string name="module_core_age_80">80后</string>
<string name="module_core_age_90">90后</string>
<string name="module_core_gender_unknown">未设置</string>
<string name="module_core_gender_men"></string>
<string name="module_core_gender_women"></string>
<string name="module_core_user_name_unknown">用户未设置昵称</string>
@@ -1145,9 +1144,17 @@
<string name="module_core_fm_dp_comfortable_stop">择机靠边停车</string>
<string name="module_core_fm_dp_pnc_choose_stop">立刻舒适停车</string>
<string name="module_core_fm_dp_emergency_stop">就地紧急停车</string>
<!-- <string name="module_core_"></string>-->
<string name="module_core_ununited_ipc">未连接自动驾驶系统</string>
<string name="module_core_check_vehicle">请检查车辆</string>
<string name="module_core_fsm">FSM</string>
<string name="module_core_chassis_steering">方向盘</string>
<string name="module_core_chassis_throttle">油门</string>
<string name="module_core_chassis_brake">刹车</string>
<string name="module_core_chassis_hazard_lights">双闪</string>
<string name="module_core_chassis_gear">档位</string>
<string name="module_core_trajectory_not_ready">轨迹未就绪,请稍后重试</string>
<string name="module_core_autonomous_driving_startup_failed">自动驾驶启动失败</string>
<string name="module_core_loading_in_progress">正在加载中…</string>
<!-- <string name="module_core_"></string>-->
<!-- <string name="module_core_"></string>-->
<!-- <string name="module_core_"></string>-->

View File

@@ -17,6 +17,8 @@ import androidx.annotation.LayoutRes
import androidx.core.view.doOnAttach
import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.R
import com.mogo.eagle.core.utilcode.util.StringUtils
import java.util.concurrent.atomic.AtomicBoolean
class MoGoPopWindow private constructor(builder: Builder){
@@ -25,7 +27,8 @@ class MoGoPopWindow private constructor(builder: Builder){
private const val TAG = "MoGoPopWindow"
}
private val content: View = builder.content ?: throw AssertionError("要填充的View不能为空")
// private val content: View = builder.content ?: throw AssertionError("要填充的View不能为空")
private val content: View = builder.content ?: throw AssertionError(StringUtils.getString(R.string.module_core_utils_view_to_fill_cannot_be_null))
private val pop: PopupWindow by lazy { PopupWindow(builder.width, builder.height) }
@@ -35,7 +38,8 @@ class MoGoPopWindow private constructor(builder: Builder){
private var gravityInActivity: Int = builder.gravityInActivity
private val activity: Activity = builder.attachToActivity ?: throw AssertionError("要依附Activity实例不能为空")
// private val activity: Activity = builder.attachToActivity ?: throw AssertionError("要依附Activity实例不能为空")
private val activity: Activity = builder.attachToActivity ?: throw AssertionError(StringUtils.getString(R.string.module_core_utils_attached_activity_instance_cannot_be_null))
private val isDraggable: Boolean = builder.isDraggable
@@ -61,7 +65,8 @@ class MoGoPopWindow private constructor(builder: Builder){
}
isPendingShow.set(true)
activity.lifeCycleScope.launchWhenResumed {
val parent = activity.findViewById<View>(android.R.id.content) ?: throw AssertionError("附着的Activity上的ID为[android.R.id.content]的控件不存在.")
// val parent = activity.findViewById<View>(android.R.id.content) ?: throw AssertionError("附着的Activity上的ID为[android.R.id.content]的控件不存在.")
val parent = activity.findViewById<View>(android.R.id.content) ?: throw AssertionError(StringUtils.getString(R.string.module_core_utils_attached_activity_instance_cannot_be_null1))
pop.contentView = content
pop.isAttachedInDecor = false
pop.setBackgroundDrawable(ColorDrawable())
@@ -321,18 +326,22 @@ class MoGoPopWindow private constructor(builder: Builder){
}
fun build() : MoGoPopWindow {
val activity = attachToActivity ?: throw AssertionError("依附的activity不能为空")
// val activity = attachToActivity ?: throw AssertionError("依附的activity不能为空")
val activity = attachToActivity ?: throw AssertionError(StringUtils.getString(R.string.module_core_utils_attached_activity_instance_cannot_be_null2))
if (content != null && layoutId != null) {
throw AssertionError("两者不能同时设置")
// throw AssertionError("两者不能同时设置")
throw AssertionError(StringUtils.getString(R.string.module_core_utils_both_cannot_be_set_simultaneously))
}
if (content == null && layoutId == null) {
throw AssertionError("两者不能都不设置,至少设置一个")
// throw AssertionError("两者不能都不设置,至少设置一个")
throw AssertionError(StringUtils.getString(R.string.module_core_utils_both_cannot_be_set_simultaneously1))
}
if (content == null) {
content = LayoutInflater.from(activity).inflate(layoutId!!, null)
}
if (content != null && content?.parent != null) {
throw AssertionError("内容控件不允许包含父控件.")
// throw AssertionError("内容控件不允许包含父控件.")
throw AssertionError(StringUtils.getString(R.string.module_core_utils_content_control_cannot_contain_parent_control))
}
return MoGoPopWindow(this)
}

View File

@@ -10,6 +10,7 @@ import android.text.TextUtils;
import com.mogo.eagle.core.utilcode.util.BaseAlertDialogBuilder;
import com.mogo.eagle.core.utilcode.util.R;
import com.mogo.eagle.core.utilcode.util.StringUtils;
/**
* @author xiaoyuzhou
@@ -27,11 +28,14 @@ public class PermissionsDialogUtils {
if (mAlertDialog == null || !mAlertDialog.isShowing()) {
BaseAlertDialogBuilder builder = new BaseAlertDialogBuilder(activity);
if (TextUtils.isEmpty(msg)) {
builder.setMessage("请在 “应用信息 -> 权限” 中授予权限");
// builder.setMessage("请在 “应用信息 -> 权限” 中授予权限");
builder.setMessage(StringUtils.getString(R.string.module_core_utils_manual_authorization_msg));
} else {
builder.setMessage("请在 “应用信息 -> 权限” 中授予【" + msg + "】权限");
// builder.setMessage("请在 “应用信息 -> 权限” 中授予【" + msg + "】权限");
builder.setMessage(StringUtils.getString(R.string.module_core_utils_manual_authorization_msg1, msg));
}
builder.setPositiveButton("手动授权", (dialog, which) -> {
// builder.setPositiveButton("手动授权", (dialog, which) -> {
builder.setPositiveButton(StringUtils.getString(R.string.module_core_utils_manual_authorization), (dialog, which) -> {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.addCategory(Intent.CATEGORY_DEFAULT);

View File

@@ -5,6 +5,8 @@ import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.mogo.eagle.core.utilcode.util.R;
import com.mogo.eagle.core.utilcode.util.StringUtils;
import com.mogo.utils.sqlite.annotation.DbField;
import com.mogo.utils.sqlite.annotation.DbTable;
@@ -264,7 +266,8 @@ public class SQLBaseDao<T> implements SQLIDao<T> {
field.set(item, cursor.getBlob(columnIndex));
} else {
//未知类型
throw new UnsupportedOperationException("未定义的数据类型fieldName= " + columnName + " fieldType= " + fieldType);
// throw new UnsupportedOperationException("未定义的数据类型fieldName= " + columnName + " fieldType= " + fieldType);
throw new UnsupportedOperationException(StringUtils.getString(R.string.module_core_utils_undefined_data_type) + "fieldName= " + columnName + " fieldType= " + fieldType);
}
}
}
@@ -338,7 +341,8 @@ public class SQLBaseDao<T> implements SQLIDao<T> {
sqlCreateTable.append(columnName).append(" BLOB,");
} else {
//未知类型
throw new UnsupportedOperationException("未定义的数据类型fieldName= " + columnName + " fieldType= " + fieldType);
// throw new UnsupportedOperationException("未定义的数据类型fieldName= " + columnName + " fieldType= " + fieldType);
throw new UnsupportedOperationException(StringUtils.getString(R.string.module_core_utils_undefined_data_type) + "fieldName= " + columnName + " fieldType= " + fieldType);
}
if (index == fields.length - 1) {
@@ -384,7 +388,8 @@ public class SQLBaseDao<T> implements SQLIDao<T> {
contentValues.put(columnName, (byte[]) valueObject);
} else {
//未知类型
throw new UnsupportedOperationException("未定义的数据类型fieldName= " + columnName + " fieldType= " + fieldType);
// throw new UnsupportedOperationException("未定义的数据类型fieldName= " + columnName + " fieldType= " + fieldType);
throw new UnsupportedOperationException(StringUtils.getString(R.string.module_core_utils_undefined_data_type) + "fieldName= " + columnName + " fieldType= " + fieldType);
}
} catch (IllegalAccessException e) {
e.printStackTrace();

View File

@@ -21,7 +21,8 @@ class ApkInstaller {
@JvmStatic
fun installApp(context: Context, apkFile: File, block: ((Int, String) -> Unit)?) {
if (!apkFile.exists()) {
val msg = "要安装的apk文件不存在"
// val msg = "要安装的apk文件不存在"
val msg = StringUtils.getString(R.string.module_core_utils_apk_not_exist)
block?.invoke(INSTALL_CODE_INVALID, msg)
return
}
@@ -31,7 +32,8 @@ class ApkInstaller {
false
}
if (!isApk) {
val msg = "文件: ${apkFile.absolutePath}, 不是一个有效的安装包"
// val msg = "文件: ${apkFile.absolutePath}, 不是一个有效的安装包"
val msg = StringUtils.getString(R.string.module_core_utils_apk_not_install_package, apkFile.absolutePath)
block?.invoke(INSTALL_CODE_INVALID, msg)
return
}
@@ -132,11 +134,13 @@ class InstallApkSessionApi: AppCompatActivity() {
session.commit(pendingIntent.intentSender)
} catch (t: IOException) {
Log.e(TAG, "--- InstallApkSessionApi --:exception 1:${t.message}")
listener?.invoke(INSTALL_CODE_INVALID, t.message ?: "未知异常")
// listener?.invoke(INSTALL_CODE_INVALID, t.message ?: "未知异常")
listener?.invoke(INSTALL_CODE_INVALID, t.message ?: StringUtils.getString(R.string.module_core_utils_unknown_exception))
session?.close()
} catch (t: RuntimeException) {
Log.e(TAG, "--- InstallApkSessionApi --:exception 2:${t.message}")
listener?.invoke(INSTALL_CODE_INVALID, t.message ?: "未知异常2")
// listener?.invoke(INSTALL_CODE_INVALID, t.message ?: "未知异常2")
listener?.invoke(INSTALL_CODE_INVALID, t.message ?: StringUtils.getString(R.string.module_core_utils_unknown_exception2))
session?.abandon()
} finally {
try {
@@ -169,7 +173,8 @@ class InstallApkSessionApi: AppCompatActivity() {
STATUS_SUCCESS -> {
Log.i(TAG, "--- InstallApkSessionApi -- install success --")
Toast.makeText(this, "Install succeeded!", Toast.LENGTH_SHORT).show()
listener?.invoke(STATUS_SUCCESS, "安装成功")
// listener?.invoke(STATUS_SUCCESS, "安装成功")
listener?.invoke(STATUS_SUCCESS, StringUtils.getString(R.string.module_core_utils_install_success))
finish()
listener = null
}
@@ -181,12 +186,14 @@ class InstallApkSessionApi: AppCompatActivity() {
STATUS_FAILURE_INVALID,
STATUS_FAILURE_STORAGE -> {
Toast.makeText(this, "Install failed! $status, $message", Toast.LENGTH_SHORT).show()
listener?.invoke(status, message ?: "安装失败")
// listener?.invoke(status, message ?: "安装失败")
listener?.invoke(status, message ?: StringUtils.getString(R.string.module_core_utils_install_fail))
finish()
listener = null
}
else -> {
status?.also { listener?.invoke(it, message ?: "未知状态") }
// status?.also { listener?.invoke(it, message ?: "未知状态") }
status?.also { listener?.invoke(it, message ?: StringUtils.getString(R.string.module_core_utils_unknown_state)) }
Toast.makeText(this, "Unrecognized status received from installer: $status", Toast.LENGTH_SHORT).show()
finish()
listener = null
@@ -214,7 +221,8 @@ class FoTaSilentUpgradeReceiver: BroadcastReceiver() {
Log.d("AppInstallReceiver", "-- onReceive: --- 2 ---")
if (i.hasExtra("code") && i.hasExtra("msg")) {
val code = i.getIntExtra("code", -1)
val msg = i.getStringExtra("msg") ?: "未知异常"
// val msg = i.getStringExtra("msg") ?: "未知异常"
val msg = i.getStringExtra("msg") ?: StringUtils.getString(R.string.module_core_utils_unknown_exception)
Log.d("AppInstallReceiver", "-- onReceive: --- 3 ---:[code: $code, msg: $msg]")
listener?.invoke(code, msg)
}

View File

@@ -165,7 +165,8 @@ public class BitmapHelper {
} catch ( Exception e ) {
e.printStackTrace();
target = null;
listener.onCompressFailed( "压缩失败" );
// listener.onCompressFailed( "压缩失败" );
listener.onCompressFailed(StringUtils.getString(R.string.module_core_utils_compression_failed));
} finally {
IOUtils.closeSilently( bos );
}

View File

@@ -800,22 +800,27 @@ public final class ConvertUtils {
// 数字为三位数
if (length == 3) {
if (number % 100 < 10) {
spannable.append("")
// spannable.append("零")
spannable.append(StringUtils.getString(R.string.module_core_utils_zero))
.append(getChinese(number % 100, 3));
} else {
spannable.append(getChinese(number % 100 / 10, 3))
.append("")
// .append("十")
.append(StringUtils.getString(R.string.module_core_utils_ten))
.append(getChinese(number % 10, 0));
}
}
// 数字为四位数
if (length == 4) {
if (number % 1000 < 10) {
spannable.append("").append(getChinese(number % 1000, 3));
// spannable.append("零").append(getChinese(number % 1000, 3));
spannable.append(StringUtils.getString(R.string.module_core_utils_zero)).append(getChinese(number % 1000, 3));
} else if (number % 1000 < 100) {
spannable.append("")
// spannable.append("零")
spannable.append(StringUtils.getString(R.string.module_core_utils_zero))
.append(getChinese(number % 1000 / 10, 3))
.append("")
// .append("十")
.append(StringUtils.getString(R.string.module_core_utils_ten))
.append(getChinese(number % 10, 0));
} else {
number = number % 1000;
@@ -838,26 +843,36 @@ public final class ConvertUtils {
if (length == 2) {
return "";
}
return "";
// return "一";
return StringUtils.getString(R.string.module_core_utils_one);
case 2:
return "";
// return "二";
return StringUtils.getString(R.string.module_core_utils_two);
case 3:
return "";
// return "三";
return StringUtils.getString(R.string.module_core_utils_three);
case 4:
return "";
// return "四";
return StringUtils.getString(R.string.module_core_utils_four);
case 5:
return "";
// return "五";
return StringUtils.getString(R.string.module_core_utils_five);
case 6:
return "";
// return "六";
return StringUtils.getString(R.string.module_core_utils_six);
case 7:
return "";
// return "七";
return StringUtils.getString(R.string.module_core_utils_seven);
case 8:
return "";
// return "八";
return StringUtils.getString(R.string.module_core_utils_eight);
case 9:
return "";
// return "九";
return StringUtils.getString(R.string.module_core_utils_nine);
case 0:
if (length == 1) {
return "";
// return "零";
return StringUtils.getString(R.string.module_core_utils_zero);
}
return "";
@@ -874,11 +889,14 @@ public final class ConvertUtils {
public static String getUnitChinese(int length) {
switch (length) {
case 2:
return "";
// return "十";
return StringUtils.getString(R.string.module_core_utils_ten);
case 3:
return "";
// return "百";
return StringUtils.getString(R.string.module_core_utils_hundred);
case 4:
return "";
// return "千";
return StringUtils.getString(R.string.module_core_utils_thousand);
}
return "";
}

View File

@@ -23,7 +23,8 @@ public class DateTimeUtils {
public static final long ONE_YEAR = ONE_MONTH * 24L;
// 下面的pattern在print和parse时都可以使用
public static final String MM_Yue_dd_Ri = "MM月dd日";
public static final String MM_Yue_dd_Ri_HH_mm = "MM月dd日 HH:mm";
// public static final String MM_Yue_dd_Ri_HH_mm = "MM月dd日 HH:mm";
public static final String MM_Yue_dd_Ri_HH_mm = StringUtils.getString(R.string.module_core_utils_mm_yue_dd_ri_hh_mm);
public static final String M_Yue_d_Ri = "M月d日";
public static final String d_Ri = "d日";
public static final String yyyyMMdd = "yyyyMMdd";

View File

@@ -56,7 +56,8 @@ public final class TimeUtils {
}
public static SimpleDateFormat getYMDFormat(){
return getSafeDateFormat("yyyy年MM月dd日");
// return getSafeDateFormat("yyyy年MM月dd日");
return getSafeDateFormat(StringUtils.getString(R.string.module_core_utils_yyyy_nian_mm_yue_dd_ri));
}
public static SimpleDateFormat getHourMinSecondFormat(){

View File

@@ -1,4 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="module_mogo_core_function_hmi_dot_often_click1">不要频繁点击哦~</string>
<string name="module_core_utils_view_to_fill_cannot_be_null">要填充的View不能为空</string>
<string name="module_core_utils_attached_activity_instance_cannot_be_null">要依附Activity实例不能为空</string>
<string name="module_core_utils_attached_activity_instance_cannot_be_null1">附着的Activity上的ID为[android.R.id.content]的控件不存在.</string>
<string name="module_core_utils_attached_activity_instance_cannot_be_null2">依附的activity不能为空</string>
<string name="module_core_utils_both_cannot_be_set_simultaneously">两者不能同时设置</string>
<string name="module_core_utils_both_cannot_be_set_simultaneously1">两者不能都不设置,至少设置一个</string>
<string name="module_core_utils_content_control_cannot_contain_parent_control">内容控件不允许包含父控件</string>
<string name="module_core_utils_manual_authorization_msg">请在 “应用信息 -> 权限” 中授予权限</string>
<string name="module_core_utils_manual_authorization_msg1">请在 “应用信息 -> 权限” 中授予【%s】权限</string>
<string name="module_core_utils_manual_authorization">手动授权</string>
<string name="module_core_utils_undefined_data_type">未定义的数据类型:</string>
<string name="module_core_utils_apk_not_exist">要安装的apk文件不存在</string>
<string name="module_core_utils_apk_not_install_package">文件: %s, 不是一个有效的安装包</string>
<string name="module_core_utils_unknown_exception">未知异常</string>
<string name="module_core_utils_unknown_exception2">未知异常2</string>
<string name="module_core_utils_install_success">安装成功</string>
<string name="module_core_utils_install_fail">安装失败</string>
<string name="module_core_utils_unknown_state">未知状态</string>
<string name="module_core_utils_compression_failed">压缩失败</string>
<string name="module_core_utils_zero"></string>
<string name="module_core_utils_one"></string>
<string name="module_core_utils_two"></string>
<string name="module_core_utils_three"></string>
<string name="module_core_utils_four"></string>
<string name="module_core_utils_five"></string>
<string name="module_core_utils_six"></string>
<string name="module_core_utils_seven"></string>
<string name="module_core_utils_eight"></string>
<string name="module_core_utils_nine"></string>
<string name="module_core_utils_ten"></string>
<string name="module_core_utils_hundred"></string>
<string name="module_core_utils_thousand"></string>
<string name="module_core_utils_mm_yue_dd_ri_hh_mm">MM月dd日 HH:mm</string>
<string name="module_core_utils_yyyy_nian_mm_yue_dd_ri">yyyy年MM月dd日</string>
</resources>