use text drawables as a fallback when drawing compact thumbnails
This commit is contained in:
parent
dbd7d09a69
commit
40bce03f2d
@ -7,6 +7,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.res.Resources.Theme;
|
import android.content.res.Resources.Theme;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -701,7 +702,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
.cacheInMemory(true)
|
.cacheInMemory(true)
|
||||||
.resetViewBeforeLoading(true)
|
.resetViewBeforeLoading(true)
|
||||||
.cacheOnDisk(true)
|
.cacheOnDisk(true)
|
||||||
.displayer(m_compactLayoutMode ? new RoundedBitmapDisplayer(100) : new FadeInBitmapDisplayer(500))
|
.displayer(new FadeInBitmapDisplayer(500))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -741,8 +742,10 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
holder.textChecked.setVisibility(View.VISIBLE);
|
holder.textChecked.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
|
Drawable textDrawable = m_drawableBuilder.build(tmp, m_colorGenerator.getColor(item.title));
|
||||||
|
|
||||||
if (item.flavorImage == null) {
|
if (item.flavorImage == null) {
|
||||||
holder.textImage.setImageDrawable(m_drawableBuilder.build(tmp, m_colorGenerator.getColor(item.title)));
|
holder.textImage.setImageDrawable(textDrawable);
|
||||||
holder.textImage.setTag(null);
|
holder.textImage.setTag(null);
|
||||||
} else {
|
} else {
|
||||||
String imgSrc = item.flavorImage.attr("src");
|
String imgSrc = item.flavorImage.attr("src");
|
||||||
@ -753,7 +756,19 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
if (!imgSrc.equals(holder.textImage.getTag())) {
|
if (!imgSrc.equals(holder.textImage.getTag())) {
|
||||||
ImageAware imageAware = new ImageViewAware(holder.textImage, false);
|
ImageAware imageAware = new ImageViewAware(holder.textImage, false);
|
||||||
m_imageLoader.displayImage(imgSrc, imageAware, displayImageOptions);
|
|
||||||
|
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||||
|
.cacheInMemory(true)
|
||||||
|
.resetViewBeforeLoading(true)
|
||||||
|
.cacheOnDisk(true)
|
||||||
|
.showImageOnLoading(textDrawable)
|
||||||
|
.showImageOnFail(textDrawable)
|
||||||
|
.showImageForEmptyUri(textDrawable)
|
||||||
|
.displayer(new RoundedBitmapDisplayer(100))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
m_imageLoader.displayImage(imgSrc, imageAware, options);
|
||||||
holder.textImage.setTag(imgSrc);
|
holder.textImage.setTag(imgSrc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user