@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ListView listView = (ListView) getRefreshView(); position -= listView.getHeaderViewsCount(); if (position >= 0 && position < getAdapterCount()) BizFragment.getBizFragment(this).replyComment(null, getAdapterItems().get(position)); }
@Override public boolean onOptionsItemSelected(MenuItem item) { // @Ta if (item.getItemId() == R.id.mention) { BizFragment.getBizFragment(this).mentionUser(getActivity(), mUser); } // 关注 else if (item.getItemId() == R.id.create) { BizFragment.getBizFragment(this).createFriendship(mUser, this); } // 取消关注 else if (item.getItemId() == R.id.destory) { BizFragment.getBizFragment(this).destoryFriendship(mUser, this); } // 移除粉丝 else if (item.getItemId() == R.id.followDestory) { BizFragment.getBizFragment(this).destoryFollower(mUser, this); } return super.onOptionsItemSelected(item); }
@Override protected void onSuccess(StatusComments result) { super.onSuccess(result); if (result == null) return; if (AppContext.getUnreadCount() != null && AppContext.getUnreadCount().getMention_cmt() > 0) { requestDataDelay(1000); // f**k sina AppContext.getUnreadCount().setMention_cmt(0); BizFragment.getBizFragment(MentionCommentsFragment.this) .remindSetCount(RemindType.mention_cmt); } }
private void setProfileView() { ImageView imgPhoto = (ImageView) viewProfile.findViewById(R.id.imgPhoto); BitmapLoader.getInstance() .display( this, AisenUtil.getUserPhoto(mUser), imgPhoto, ImageConfigUtils.getLargePhotoConfig()); TextView txtName = (TextView) viewProfile.findViewById(R.id.txtName); txtName.setText(mUser.getName()); // f**k 2014-09-04 当名字过长大于6个字时,截取部分文字 int maxLength = AisenUtil.getStrLength("当名字过长大于个"); if (AisenUtil.getStrLength(mUser.getName()) > maxLength) { StringBuffer sb = new StringBuffer(); int index = 0; while (AisenUtil.getStrLength(sb.toString()) < maxLength) { if (index >= mUser.getName().length()) break; sb.append(mUser.getName().charAt(index)); index++; } sb.append("..."); txtName.setText(sb.toString()); } // 性别 ImageView imgGender = (ImageView) viewProfile.findViewById(R.id.imgGender); imgGender.setVisibility(View.VISIBLE); if ("m".equals(mUser.getGender())) imgGender.setImageResource(R.drawable.list_male); else if ("f".equals(mUser.getGender())) imgGender.setImageResource(R.drawable.list_female); else imgGender.setVisibility(View.GONE); // 认证 ImageView imgVerified = (ImageView) viewProfile.findViewById(R.id.imgVerified); AisenUtil.setImageVerified(imgVerified, mUser); // 简介 TextView txtDesc = (TextView) viewProfile.findViewById(R.id.txtDesc); if (!TextUtils.isEmpty(mUser.getDescription())) txtDesc.setText(String.format(getString(R.string.profile_des_hint), mUser.getDescription())); else txtDesc.setText( String.format( String.format( getString(R.string.profile_des_hint), getString(R.string.profile_des_none)))); // 认证原因 TextView txtVerifiedReason = (TextView) viewProfile.findViewById(R.id.txtVerifiedReason); txtVerifiedReason.setVisibility( !TextUtils.isEmpty(mUser.getVerified_reason()) ? View.VISIBLE : View.GONE); txtVerifiedReason.setText( String.format(getString(R.string.profile_ver_reason), mUser.getVerified_reason() + "")); // 备注 TextView txtRemark = (TextView) viewProfile.findViewById(R.id.txtRemark); txtRemark.setVisibility( mFriendship == null || !mFriendship.getSource().getFollowing() ? View.GONE : View.VISIBLE); if (mFriendship != null) { try { BizFragment.getBizFragment(this).modifyUserMark(txtRemark, mUser, this); } catch (Exception e) { } if (!TextUtils.isEmpty(mUser.getRemark())) txtRemark.setText(String.format(getString(R.string.profile_remark), mUser.getRemark())); else txtRemark.setText(R.string.profile_remark_none); } // 分组 TextView txtGroups = (TextView) viewProfile.findViewById(R.id.txtGroups); txtGroups.setVisibility(mGroupMemberListed == null ? View.GONE : View.VISIBLE); txtGroups.setOnClickListener(this); if (mGroupMemberListed != null) { if (mGroupMemberListed.getLists().size() == 0) { txtGroups.setText(R.string.profile_group_none); } else { StringBuffer sb = new StringBuffer(); for (GroupListed groupListed : mGroupMemberListed.getLists()) sb.append(groupListed.getName()).append(" "); txtGroups.setText( String.format(getString(R.string.profile_group_hint), sb.toString().trim())); } } // 所在地 TextView txtLocation = (TextView) viewProfile.findViewById(R.id.txtLocation); txtLocation.setText(mUser.getLocation()); // 微博数 TextView txtStatusCount = (TextView) viewProfile.findViewById(R.id.txtStatusCount); txtStatusCount.setText(AisenUtil.getCounter(mUser.getStatuses_count())); // 关注数 viewProfile.findViewById(R.id.btnFriendCounter).setOnClickListener(this); TextView txtFriendCount = (TextView) viewProfile.findViewById(R.id.txtFriendCount); txtFriendCount.setText(AisenUtil.getCounter(mUser.getFriends_count())); // 粉丝数 viewProfile.findViewById(R.id.btnFollowerCounter).setOnClickListener(this); TextView txtFollowerCount = (TextView) viewProfile.findViewById(R.id.txtFollowerCount); txtFollowerCount.setText(AisenUtil.getCounter(mUser.getFollowers_count())); }