public class ErrorCodeUtil {
static ErrorCodeUtil instance;
static ErrorCodeUtil otherAppCodeUtils;
public ErrorCodeUtil() {
}
public static ErrorCodeUtil getInstance() {
if (instance == null) {
Class var0 = ErrorCodeUtil.class;
synchronized(ErrorCodeUtil.class) {
instance = new ErrorCodeUtil();
}
}
return instance;
}
public static ErrorCodeUtil getOtherAppCodeUtils() {
if (otherAppCodeUtils == null) {
Class var0 = ErrorCodeUtil.class;
synchronized(ErrorCodeUtil.class) {
otherAppCodeUtils = new ErrorCodeUtil();
}
}
return otherAppCodeUtils;
}
public static void setOtherAppCodeUtils(ErrorCodeUtil otherAppCodeUtils) {
otherAppCodeUtils = otherAppCodeUtils;
}
public String getCodeMsg(int code) {
String errorMsg = "";
switch(code) {
case -1:
errorMsg = MyActivityManager.getInstance().getCurrentActivity().getString(string.code_fu1);
break;
default:
if (otherAppCodeUtils != null) {
return otherAppCodeUtils.getCodeMsg(code);
}
}
return errorMsg;
}
}
public class FotaErrorUtils extends ErrorCodeUtil {
private static FotaErrorUtils instance;
public static FotaErrorUtils getInstance() {
if (instance == null) {
synchronized (FotaErrorUtils.class) {
instance = new FotaErrorUtils();
}
}
return instance;
}
@Override
public String getCodeMsg(int code) {
String errorMsg = "";
switch (code) {
case 10:
errorMsg = getString(R.string.code_10);
break;
default:
if (otherAppCodeUtils != null) {
return otherAppCodeUtils.getCodeMsg(code);
}
break;
}
return errorMsg;
}
}