@Test public void destroyOutboxDirectMessage() { try { Paging<User> paging = new Paging<User>(); List<User> listUser = weibo.getFollowers(paging); assertTrue(ListUtil.isNotEmpty(listUser)); User user = listUser.get(0); assertNotNull(user); String text = "测试删除私信接口:destroyOutboxDirectMessage,莫慌," + System.currentTimeMillis(); DirectMessage message = weibo.sendDirectMessage(user.getDisplayName(), text); assertNotNull(message); assertTrue(StringUtil.isNotEmpty(message.getId())); TestUtil.sleep(); DirectMessage deletedMessage = weibo.destroyOutboxDirectMessage(message.getId()); assertNotNull(deletedMessage); assertTrue(StringUtil.isNotEmpty(deletedMessage.getId())); } catch (LibException e) { e.printStackTrace(); assertTrue(false); } }
@Override protected void onPostExecute(User resultUser) { super.onPostExecute(resultUser); if (isShowDialog && dialog != null && dialog.getContext() != null) { try { dialog.dismiss(); } catch (Exception e) { } } if (resultUser != null) { Toast.makeText(context, R.string.msg_profile_photo_uploaded, Toast.LENGTH_LONG).show(); context.updateProfileImage(resultUser.getProfileImageUrl()); context.updateUser(resultUser); } else { Toast.makeText(context, resultMsg, Toast.LENGTH_LONG).show(); } }
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = context.getLayoutInflater(); convertView = inflater.inflate(R.layout.list_item_social_graph_search, null); UserHolder holder = new UserHolder(convertView); convertView.setTag(holder); } User user = getItem(position); UserHolder holder = (UserHolder) convertView.getTag(); if (holder == null || user == null) { return convertView; } holder.reset(); String profileUrl = user.getProfileImageUrl(); if (StringUtil.isNotEmpty(profileUrl)) { ImageLoad4HeadTask headTask = new ImageLoad4HeadTask(holder.ivProfilePicture, profileUrl, true); holder.headTask = headTask; headTask.execute(); } if (user.isVerified()) { holder.ivVerify.setVisibility(View.VISIBLE); } holder.tvScreenName.setText(user.getScreenName()); String impress = ""; if (user.getGender() != null) { impress += ResourceBook.getGenderValue(user.getGender(), context) + ", "; } if (user.getLocation() != null) { impress += user.getLocation(); } holder.tvImpress.setText(impress); return convertView; }
public static View fillConvertView(View convertView, Status status) { if (convertView == null || status == null) { return null; } Context context = convertView.getContext(); StatusHolder holder = (StatusHolder) convertView.getTag(); if (holder == null) { return null; } holder.reset(); boolean isNetEase = status.getServiceProvider() == ServiceProvider.NetEase; User user = status.getUser(); if (user == null) { // 微博已经删除 if (StringUtil.isNotEmpty(status.getText())) { Spannable textSpan = EmotionLoader.getEmotionSpannable(status.getServiceProvider(), status.getText()); holder.tvText.setText(textSpan); } return convertView; } if (GlobalVars.IS_SHOW_HEAD) { holder.ivProfilePicture.setVisibility(View.VISIBLE); holder.headClickListener.setUser(user); String profileUrl = user.getProfileImageUrl(); if (StringUtil.isNotEmpty(profileUrl)) { ImageLoad4HeadTask headTask = new ImageLoad4HeadTask(holder.ivProfilePicture, profileUrl, true); holder.headTask = headTask; headTask.execute(); } } else { holder.ivProfilePicture.setVisibility(View.GONE); } holder.tvScreenName.setText(user.getScreenName()); if (status.getUser().isVerified()) { holder.ivVerify.setVisibility(View.VISIBLE); } if (status.getLocation() != null) { holder.ivLocation.setVisibility(View.VISIBLE); } if (status.isFavorited()) { holder.ivFavorite.setVisibility(View.VISIBLE); } holder.tvCreatedAt.setText(TimeSpanUtil.toTimeSpanString(status.getCreatedAt())); Spannable textSpan = EmotionLoader.getEmotionSpannable(status.getServiceProvider(), status.getText()); holder.tvText.setText(textSpan); Status retweet = status.getRetweetedStatus(); if (retweet != null) { holder.llRetweet.setVisibility(View.VISIBLE); holder.tvRetweetText.setVisibility(View.VISIBLE); String retweetText = ""; if (retweet.getUser() != null) { retweetText = retweet.getUser().getMentionTitleName() + ": " + retweet.getText(); } Spannable retweetTextSpan = EmotionLoader.getEmotionSpannable(status.getServiceProvider(), retweetText); holder.tvRetweetText.setText(retweetTextSpan); } String thumbnailUrl = status.getThumbnailPictureUrl(); ImageView ivTempThumbnail = holder.ivThumbnail; if (retweet != null) { thumbnailUrl = retweet.getThumbnailPictureUrl(); ivTempThumbnail = holder.ivRetweetThumbnail; } if (StringUtil.isNotEmpty(thumbnailUrl)) { holder.ivAttachment.setVisibility(View.VISIBLE); if (GlobalVars.IS_SHOW_THUMBNAIL && !isNetEase) { ivTempThumbnail.setVisibility(View.VISIBLE); ImageLoad4ThumbnailTask thumbnailTask = new ImageLoad4ThumbnailTask(ivTempThumbnail, thumbnailUrl); holder.thumbnailTask = thumbnailTask; // thumbnailTask.execute(status); ivTempThumbnail.setOnClickListener(new ImageClickListener(status)); } } String source = String.format(GlobalResource.getStatusSourceFormat(context), status.getSource()); holder.tvSource.setText(Html.fromHtml(source).toString()); String responseFormat = GlobalResource.getStatusResponseFormat(context); int retweetCount = status.getRetweetCount() == null ? 0 : status.getRetweetCount(); int commentCount = status.getCommentCount() == null ? 0 : status.getCommentCount(); String responseText = String.format(responseFormat, retweetCount, commentCount); holder.tvResponse.setText(responseText); if (status.getRetweetCount() == null || status.getRetweetCount() != null) { holder.tvResponse.setText(responseText); QueryResponseCountTask responseCountTask = new QueryResponseCountTask(context, status, holder.tvResponse); holder.responseCountTask = responseCountTask; // countTask.execute(); } return convertView; }