minor headlines fragment fixes
This commit is contained in:
parent
081f68bad4
commit
3b55543ee6
@ -1043,12 +1043,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
Element source = video.select("source").first();
|
Element source = video.select("source").first();
|
||||||
|
|
||||||
final String streamUri = source.attr("src");
|
final String streamUri = source.attr("src");
|
||||||
String posterUri = video.attr("poster");
|
final String posterUri = video.attr("poster");
|
||||||
|
|
||||||
if (streamUri.length() > 0 && posterUri.length() > 0) {
|
if (streamUri.length() > 0 && posterUri.length() > 0) {
|
||||||
|
|
||||||
if (!posterUri.equals(holder.flavorImageView.getTag())) {
|
if (!posterUri.equals(holder.flavorImageView.getTag())) {
|
||||||
holder.flavorImageView.setTag(posterUri);
|
|
||||||
|
|
||||||
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
||||||
|
|
||||||
@ -1066,6 +1065,9 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
@Override
|
@Override
|
||||||
public void onLoadingComplete(String s, View view, Bitmap bitmap) {
|
public void onLoadingComplete(String s, View view, Bitmap bitmap) {
|
||||||
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
||||||
|
holder.flavorImageView.setTag(posterUri);
|
||||||
|
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||||
|
holder.flavorVideoPlayView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1074,12 +1076,13 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||||
|
holder.flavorVideoPlayView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
videoFound = true;
|
videoFound = true;
|
||||||
|
|
||||||
holder.flavorImageView.setVisibility(View.VISIBLE);
|
|
||||||
holder.flavorVideoPlayView.setVisibility(View.VISIBLE);
|
|
||||||
holder.flavorVideoPlayView.setImageResource(R.drawable.flavor_video_play);
|
holder.flavorVideoPlayView.setImageResource(R.drawable.flavor_video_play);
|
||||||
|
|
||||||
ViewCompat.setTransitionName(holder.flavorImageView, "TRANSITION:ARTICLE_VIDEO_PLAYER");
|
ViewCompat.setTransitionName(holder.flavorImageView, "TRANSITION:ARTICLE_VIDEO_PLAYER");
|
||||||
@ -1118,15 +1121,14 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
String vid = matcher.group(1);
|
String vid = matcher.group(1);
|
||||||
String thumbUri = "http://img.youtube.com/vi/"+vid+"/mqdefault.jpg";
|
final String thumbUri = "http://img.youtube.com/vi/"+vid+"/mqdefault.jpg";
|
||||||
final String videoUri = "https://youtu.be/" + vid;
|
final String videoUri = "https://youtu.be/" + vid;
|
||||||
|
|
||||||
videoFound = true;
|
videoFound = true;
|
||||||
|
|
||||||
holder.flavorImageView.setVisibility(View.VISIBLE);
|
|
||||||
holder.flavorVideoPlayView.setVisibility(View.VISIBLE);
|
|
||||||
holder.flavorVideoPlayView.setImageResource(R.drawable.flavor_video_play_youtube);
|
holder.flavorVideoPlayView.setImageResource(R.drawable.flavor_video_play_youtube);
|
||||||
|
|
||||||
|
if (!thumbUri.equals(holder.flavorImageView.getTag())) {
|
||||||
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
||||||
m_imageLoader.displayImage(thumbUri, imageAware, displayImageOptions, new ImageLoadingListener() {
|
m_imageLoader.displayImage(thumbUri, imageAware, displayImageOptions, new ImageLoadingListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -1142,6 +1144,9 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
@Override
|
@Override
|
||||||
public void onLoadingComplete(String s, View view, Bitmap bitmap) {
|
public void onLoadingComplete(String s, View view, Bitmap bitmap) {
|
||||||
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
||||||
|
holder.flavorImageView.setTag(thumbUri);
|
||||||
|
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||||
|
holder.flavorVideoPlayView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1150,6 +1155,10 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||||
|
holder.flavorVideoPlayView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
holder.flavorImageView.setOnClickListener(new OnClickListener() {
|
holder.flavorImageView.setOnClickListener(new OnClickListener() {
|
||||||
@ -1206,10 +1215,9 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
if (holder.flavorImageView.getTag() == null || !holder.flavorImageView.getTag().equals(imgSrc)) {
|
if (holder.flavorImageView.getTag() == null || !holder.flavorImageView.getTag().equals(imgSrc)) {
|
||||||
|
|
||||||
holder.flavorImageView.setTag(imgSrc);
|
|
||||||
|
|
||||||
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
||||||
|
|
||||||
|
final String finalImgSrc = imgSrc;
|
||||||
m_imageLoader.displayImage(imgSrc, imageAware, displayImageOptions, new ImageLoadingListener() {
|
m_imageLoader.displayImage(imgSrc, imageAware, displayImageOptions, new ImageLoadingListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1224,6 +1232,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
View arg1, Bitmap arg2) {
|
View arg1, Bitmap arg2) {
|
||||||
if (!isAdded() || arg2 == null) return;
|
if (!isAdded() || arg2 == null) return;
|
||||||
|
|
||||||
|
|
||||||
|
holder.flavorImageView.setTag(finalImgSrc);
|
||||||
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (arg2.getWidth() > FLAVOR_IMG_MIN_WIDTH && arg2.getHeight() > FLAVOR_IMG_MIN_HEIGHT) {
|
if (arg2.getWidth() > FLAVOR_IMG_MIN_WIDTH && arg2.getHeight() > FLAVOR_IMG_MIN_HEIGHT) {
|
||||||
|
@ -109,7 +109,7 @@
|
|||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="@android:color/primary_text_dark"
|
android:textColor="@android:color/primary_text_dark"
|
||||||
android:text="5 more images"
|
android:text="@string/flavor_image_prompt"
|
||||||
android:background="#90000000"
|
android:background="#90000000"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:id="@+id/flavor_image_prompt" />
|
android:id="@+id/flavor_image_prompt" />
|
||||||
|
Loading…
Reference in New Issue
Block a user