headlines fragment: remove some obsolete code
This commit is contained in:
parent
7c9570c503
commit
3b37e33d6b
@ -989,8 +989,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
@Override
|
||||
public void onLoadingComplete(String arg0,
|
||||
View arg1, Bitmap arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
if (!isAdded() || arg2 == null) return;
|
||||
|
||||
flavorImageLoadingBar.setVisibility(View.INVISIBLE);
|
||||
@ -1005,7 +1003,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
@Override
|
||||
public void onLoadingFailed(String arg0,
|
||||
View arg1, FailReason arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
flavorImageHolder.setVisibility(View.GONE);
|
||||
article.noValidFlavorImage = true;
|
||||
}
|
||||
@ -1031,146 +1028,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
} else if (holder.flavorImageHolder != null) {
|
||||
holder.flavorImageHolder.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
/* if (holder.flavorImageView != null && showFlavorImage) {
|
||||
holder.flavorImageArrow.setVisibility(View.GONE);
|
||||
|
||||
boolean loadableImageFound = false;
|
||||
|
||||
if (article.articleDoc != null) {
|
||||
|
||||
Elements imgs = article.articleDoc.select("img");
|
||||
|
||||
Element img = null;
|
||||
|
||||
for (Element tmp : imgs) {
|
||||
try {
|
||||
if (Integer.valueOf(tmp.attr("width")) > FLAVOR_IMG_MIN_WIDTH && Integer.valueOf(tmp.attr("width")) > FLAVOR_IMG_MIN_HEIGHT) {
|
||||
img = tmp;
|
||||
break;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
if (img == null)
|
||||
img = imgs.first();
|
||||
|
||||
if (img != null) {
|
||||
String imgSrc = img.attr("src");
|
||||
final String imgSrcFirst = imgSrc;
|
||||
|
||||
// retarded schema-less urls
|
||||
if (imgSrc.indexOf("//") == 0)
|
||||
imgSrc = "http:" + imgSrc;
|
||||
|
||||
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||
.displayer(new FadeInBitmapDisplayer(500))
|
||||
.cacheInMemory(true)
|
||||
.resetViewBeforeLoading(true)
|
||||
.cacheOnDisk(true)
|
||||
.build();
|
||||
|
||||
ViewCompat.setTransitionName(holder.flavorImageView, "TRANSITION:ARTICLE_IMAGES_PAGER");
|
||||
|
||||
holder.flavorImageView.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
Intent intent = new Intent(m_activity, ArticleImagesPagerActivity.class);
|
||||
intent.putExtra("firstSrc", imgSrcFirst);
|
||||
intent.putExtra("title", article.title);
|
||||
intent.putExtra("content", article.content);
|
||||
|
||||
ActivityOptionsCompat options =
|
||||
ActivityOptionsCompat.makeSceneTransitionAnimation(m_activity,
|
||||
holder.flavorImageView, // The view which starts the transition
|
||||
"TRANSITION:ARTICLE_IMAGES_PAGER" // The transitionName of the view we’re transitioning to
|
||||
);
|
||||
ActivityCompat.startActivity(m_activity, intent, options.toBundle());
|
||||
|
||||
//startActivityForResult(intent, 0);
|
||||
}
|
||||
});
|
||||
|
||||
final ViewGroup flavorImageHolder = holder.flavorImageHolder;
|
||||
final ImageView flavorImageView = holder.flavorImageView;
|
||||
final ProgressBar flavorImageLoadingBar = holder.flavorImageLoadingBar;
|
||||
|
||||
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
||||
|
||||
flavorImageHolder.setVisibility(View.VISIBLE);
|
||||
|
||||
if (imgs.size() > 1 && holder.flavorImageArrow != null) {
|
||||
holder.flavorImageArrow.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
final boolean weNeedAnimation = MemoryCacheUtils.findCachedBitmapsForImageUri(imgSrc, ImageLoader.getInstance().getMemoryCache()).size() == 0;
|
||||
|
||||
loadableImageFound = true;
|
||||
ImageLoader.getInstance().displayImage(imgSrc, imageAware, options, new ImageLoadingListener() {
|
||||
|
||||
@Override
|
||||
public void onLoadingCancelled(String arg0,
|
||||
View arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
@Override
|
||||
public void onLoadingComplete(String arg0,
|
||||
View arg1, Bitmap arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
if (!isAdded() || arg2 == null) return;
|
||||
|
||||
flavorImageLoadingBar.setVisibility(View.INVISIBLE);
|
||||
|
||||
if (arg2.getWidth() > FLAVOR_IMG_MIN_WIDTH && arg2.getHeight() > FLAVOR_IMG_MIN_HEIGHT) {
|
||||
if (weNeedAnimation) {
|
||||
ObjectAnimator anim = ObjectAnimator.ofFloat(flavorImageView, "alpha", 0f, 1f);
|
||||
anim.setDuration(200);
|
||||
anim.start();
|
||||
}
|
||||
//flavorImageHolder.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
flavorImageHolder.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingFailed(String arg0,
|
||||
View arg1, FailReason arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
flavorImageHolder.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted(String arg0,
|
||||
View arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!loadableImageFound && holder.flavorImageHolder != null) {
|
||||
holder.flavorImageHolder.setVisibility(View.GONE);
|
||||
}
|
||||
} else if (holder.flavorImageHolder != null) {
|
||||
holder.flavorImageHolder.setVisibility(View.GONE);
|
||||
}
|
||||
} else if (holder.flavorImageHolder != null) {
|
||||
holder.flavorImageHolder.setVisibility(View.GONE); */
|
||||
}
|
||||
|
||||
|
||||
String articleAuthor = article.author != null ? article.author : "";
|
||||
|
||||
|
||||
|
||||
|
||||
if (holder.authorView != null) {
|
||||
holder.authorView.setTextSize(TypedValue.COMPLEX_UNIT_SP, headlineSmallFontSize);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user