private void refreshLike(String like) { if (like != null) { try { JSONObject jsonObject = new JSONObject(like); String state = jsonObject.getString(JsonString.Return.STATE); if (state.equals("20002")) { // 对方已经Like过我 ToastUtil.prompt(this, "双方相互Like,你们已经是好友了"); Intent intent = new Intent(IntentString.Receiver.NEW_FRIEND); sendBroadcast(intent); EMMessage message = EMMessage.createSendMessage(EMMessage.Type.TXT); TextMessageBody txtBody = new TextMessageBody("我们已经是好友了,可以开始聊天了"); message.addBody(txtBody); message.setReceipt(person.getId()); EMConversation conversation = EMChatManager.getInstance().getConversation(person.getId()); conversation.addMessage(message); finish(); } else if (state.equals("10004")) { ToastUtil.longPrompt(this, "检测到您的头像不是真人头像,Like操作无效"); } else { ToastUtil.prompt(this, "Like操作失败!"); } } catch (JSONException e) { e.printStackTrace(); } } else { ToastUtil.noNet(this); } }
@Override public void initView() { btn_back = (Button) findViewById(R.id.btn_back_find_fd); btn_pass = (Button) findViewById(R.id.btn_find_pass); btn_like = (Button) findViewById(R.id.btn_find_like); view_normal = findViewById(R.id.img_find_fd_normal); view_content = findViewById(R.id.layout_find_fd_content); img_photo = (ImageView) findViewById(R.id.img_find_center_photo); img_auth = (ImageView) findViewById(R.id.img_find_center_auth); img_sex = (ImageView) findViewById(R.id.img_find_center_sex); txt_nickname = (TextView) findViewById(R.id.txt_find_center_nickname); txt_cl = (TextView) findViewById(R.id.txt_find_center_cl); txt_college = (TextView) findViewById(R.id.txt_find_center_college); txt_dept = (TextView) findViewById(R.id.txt_find_center_dept); txt_grage = (TextView) findViewById(R.id.txt_find_center_grade); txt_signature = (TextView) findViewById(R.id.txt_find_center_signature); progressDialog = new ProgressDialog(this); String smallUrl = StringUtil.getSmallPhoto(person.getPhoto(), NormalString.SmallPhoto.PERSON_FIND); ImageViewUtil.displayCircleImageView(this, img_photo, smallUrl); String isAuth = person.getIsAuth(); if (isAuth.equals(Person.ISAUTH_YES)) { img_auth.setVisibility(View.VISIBLE); } else if (isAuth.equals(Person.ISAUTH_NO)) { img_auth.setVisibility(View.GONE); } String sex = person.getSex(); if (sex.equals(Person.MALE)) { img_sex.setImageResource(R.drawable.sex_male); } else if (sex.equals(Person.FEMALE)) { img_sex.setImageResource(R.drawable.sex_female); } txt_nickname.setText(person.getNickname()); txt_cl.setText(person.getCl()); txt_college.setText(person.getCollegeName()); txt_dept.setText(person.getDeptName()); txt_grage.setText(person.getGrade()); txt_signature.setText(person.getSignature()); view_normal.setVisibility(View.GONE); view_content.setVisibility(View.VISIBLE); MyOnClickListener listener = new MyOnClickListener(); btn_back.setOnClickListener(listener); btn_pass.setOnClickListener(listener); btn_like.setOnClickListener(listener); img_photo.setOnClickListener(listener); }