private void sendSayhi(String msg) { ToastFactory.getToast(mContext, "招呼发送中...").show(); SayHiParams params = new SayHiParams(); params.fromUserId = MyApplication.getInstance().getCurrentLoginedUser().getUserId(); params.toUserId = mCurrentSayhiUser.getUserId(); params.content = msg; AppServiceExtendImpl.getInstance() .sayhi( params, new OnSayHiResponseListener() { @Override public void onSuccess(int money, String msg) { ToastFactory.getToast(mContext, msg).show(); LoginedUser loginedUser = MyApplication.getInstance().getCurrentLoginedUser(); loginedUser.setLoveMoney(money); } @Override public void onFailure(String msg) { // TODO Auto-generated method stub ToastFactory.getToast(mContext, msg).show(); } }); }
@Override public View bindView(int position, View convertView, ViewGroup parent) { if (null == convertView) { convertView = LayoutInflater.from(mContext).inflate(R.layout.my_follows_item, null); } final NearbyUser user = this.list.get(position); final ImageView ivFace = ViewHolder.get(convertView, R.id.iv_user_face); TextView tvNickname = ViewHolder.get(convertView, R.id.tv_user_nickname); TextView tvAge = ViewHolder.get(convertView, R.id.tv_user_age); ImageView ivVip = ViewHolder.get(convertView, R.id.iv_vip); // 距离 // TextView tvDistance = ViewHolder.get(convertView, R.id.tv_user_distance); // vip ivVip.setImageResource(user.getVip() != 0 ? R.drawable.vip : R.drawable.vipnot); tvNickname.setTextColor( mContext.getResources().getColor(user.getVip() != 0 ? R.color.c_vip : R.color.c_not_vip)); // ivVip.setVisibility(user.getVip() != 0 ? View.VISIBLE : View.GONE); // displayImage 会有刷新闪烁问题 ImageLoader.getInstance() .displayImage( user.getFaceUrl().getSmallImageUrl(), ivFace, ImageLoaderOptions.rounderOptions(), new ImageLoadingListener() { @Override public void onLoadingStarted(String arg0, View arg1) { // TODO Auto-generated method stub } @Override public void onLoadingFailed(String arg0, View arg1, FailReason arg2) { // TODO Auto-generated method stub } @Override public void onLoadingComplete(String arg0, View arg1, Bitmap arg2) { // TODO Auto-generated method stub notifyDataSetChanged(); } @Override public void onLoadingCancelled(String arg0, View arg1) { // TODO Auto-generated method stub } }); // ImageLoader.getInstance().loadImage(user.getFaceUrl(), ImageLoaderOptions.rounderOptions(), // new ImageLoadingListener() { // // @Override // public void onLoadingStarted(String arg0, View arg1) { // // TODO Auto-generated method stub // // } // // @Override // public void onLoadingFailed(String arg0, View arg1, FailReason arg2) { // // TODO Auto-generated method stub // // } // // @Override // public void onLoadingComplete(String arg0, View arg1, Bitmap arg2) { // ivFace.setImageBitmap(arg2); // } // // @Override // public void onLoadingCancelled(String arg0, View arg1) { // // TODO Auto-generated method stub // // } // }); tvNickname.setText(user.getNickname()); tvAge.setText(user.getAge() + ""); // tvDistance.setText(user.getDistance() + "km"); int backRes = 0; Drawable genderDrawable = null; if (user.getGender() == 1) { backRes = R.drawable.shape_gender_age_male; genderDrawable = mContext.getResources().getDrawable(R.drawable.ic_user_male2); } else { backRes = R.drawable.shape_gender_age_female; genderDrawable = mContext.getResources().getDrawable(R.drawable.ic_user_famale2); } tvAge.setBackgroundResource(backRes); // 必须设置 bounds, 否则不显示 genderDrawable.setBounds( 0, 0, genderDrawable.getMinimumWidth(), genderDrawable.getMinimumHeight()); tvAge.setCompoundDrawables(genderDrawable, null, null, null); return convertView; }