JSONObject obj = null;
if (!m.find()) {
pic.setSuccess(false);
notifyActionEvent(QQActionEvent.Type.EVT_ERROR,
new QQException(QQErrorCode.UNEXPECTED_RESPONSE, response.getResponseString() ));
}
String regResult = m.group().replaceAll("[\\r]?[\\n]", " ")
.replaceAll("[\r]?[\n]", " ");
obj = new JSONObject(regResult);
int retcode = obj.getInt("retcode");
if (retcode == 0) {
pic.setSuccess(obj.getInt("progress") == 100 ? true : false);
pic.setFileSize(obj.getInt("filesize"));
pic.setFileName(obj.getString("filename"));
pic.setFilePath(obj.getString("filepath"));
notifyActionEvent(QQActionEvent.Type.EVT_OK, pic);
return;
}
// 失败后返回路径
pic.setFilePath(file.getPath());
pic.setSuccess(false);
notifyActionEvent(QQActionEvent.Type.EVT_ERROR,
new QQException(QQErrorCode.UNEXPECTED_RESPONSE, response.getResponseString() ));
}