|
|
|
@ -340,7 +340,7 @@ public class UpdateSysConfigUtil {
|
|
|
|
|
|
|
|
|
|
Intent intent = new Intent(MicroPhotoContext.ACTION_RESTART_MP);
|
|
|
|
|
intent.putExtra("noDelay", 1);
|
|
|
|
|
intent.setPackage(PACKAGE_NAME_MPAPP);
|
|
|
|
|
intent.setPackage(MicroPhotoContext.PACKAGE_NAME_MPAPP);
|
|
|
|
|
|
|
|
|
|
context.sendBroadcast(intent);
|
|
|
|
|
try {
|
|
|
|
@ -411,161 +411,161 @@ public class UpdateSysConfigUtil {
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// public static void setCommon(Context context, String actType, ArrayList<HashMap> list, String restartType) {
|
|
|
|
|
// if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.SET.value().toLowerCase())) {
|
|
|
|
|
// for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
// HashMap<String, String> hashMap = list.get(i);
|
|
|
|
|
// String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value());
|
|
|
|
|
// if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) {
|
|
|
|
|
// MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
// Field[] fields = mpAppConfig.getClass().getDeclaredFields();
|
|
|
|
|
// for (Field field : fields) {
|
|
|
|
|
// hashMap.forEach((key, value) -> {
|
|
|
|
|
// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
// if (value != null) {
|
|
|
|
|
// try {
|
|
|
|
|
// if (field.getType() == String.class) {
|
|
|
|
|
// field.set(mpAppConfig, value);
|
|
|
|
|
// } else if (field.getType() == int.class) {
|
|
|
|
|
// Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
// if (num != null) {
|
|
|
|
|
// field.set(mpAppConfig, num.intValue());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (IllegalAccessException e) {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// MicroPhotoContext.saveMpAppConfig(context, mpAppConfig);
|
|
|
|
|
// } else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) {
|
|
|
|
|
// MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context);
|
|
|
|
|
// Field[] fields = masterConfig.getClass().getDeclaredFields();
|
|
|
|
|
// for (Field field : fields) {
|
|
|
|
|
// hashMap.forEach((key, value) -> {
|
|
|
|
|
// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
// if (value != null) {
|
|
|
|
|
// try {
|
|
|
|
|
// if (field.getType() == String.class) {
|
|
|
|
|
// field.set(masterConfig, value);
|
|
|
|
|
// } else if (field.getType() == int.class) {
|
|
|
|
|
// Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
// if (num != null) {
|
|
|
|
|
// field.set(masterConfig, num.intValue());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (IllegalAccessException e) {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// MicroPhotoContext.saveMasterConfig(context, masterConfig);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.GET.value().toLowerCase())) {
|
|
|
|
|
// for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
// HashMap<String, String> hashMap = list.get(i);
|
|
|
|
|
// String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value());
|
|
|
|
|
// if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) {
|
|
|
|
|
// MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
// Field[] fields = mpAppConfig.getClass().getDeclaredFields();
|
|
|
|
|
// for (Field field : fields) {
|
|
|
|
|
// hashMap.forEach((key, value) -> {
|
|
|
|
|
// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
// try {
|
|
|
|
|
// if (field.getType() == String.class) {
|
|
|
|
|
// value = (String) field.get(mpAppConfig);
|
|
|
|
|
// } else if (field.getType() == int.class) {
|
|
|
|
|
// Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
// if (num != null) {
|
|
|
|
|
// value = (String) field.get(mpAppConfig);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (IllegalAccessException e) {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// } else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) {
|
|
|
|
|
// MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context);
|
|
|
|
|
// Field[] fields = masterConfig.getClass().getDeclaredFields();
|
|
|
|
|
// for (Field field : fields) {
|
|
|
|
|
// hashMap.forEach((key, value) -> {
|
|
|
|
|
// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
// try {
|
|
|
|
|
// if (field.getType() == String.class) {
|
|
|
|
|
// value = (String) field.get(masterConfig);
|
|
|
|
|
// } else if (field.getType() == int.class) {
|
|
|
|
|
// Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
// if (num != null) {
|
|
|
|
|
// value = (String) field.get(masterConfig);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (IllegalAccessException e) {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.SETFILE.value().toLowerCase())) {
|
|
|
|
|
// for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
// HashMap<String, String> hashMap = list.get(i);
|
|
|
|
|
// String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value());
|
|
|
|
|
// if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) {
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
// Field[] fields = mpAppConfig.getClass().getDeclaredFields();
|
|
|
|
|
// for (Field field : fields) {
|
|
|
|
|
// hashMap.forEach((key, value) -> {
|
|
|
|
|
// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
// if (value != null) {
|
|
|
|
|
// try {
|
|
|
|
|
// if (field.getType() == String.class) {
|
|
|
|
|
// value = (String) field.get(mpAppConfig);
|
|
|
|
|
// } else if (field.getType() == int.class) {
|
|
|
|
|
// Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
// if (num != null) {
|
|
|
|
|
// value = (String) field.get(mpAppConfig);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (IllegalAccessException e) {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// } else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) {
|
|
|
|
|
// MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context);
|
|
|
|
|
// Field[] fields = masterConfig.getClass().getDeclaredFields();
|
|
|
|
|
// for (Field field : fields) {
|
|
|
|
|
// hashMap.forEach((key, value) -> {
|
|
|
|
|
// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
// if (value != null) {
|
|
|
|
|
// try {
|
|
|
|
|
// if (field.getType() == String.class) {
|
|
|
|
|
// value = (String) field.get(masterConfig);
|
|
|
|
|
// } else if (field.getType() == int.class) {
|
|
|
|
|
// Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
// if (num != null) {
|
|
|
|
|
// value = (String) field.get(masterConfig);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (IllegalAccessException e) {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.GETFILE.value().toLowerCase())) {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
public static void setCommon(Context context, String actType, ArrayList<HashMap> list, String restartType) {
|
|
|
|
|
if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.SET.value().toLowerCase())) {
|
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
HashMap<String, String> hashMap = list.get(i);
|
|
|
|
|
String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value());
|
|
|
|
|
if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) {
|
|
|
|
|
MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
Field[] fields = mpAppConfig.getClass().getDeclaredFields();
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
hashMap.forEach((key, value) -> {
|
|
|
|
|
if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
try {
|
|
|
|
|
if (field.getType() == String.class) {
|
|
|
|
|
field.set(mpAppConfig, value);
|
|
|
|
|
} else if (field.getType() == int.class) {
|
|
|
|
|
Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
if (num != null) {
|
|
|
|
|
field.set(mpAppConfig, num.intValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
MicroPhotoContext.saveMpAppConfig(context, mpAppConfig);
|
|
|
|
|
} else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) {
|
|
|
|
|
MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context);
|
|
|
|
|
Field[] fields = masterConfig.getClass().getDeclaredFields();
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
hashMap.forEach((key, value) -> {
|
|
|
|
|
if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
try {
|
|
|
|
|
if (field.getType() == String.class) {
|
|
|
|
|
field.set(masterConfig, value);
|
|
|
|
|
} else if (field.getType() == int.class) {
|
|
|
|
|
Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
if (num != null) {
|
|
|
|
|
field.set(masterConfig, num.intValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
MicroPhotoContext.saveMasterConfig(context, masterConfig);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.GET.value().toLowerCase())) {
|
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
HashMap<String, String> hashMap = list.get(i);
|
|
|
|
|
String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value());
|
|
|
|
|
if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) {
|
|
|
|
|
MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
Field[] fields = mpAppConfig.getClass().getDeclaredFields();
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
hashMap.forEach((key, value) -> {
|
|
|
|
|
if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
try {
|
|
|
|
|
if (field.getType() == String.class) {
|
|
|
|
|
value = (String) field.get(mpAppConfig);
|
|
|
|
|
} else if (field.getType() == int.class) {
|
|
|
|
|
Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
if (num != null) {
|
|
|
|
|
value = (String) field.get(mpAppConfig);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) {
|
|
|
|
|
MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context);
|
|
|
|
|
Field[] fields = masterConfig.getClass().getDeclaredFields();
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
hashMap.forEach((key, value) -> {
|
|
|
|
|
if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
try {
|
|
|
|
|
if (field.getType() == String.class) {
|
|
|
|
|
value = (String) field.get(masterConfig);
|
|
|
|
|
} else if (field.getType() == int.class) {
|
|
|
|
|
Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
if (num != null) {
|
|
|
|
|
value = (String) field.get(masterConfig);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.SETFILE.value().toLowerCase())) {
|
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
HashMap<String, String> hashMap = list.get(i);
|
|
|
|
|
String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value());
|
|
|
|
|
if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
Field[] fields = mpAppConfig.getClass().getDeclaredFields();
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
hashMap.forEach((key, value) -> {
|
|
|
|
|
if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
try {
|
|
|
|
|
if (field.getType() == String.class) {
|
|
|
|
|
value = (String) field.get(mpAppConfig);
|
|
|
|
|
} else if (field.getType() == int.class) {
|
|
|
|
|
Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
if (num != null) {
|
|
|
|
|
value = (String) field.get(mpAppConfig);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) {
|
|
|
|
|
MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context);
|
|
|
|
|
Field[] fields = masterConfig.getClass().getDeclaredFields();
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
hashMap.forEach((key, value) -> {
|
|
|
|
|
if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
try {
|
|
|
|
|
if (field.getType() == String.class) {
|
|
|
|
|
value = (String) field.get(masterConfig);
|
|
|
|
|
} else if (field.getType() == int.class) {
|
|
|
|
|
Integer num = StringUtils.convert2Int(value);
|
|
|
|
|
if (num != null) {
|
|
|
|
|
value = (String) field.get(masterConfig);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.GETFILE.value().toLowerCase())) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|