@Override public void onClick(View v) { Msg_Util.gotoChatDetail( (Activity) mContext, Msg_MessageType.getMessageType(MESSAGE_TYPE.REQ_SEND_NORMAL_MESSAGE), "", mode.Userid, mode.getImage(), mode.getAccount(), mode.getName(), "", true, true); }
@Override public View getView(final int pos, View convertView, ViewGroup viewgroup) { ViewHolder vh = null; if (convertView == null) { vh = new ViewHolder(); convertView = mInflater.inflate(R.layout.me_item_newfriend, null); vh.addMsg_textview = (TextView) convertView.findViewById(R.id.me_textview_addfriend); vh.icon_imageView = (ImageView) convertView.findViewById(R.id.me_imageview_headicon); vh.icon_imageView_add = (ImageView) convertView.findViewById(R.id.me_imageview_headgo); vh.level_textview = (TextView) convertView.findViewById(R.id.me_textview_mycompany); vh.name_textview = (TextView) convertView.findViewById(R.id.me_textview_myname); vh.me_linearlayout_addfriend = (LinearLayout) convertView.findViewById(R.id.me_linearlayout_addfriend); vh.text_msg_phone = (TextView) convertView.findViewById(R.id.text_msg_phone); vh.text_msg_chat = (TextView) convertView.findViewById(R.id.text_msg_chat); vh.selected_check = (CheckBox) convertView.findViewById(R.id.selected_check); if (isSelected) { vh.selected_check.setVisibility(View.VISIBLE); vh.me_linearlayout_addfriend.setVisibility(View.GONE); } else { vh.selected_check.setVisibility(View.GONE); vh.me_linearlayout_addfriend.setVisibility(View.VISIBLE); } convertView.setTag(vh); } else { vh = (ViewHolder) convertView.getTag(); } ConteactMode mode = friendList.get(pos); vh.icon_imageView.setTag(mode); vh.addMsg_textview.setTag(mode); vh.text_msg_phone.setTag(mode); vh.text_msg_chat.setTag(mode); vh.selected_check.setChecked(mode.selectedState); // vh.name_textview.setText(mode.getName()); vh.addMsg_textview.setVisibility(View.GONE); vh.text_msg_phone.setVisibility(View.GONE); vh.text_msg_chat.setVisibility(View.GONE); vh.icon_imageView_add.setVisibility(View.GONE); String name = mode.getName(); if (mode.getInstall().equalsIgnoreCase("1")) { // name = name + "(已安装)"; // 已安装的用户 // vh.me_linearlayout_addfriend // .setOnClickListener(new MySendMsgClickListener(mode)); if (!mode.Account.equals(ConstantPool.getInstance().USER_ACCOUNT)) { vh.text_msg_chat.setVisibility(View.VISIBLE); vh.text_msg_chat.setOnClickListener(new MySendMsgClickListener(mode)); // vh.addMsg_textview.setText("发消息"); // // vh.addMsg_textview.setTextColor(mContext.getResources().getColor( // R.color.me_addfriend)); // 是自己,隐藏发消息的按钮 // vh.addMsg_textview.setVisibility(View.GONE); } } else { name = name + "(未安装)"; vh.addMsg_textview.setVisibility(View.VISIBLE); vh.addMsg_textview.setText("邀请"); vh.addMsg_textview.setTextColor(mContext.getResources().getColor(R.color.me_addfriend)); // String sms_body = "您好," // + mode.name // + // ",我在使用“海航通”交流工作,和同事发文字、语音、图片,方便极了。你也一起来吧,下载地址:http://mobilehnasis.hnair.com/apps/jjrs.html#mp.weixin.qq.com,记得安装后加我:" // + ConstantPool.getInstance().USER_ACCOUNT_NAME; // String sms_body = mContext.getResources().getString(R.string.me_invite_content) // + ConstantPool.getInstance().USER_ACCOUNT_NAME; String sms_body = String.format( mContext.getResources().getString(R.string.me_invite_content), ConstantPool.getInstance().USER_ACCOUNT_NAME); vh.addMsg_textview.setOnClickListener( new MyInviteClickListener(mode.Account, mode.phoneNumber, sms_body)); } if (!TextUtils.isEmpty(mode.getPhoneNumber()) && !mode.Account.equals(ConstantPool.getInstance().USER_ACCOUNT)) { vh.text_msg_phone.setVisibility(View.VISIBLE); vh.text_msg_phone.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Object object = v.getTag(); if (object != null && object instanceof ConteactMode) { ConteactMode conteactMode = (ConteactMode) object; // Intent intent = // IntentUtil.getPhoneDialIntent(conteactMode.getPhoneNumber()); // mContext.startActivity(intent); ProjectUtil.selectCall(mContext, conteactMode.getPhoneNumber(), false); } } }); } if (!StringUtil.isEmpty(name)) { vh.name_textview.setText(name); } vh.level_textview.setText(mode.getDepartment() + " " + mode.getLevel()); // 现在的版本搜索界面只判断是否安装 /* * String state = mode.getState(); if (!StringUtil.isEmpty(state)) { // * 我发起的请求信息 if (state.equals("添加")) { // 点击添加好友 * vh.icon_imageView_add.setVisibility(View.VISIBLE); * vh.addMsg_textview.setText(mContext.getResources().getString( * R.string.me_add_text)); * vh.addMsg_textview.setTextColor(mContext.getResources() * .getColor(R.color.me_addfriend)); vh.me_linearlayout_addfriend * .setOnClickListener(new MyClickListener( vh.addMsg_textview, * vh.icon_imageView_add, mode)); } else if (state.equals("验证")) { // * 别人发的添加信息 vh.addMsg_textview.setText("通过验证"); * vh.icon_imageView_add.setVisibility(View.GONE); * vh.addMsg_textview.setTextColor(mContext.getResources() * .getColor(R.color.me_addfriend)); // 通过 vh.me_linearlayout_addfriend * .setOnClickListener(new MyPassClickListener(friendList, mode, "通过", * pos)); // // //拒绝 // * vh.me_textview_addfriend_pass.setOnClickListener(new // * OnClickListener() { // // @Override // public void onClick(View v) { * // ConteactMode mode = (ConteactMode) v.getTag(); // * AddValidation(mode.Userid,"拒绝"); // } // }); } else if * (state.equals("等待验证")) { vh.addMsg_textview.setText("验证中"); * vh.addMsg_textview.setTextColor(mContext.getResources() * .getColor(R.color.color_lightgrey)); * vh.icon_imageView_add.setVisibility(View.GONE); } else if * (state.equals("已添加")) { vh.addMsg_textview.setText("已添加"); * vh.addMsg_textview.setTextColor(mContext.getResources() * .getColor(R.color.color_lightgrey)); * vh.icon_imageView_add.setVisibility(View.GONE); } } */ // 下载图片 String midUrl = ProjectUtil.getBigPic(mode.image); ImageLoader.loadHeadImage((BaseActivity) mContext, vh.icon_imageView, midUrl); return convertView; }