made ui handle missing information on search
This commit is contained in:
parent
d7e75e6011
commit
1a2840b33f
|
@ -41,8 +41,10 @@ class VideoInfoItemViewCreator {
|
|||
this.inflater = inflater;
|
||||
}
|
||||
|
||||
public View getViewFromVideoInfoItem(View convertView, ViewGroup parent, StreamPreviewInfo info, Context context) {
|
||||
public View getViewFromVideoInfoItem(View convertView, ViewGroup parent, StreamPreviewInfo info) {
|
||||
ViewHolder holder;
|
||||
|
||||
// generate holder
|
||||
if(convertView == null) {
|
||||
convertView = inflater.inflate(R.layout.video_item, parent, false);
|
||||
holder = new ViewHolder();
|
||||
|
@ -57,20 +59,41 @@ class VideoInfoItemViewCreator {
|
|||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
// fill with information
|
||||
|
||||
/*
|
||||
if(info.thumbnail == null) {
|
||||
holder.itemThumbnailView.setImageResource(R.drawable.dummy_thumbnail);
|
||||
} else {
|
||||
holder.itemThumbnailView.setImageBitmap(info.thumbnail);
|
||||
}
|
||||
*/
|
||||
holder.itemVideoTitleView.setText(info.title);
|
||||
holder.itemUploaderView.setText(info.uploader);
|
||||
holder.itemDurationView.setText(info.duration);
|
||||
holder.itemViewCountView.setText(shortViewCount(info.view_count));
|
||||
if(info.uploader != null && !info.uploader.isEmpty()) {
|
||||
holder.itemUploaderView.setText(info.uploader);
|
||||
} else {
|
||||
holder.itemDurationView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if(info.duration != null && !info.duration.isEmpty()) {
|
||||
holder.itemDurationView.setText(info.duration);
|
||||
} else {
|
||||
holder.itemDurationView.setVisibility(View.GONE);
|
||||
}
|
||||
if(info.view_count >= 0) {
|
||||
holder.itemViewCountView.setText(shortViewCount(info.view_count));
|
||||
} else {
|
||||
holder.itemViewCountView.setVisibility(View.GONE);
|
||||
}
|
||||
if(!info.upload_date.isEmpty()) {
|
||||
holder.itemUploadDateView.setText(info.upload_date+" • ");
|
||||
}
|
||||
|
||||
imageLoader.displayImage(info.thumbnail_url, holder.itemThumbnailView, displayImageOptions);
|
||||
if(info.thumbnail_url != null && !info.thumbnail_url.isEmpty()) {
|
||||
imageLoader.displayImage(info.thumbnail_url, holder.itemThumbnailView, displayImageOptions);
|
||||
} else {
|
||||
holder.itemThumbnailView.setImageResource(R.drawable.dummy_thumbnail);
|
||||
}
|
||||
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
|
|
@ -290,7 +290,7 @@ public class VideoItemDetailFragment extends Fragment {
|
|||
View nextVideoView = null;
|
||||
if(info.next_video != null) {
|
||||
nextVideoView = videoItemViewCreator
|
||||
.getViewFromVideoInfoItem(null, nextVideoFrame, info.next_video, getContext());
|
||||
.getViewFromVideoInfoItem(null, nextVideoFrame, info.next_video);
|
||||
} else {
|
||||
activity.findViewById(R.id.detailNextVidButtonAndContentLayout).setVisibility(View.GONE);
|
||||
activity.findViewById(R.id.detailNextVideoTitle).setVisibility(View.GONE);
|
||||
|
@ -672,7 +672,7 @@ public class VideoItemDetailFragment extends Fragment {
|
|||
ArrayList<StreamPreviewInfo> similar = new ArrayList<>(info.related_videos);
|
||||
for (final StreamPreviewInfo item : similar) {
|
||||
View similarView = videoItemViewCreator
|
||||
.getViewFromVideoInfoItem(null, similarLayout, item, getContext());
|
||||
.getViewFromVideoInfoItem(null, similarLayout, item);
|
||||
|
||||
similarView.setClickable(true);
|
||||
similarView.setFocusable(true);
|
||||
|
|
|
@ -78,7 +78,7 @@ class VideoListAdapter extends BaseAdapter {
|
|||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
convertView = viewCreator.getViewFromVideoInfoItem(convertView, parent, videoList.get(position), context);
|
||||
convertView = viewCreator.getViewFromVideoInfoItem(convertView, parent, videoList.get(position));
|
||||
|
||||
if(listView.isItemChecked(position)) {
|
||||
convertView.setBackgroundColor(ContextCompat.getColor(context,R.color.light_youtube_primary_color));
|
||||
|
|
Loading…
Reference in New Issue