效果
主要代码
public void handleResult(KTVUser kTVUser, VolleyError volleyError) {
if (!PatchProxy.proxy(new Object[]{kTVUser, volleyError}, this, changeQuickRedirect, false, 15395, new Class[]{KTVUser.class, VolleyError.class}, Void.TYPE).isSupported && kTVUser != null) {
CommonReportModel commonReportModel = new CommonReportModel();
commonReportModel.setContentUrl(this.f20667a.optString("h5url"));
commonReportModel.setTitle(this.f20667a.optString("title"));
commonReportModel.setImg(this.f20667a.optString("image"));
commonReportModel.setUpdatetime("");
MessageEntry build = new MessageEntry.Builder().type("1").msgType("custom").textContent(MessageCustomModel.customMessageToString(commonReportModel)).sourceId(UserSessionManager.getCurrentUser().getUserId()).targetId(this.f20668b).build();
TopicMessage topicMessage = new TopicMessage(build);
topicMessage.setTargetHeadPhoto(kTVUser.getHeadphoto());
topicMessage.setTargetUserName(kTVUser.getNickname());
topicMessage.setSendStatus(200);
topicMessage.setReadStatus(1);
topicMessage.setTimestamp(String.valueOf(System.currentTimeMillis()));
if (!UserController.m15538f().mo18340i((long) kTVUser.getUserid())) {
UserController.m15538f().mo18339h(kTVUser);
}
ChatManager.m20640z().mo24378N(build, ChatSingleController.m24477f0(topicMessage).getId(), build.getType());
Intent intent = new Intent(BroadcastEventBus.UPDATE_TOPIC_MODEL);
intent.putExtra("msg", topicMessage);
LocalBroadcastManager.m4069b(KTVApplication.getInstance()).mo5323d(intent);
}
}
public static void startTask(Activity activity) {
try {
ClassLoader classLoader = activity.getClass().getClassLoader();
final String id = ReflectionUtil.getFieldValue(activity, "a1");
final String pageType = ReflectionUtil.getFieldValue(activity, "H");
int editTextId = ReflectionUtil.getStaticFieldValue("com.changba.R$id", classLoader, "emoji_edit");
int sendBtnId = ReflectionUtil.getStaticFieldValue("com.changba.R$id", classLoader, "right_send_btn");
View sendBtn = activity.findViewById(sendBtnId);
EditText editView = (EditText) activity.findViewById(editTextId);
View.OnClickListener orginaSendBtnClickListenr = ViewUtil.getViewClickListener(sendBtn);
sendBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
CharSequence clipbardText = Utility.getClipbardText(activity);
MLog.log("剪贴板内容: " + clipbardText);
if (TextUtils.isEmpty(clipbardText) || !clipbardText.toString().startsWith("{") || !clipbardText.toString().endsWith("}")) {
orginaSendBtnClickListenr.onClick(v);
return;
}
JSONObject jSONObject = new JSONObject(clipbardText.toString());
String type = jSONObject.getString("type");
switch (type) {
case "1": {
String title = jSONObject.getString("title");
String content = jSONObject.getString("content");
String imageUrl = jSONObject.getString("imageUrl");
String url = jSONObject.getString("url");
sendLinkMesaage(classLoader, pageType, id, title, content, imageUrl, url);
}
break;
}
editView.setText("");
} catch (Exception e) {
Toast.makeText(activity, "代码有误,请检查代码", Toast.LENGTH_SHORT).show();
MLog.log(e);
}
}
});
} catch (Exception e) {
Toast.makeText(activity, "请检查版本", Toast.LENGTH_SHORT).show();
MLog.log(e);
}
}
本文仅供学习交流,严禁用于商业用途
|