From c88d8f0dedf62df40b8d8b5f72cbd18d968c6195 Mon Sep 17 00:00:00 2001 From: inorichi Date: Tue, 13 Oct 2015 18:57:10 +0200 Subject: [PATCH] Rename library holder --- .../eu/kanade/mangafeed/data/models/Manga.java | 1 - .../mangafeed/ui/adapter/LibraryAdapter.java | 2 +- ...MangaLibraryHolder.java => LibraryHolder.java} | 15 ++++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) rename app/src/main/java/eu/kanade/mangafeed/ui/adapter/{MangaLibraryHolder.java => LibraryHolder.java} (69%) diff --git a/app/src/main/java/eu/kanade/mangafeed/data/models/Manga.java b/app/src/main/java/eu/kanade/mangafeed/data/models/Manga.java index b71f75df50..17ea54d208 100644 --- a/app/src/main/java/eu/kanade/mangafeed/data/models/Manga.java +++ b/app/src/main/java/eu/kanade/mangafeed/data/models/Manga.java @@ -1,6 +1,5 @@ package eu.kanade.mangafeed.data.models; -import android.support.annotation.NonNull; import android.support.annotation.Nullable; import com.pushtorefresh.storio.sqlite.annotations.StorIOSQLiteColumn; diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/adapter/LibraryAdapter.java b/app/src/main/java/eu/kanade/mangafeed/ui/adapter/LibraryAdapter.java index 723a97adc7..b0cbb0c4ea 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/adapter/LibraryAdapter.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/adapter/LibraryAdapter.java @@ -16,7 +16,7 @@ public class LibraryAdapter extends EasyAdapter implements Filterable { Filter filter; public LibraryAdapter(Context context) { - super(context, MangaLibraryHolder.class); + super(context, LibraryHolder.class); filter = new CatalogueFilter(); } diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/adapter/MangaLibraryHolder.java b/app/src/main/java/eu/kanade/mangafeed/ui/adapter/LibraryHolder.java similarity index 69% rename from app/src/main/java/eu/kanade/mangafeed/ui/adapter/MangaLibraryHolder.java rename to app/src/main/java/eu/kanade/mangafeed/ui/adapter/LibraryHolder.java index f23e75debf..42c540db53 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/adapter/MangaLibraryHolder.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/adapter/LibraryHolder.java @@ -5,6 +5,7 @@ import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; +import com.bumptech.glide.load.engine.DiskCacheStrategy; import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.data.models.Manga; @@ -15,7 +16,7 @@ import uk.co.ribot.easyadapter.annotations.ViewId; @LayoutId(R.layout.item_library) -public class MangaLibraryHolder extends ItemViewHolder { +public class LibraryHolder extends ItemViewHolder { @ViewId(R.id.thumbnailImage) ImageView mThumbImage; @@ -26,7 +27,7 @@ public class MangaLibraryHolder extends ItemViewHolder { @ViewId(R.id.unreadText) TextView mUnreadText; - public MangaLibraryHolder(View view) { + public LibraryHolder(View view) { super(view); } @@ -39,8 +40,16 @@ public class MangaLibraryHolder extends ItemViewHolder { else { mUnreadText.setVisibility(View.GONE); } + + String thumbnail; + if (manga.thumbnail_url != null) + thumbnail = manga.thumbnail_url; + else + thumbnail = "http://img1.wikia.nocookie.net/__cb20090524204255/starwars/images/thumb/1/1a/R2d2.jpg/400px-R2d2.jpg"; + Glide.with(getContext()) - .load("http://img1.wikia.nocookie.net/__cb20090524204255/starwars/images/thumb/1/1a/R2d2.jpg/400px-R2d2.jpg") + .load(thumbnail) + .diskCacheStrategy(DiskCacheStrategy.RESULT) .centerCrop() .into(mThumbImage); }