同城相亲 v1.1.1版本的 MD5 值为:007e8e047d75ee89cca348774925c94f
以下内容为反编译后的 ChatMsgActivity.java 源代码,内容仅作参考
package com.ysxsoft.goddess.ui;
import android.graphics.Color;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.util.KeyboardUtils;
import com.umeng.socialize.common.SocializeConstants;
import com.ysxsoft.goddess.R;
import com.ysxsoft.goddess.adapter.ChatMsgAdapter;
import com.ysxsoft.goddess.api.ApiManager;
import com.ysxsoft.goddess.api.MyHttpCallback;
import com.ysxsoft.goddess.api.MyOkHttpUtils;
import com.ysxsoft.goddess.dialog.SharePopupView;
import com.ysxsoft.goddess.entity.ChatMsgBean;
import java.util.ArrayList;
import java.util.HashMap;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class ChatMsgActivity extends BaseActivity {
private ChatMsgAdapter adapter;
@BindView(R.id.et_content)
EditText etContent;
@BindView(R.id.goto_qianbao_tv)
TextView mQianBaoTv;
@BindView(R.id.chat_msg_rose_llyt)
LinearLayout mRoseLlyt;
@BindView(R.id.tv_share)
TextView mShareTv;
@BindView(R.id.rv_recycleview)
RecyclerView rvRecycleview;
@BindView(R.id.tv_kthy)
TextView tvKthy;
@BindView(R.id.tv_toolbar_right)
TextView tvToolbarRight;
private String user_id;
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_chat_msg);
ButterKnife.bind(this);
initToolBar(this, "");
showBack(this);
this.user_id = getIntent().getStringExtra(SocializeConstants.TENCENT_UID);
initView();
getName();
initData();
}
private void initView() {
if (getIntent().getBooleanExtra("isKefu", false)) {
this.mRoseLlyt.setVisibility(8);
}
this.tvToolbarRight.setVisibility(0);
this.tvToolbarRight.setText("举报");
this.tvToolbarRight.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ChatMsgActivity.this.startActivity(ReportActivity.class);
}
});
this.rvRecycleview.setLayoutManager(new LinearLayoutManager(this));
this.adapter = new ChatMsgAdapter(new ArrayList());
this.rvRecycleview.setAdapter(this.adapter);
this.etContent.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == 4) {
if (TextUtils.isEmpty(ChatMsgActivity.this.etContent.getText().toString().trim())) {
ChatMsgActivity.this.showToast("请输入发送内容");
return true;
}
KeyboardUtils.hideSoftInput(ChatMsgActivity.this.etContent);
ChatMsgActivity.this.send();
return true;
}
return false;
}
});
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
spannableStringBuilder.append((CharSequence) "★现在开通VIP会员,赠送3倍以上玫瑰花,福利商城绑定APP还可免费领产品,");
SpannableString spannableString = new SpannableString("立即开通VIP会员");
spannableString.setSpan(new ClickableSpan() {
@Override
public void onClick(@NonNull View view) {
ChatMsgActivity.this.startActivity(VIPListActivity.class);
}
@Override
public void updateDrawState(@NonNull TextPaint textPaint) {
textPaint.setUnderlineText(false);
textPaint.setColor(ChatMsgActivity.this.getResources().getColor(R.color.colorRed));
}
}, 0, spannableString.length(), 33);
spannableStringBuilder.append((CharSequence) spannableString);
this.tvKthy.setMovementMethod(LinkMovementMethod.getInstance());
this.tvKthy.setText(spannableStringBuilder);
this.tvKthy.setHighlightColor(Color.parseColor("#00000000"));
SpannableStringBuilder spannableStringBuilder2 = new SpannableStringBuilder();
spannableStringBuilder2.append((CharSequence) "★分享好友,赠送玫瑰花并有VIP升级奖励,");
SpannableString spannableString2 = new SpannableString("立即分享");
spannableString2.setSpan(new ClickableSpan() {
@Override
public void onClick(@NonNull View view) {
new XPopup.Builder(ChatMsgActivity.this).asCustom(new SharePopupView(ChatMsgActivity.this).setTitle("欢迎加入同城相亲相亲平台").setDescr("相亲找对象就上同城相亲APP,女神男神任你挑选,七大相亲专场让您快速脱单").setImgUrl("http://app.chinameinv.com.cn/assets/img/logo.jpg").setUrl("https://app.chinameinv.com.cn/app.html")).show();
}
@Override
public void updateDrawState(@NonNull TextPaint textPaint) {
textPaint.setUnderlineText(false);
textPaint.setColor(ChatMsgActivity.this.getResources().getColor(R.color.colorRed));
}
}, 0, spannableString2.length(), 33);
spannableStringBuilder2.append((CharSequence) spannableString2);
this.mShareTv.setMovementMethod(LinkMovementMethod.getInstance());
this.mShareTv.setText(spannableStringBuilder2);
this.mShareTv.setHighlightColor(Color.parseColor("#00000000"));
}
private void getName() {
HashMap hashMap = new HashMap();
hashMap.put(SocializeConstants.TENCENT_UID, this.user_id);
MyOkHttpUtils.post(ApiManager.USER_HOME_INFO, hashMap).execute(new MyHttpCallback() {
@Override
public void onError(String str) {
ChatMsgActivity.this.showToast(str);
}
@Override
public void onSuccess(JSONObject jSONObject) {
try {
ChatMsgActivity.this.initToolBar(ChatMsgActivity.this, jSONObject.getJSONObject("data").getString("name"));
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
public void initData() {
HashMap hashMap = new HashMap();
hashMap.put(SocializeConstants.TENCENT_UID, this.user_id);
MyOkHttpUtils.post(ApiManager.MSG_SX_MSG_NEW, hashMap).execute(new MyHttpCallback() {
@Override
public void onError(String str) {
ChatMsgActivity.this.adapter.loadMoreComplete();
ChatMsgActivity.this.showToast(str);
}
@Override
public void onSuccess(JSONObject jSONObject) {
try {
JSONArray jSONArray = jSONObject.getJSONObject("data").getJSONObject("messages").getJSONArray("msg");
ArrayList arrayList = new ArrayList();
for (int i = 0; i < jSONArray.length(); i++) {
ChatMsgBean chatMsgBean = new ChatMsgBean();
chatMsgBean.setItem(jSONArray.getJSONObject(i));
arrayList.add(chatMsgBean);
}
ChatMsgActivity.this.adapter.setNewData(arrayList);
ChatMsgActivity.this.rvRecycleview.scrollToPosition(arrayList.size() - 1);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
public void send() {
HashMap hashMap = new HashMap();
hashMap.put(SocializeConstants.TENCENT_UID, this.user_id);
hashMap.put("content", this.etContent.getText().toString().trim());
MyOkHttpUtils.post(ApiManager.MSG_SX_SEND, hashMap).execute(new MyHttpCallback() {
@Override
public void onError(String str) {
ChatMsgActivity.this.showToast(str);
}
@Override
public void onSuccess(JSONObject jSONObject) {
ChatMsgActivity.this.etContent.setText("");
ChatMsgActivity.this.initData();
}
});
}
@OnClick({R.id.goto_qianbao_tv})
public void onViewClicked(View view) {
if (view.getId() != R.id.goto_qianbao_tv) {
return;
}
startActivity(QianBaoActivity.class);
}
}