private void bingSong(ViewHolder holder, LabelStory story) { if (LabelStory.TYPE_ONLINEAUDIO.equals(story.getType())) { if (story.getThumbImages() != null) { AvatarManager.getInstance(context) .displaySingerAvatar( story.getThumbImages()[0], holder.mAnimView, R.drawable.ic_sound_pic_normal); } JSONObject jsonObject = VoiceUtiles.getContentJson(story.getContent()); if (jsonObject != null) { holder.songName.setText( jsonObject.optString(CommandFields.Dynamic.SONG_NAME) == null ? context.getString(R.string.song_name, context.getString(R.string.music_unknown)) : context.getString( R.string.song_name, jsonObject.optString(CommandFields.Dynamic.SONG_NAME))); holder.singName.setText( jsonObject.optString(CommandFields.Dynamic.SINGER_NAME) == null ? context.getString( R.string.singer_name, context.getString(R.string.music_unknown)) : context.getString( R.string.singer_name, jsonObject.optString(CommandFields.Dynamic.SINGER_NAME))); holder.titleText.setText(jsonObject.optString(CommandFields.Dynamic.DYNAMIC_CONTENT)); } } else { holder.titleText.setText(story.getContent()); holder.mAnimView.setImageResource(R.drawable.ic_sound_play); holder.songName.setText( context.getString(R.string.song_name, context.getString(R.string.music_unknown))); holder.singName.setText( context.getString(R.string.singer_name, context.getString(R.string.music_unknown))); } }
@Override public void bindView(View contentView, LabelStory story) { ViewHolder holder = (ViewHolder) contentView.getTag(); holder.loadView.setVisibility(View.GONE); holder.durationText.setText(getDuration(story.getDuration())); bingSong(holder, story); }
private String getImageThumb(LabelStory story) { String[] thumbs = story.getThumbImages(); if (thumbs != null && thumbs.length > 0) { return thumbs[0]; } else { return null; } }
@Override public void bindView(View contentView, LabelStory story) { ViewHolder holder = (ViewHolder) contentView.getTag(); String content = story.getContent(); if (TextUtils.isEmpty(content)) { holder.banknoteText.setVisibility(View.GONE); } else { holder.banknoteText.setVisibility(View.VISIBLE); holder.banknoteText.setText(content); } String[] images = story.getThumbImages(); if (images != null && images.length > 0) { String image = images[0]; holder.banknoteImage.setVisibility(View.VISIBLE); MiscUtils.showLabelStoryImage( avatarManager, image, holder.banknoteImage, R.drawable.pic_loading); } else { holder.banknoteImage.setVisibility(View.GONE); } }
@Override public void bindView(View contentView, LabelStory story) { ViewHolder holder = (ViewHolder) contentView.getTag(); String content = story.getContent(); if (!TextUtils.isEmpty(content)) { holder.dynamicText.setVisibility(View.VISIBLE); holder.dynamicText.setText(content); } else { holder.dynamicText.setVisibility(View.GONE); } String imageThumb = getImageThumb(story); if (!TextUtils.isEmpty(imageThumb)) { holder.dynamicImage.setVisibility(View.VISIBLE); holder.dynamicImage.setScaleType(ImageView.ScaleType.CENTER_CROP); MiscUtils.showLabelStoryImageThumb( avatarManager, imageThumb, holder.dynamicImage, R.drawable.label_null_others); } else { holder.dynamicImage.setVisibility(View.GONE); } }
@Override public void bindView(View view) { ViewHolder holder = (ViewHolder) view.getTag(); if (mLabelStory != null && mLabelStory[0] != null) { final LabelStory story = mLabelStory[0]; holder.dynamicParent.setVisibility(View.VISIBLE); holder.dynamicNull.setVisibility(View.GONE); holder.dynamic_num.setText( mActivity.getResources().getString(R.string.dynamic_title, story.getStoryTotal())); holder.dynamic_num.setVisibility(story.getStoryTotal() == 0 ? View.GONE : View.VISIBLE); if (story.getStoryTotal() > 1) { holder.dynamic_more.setVisibility(View.VISIBLE); holder.dynamic_more.setText( String.format( mActivity.getResources().getString(R.string.check_more), story.getStoryTotal())); } else { holder.dynamic_more.setVisibility(View.GONE); } holder.dynamic_more.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Stranger stranger = new Stranger( mUserContact.getUserId(), mUserContact.getNickname(), mUserContact.getAvatarThumb(), mUserContact.getAvatar(), mUserContact.getSex()); UILauncher.launchMyLabelStoryUI(mActivity, mUserContact.getUserId(), stranger); } }); holder.content.bindView(holder.contentView, story); holder.contentView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Stranger stranger = new Stranger( mUserContact.getUserId(), mUserContact.getNickname(), mUserContact.getAvatarThumb(), mUserContact.getAvatar(), mUserContact.getSex()); story.setStranger(stranger); DynamicArguments arguments = new DynamicArguments(); arguments.setLabelStory(story); arguments.setIsShowFragment(true); arguments.setIsShowTitle(true); arguments.setTag(LabelStoryUtils.STRANGERINFO); UILauncher.launchFragmentLabelStoryDetaileUI(mActivity, arguments); } }); } else { holder.dynamic_more.setVisibility(View.GONE); holder.dynamicParent.setVisibility(View.GONE); holder.dynamicNull.setVisibility(View.VISIBLE); } holder.itemGap.setVisibility(lastItem ? View.GONE : View.VISIBLE); }