private void processLayout(DealHolder holder, final ChatItem item) { picasso.load(item.getAvatarUrl()).placeholder(R.drawable.ic_avatar_small).into(holder.ivAvatar); holder.tvNickname.setText(item.getNickname()); holder.tvRelationship.setText(item.getRelationship()); holder.tvMessage.setText(item.getMessage()); if (item.getIsRead() == 1) { holder.ivIsRead.setVisibility(View.GONE); } else { holder.ivIsRead.setVisibility(View.VISIBLE); } }
/** ************************ Get loved one by id chat ************************* */ private void requestGetCircleItem(final ChatItem item) { mActivity.showLoading(); CallServiceCustomGET cs = new CallServiceCustomGET( "getLovedOneByIdChat", mActivity.getUserId(), mActivity.getToken(), mActivity.getDeviceId(), mActivity.getVersion(), mActivity.getLocale(), new CallServiceCustomGET.JsonCallback() { @Override public void handleData(String mCmd, JSONObject json) throws JSONException { try { if (json != null) { int status = json.getInt("status"); if (status == 1) { try { JSONObject info = json.getJSONObject("data"); CircleItem circleItem = CircleItem.parseCircleItem(info); if (circleItem != null) { circleItem.setChatGroupID(item.getChatGroupID()); item.setCircleItem(circleItem); mActivity.hideLoading(); Intent i = new Intent(mActivity, ChatScreen.class); i.putExtra(Actions.Extras.ITEM, circleItem); mActivity.startActivity(i); } else { // Log.e(TAG, "Can not get User Info @@"); UIUtils.alert(mActivity, "Can not get User Info @@"); } } catch (Exception e) { UIUtils.alert(mActivity, "EXCEPTION: " + e.getMessage()); } } else { try { String errorCode = json.get("errorCode").toString(); // Log.e(TAG+":handleData", "ERROR " + errorCode + " !!"); UIUtils.alert(mActivity, "ERROR " + errorCode + " !!"); } catch (Exception e) { // Log.e(TAG+":handleData", e.getMessage()); UIUtils.alert(mActivity, "EXCEPTION: " + e.getMessage()); } } } } catch (Exception e) { UIUtils.alert(mActivity, "EXCEPTION: " + e.getMessage()); } mActivity.hideLoading(); } }); try { String url = RemoteMethods.get( RemoteMethods.getLoveByIdChat, mActivity.getUserId(), item.getChatGroupID()); cs.execute(url); } catch (Exception e) { mActivity.hideLoading(); UIUtils.alert(mActivity, "EXCEPTION: " + e.getMessage()); } }