diff --git a/Clover/app/src/main/java/org/floens/chan/core/model/Post.java b/Clover/app/src/main/java/org/floens/chan/core/model/Post.java index 16dac0c4..75c5599f 100644 --- a/Clover/app/src/main/java/org/floens/chan/core/model/Post.java +++ b/Clover/app/src/main/java/org/floens/chan/core/model/Post.java @@ -69,6 +69,7 @@ public class Post { public String imageUrl; public boolean sticky = false; public boolean closed = false; + public boolean archived = false; public String tripcode = ""; public String id = ""; public String capcode = ""; diff --git a/Clover/app/src/main/java/org/floens/chan/core/net/ChanReaderRequest.java b/Clover/app/src/main/java/org/floens/chan/core/net/ChanReaderRequest.java index c2ee1607..3b0d8c90 100644 --- a/Clover/app/src/main/java/org/floens/chan/core/net/ChanReaderRequest.java +++ b/Clover/app/src/main/java/org/floens/chan/core/net/ChanReaderRequest.java @@ -331,6 +331,9 @@ public class ChanReaderRequest extends JsonReaderRequest> { case "closed": post.closed = reader.nextInt() == 1; break; + case "archived": + post.archived = reader.nextInt() == 1; + break; case "trip": post.tripcode = reader.nextString(); break; diff --git a/Clover/app/src/main/java/org/floens/chan/ui/view/PostView.java b/Clover/app/src/main/java/org/floens/chan/ui/view/PostView.java index fa834288..5473f4c7 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/view/PostView.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/view/PostView.java @@ -78,6 +78,7 @@ public class PostView extends LinearLayout implements View.OnClickListener { private ImageView stickyView; private ImageView closedView; private ImageView deletedView; + private ImageView archivedView; private NetworkImageView countryView; private ImageView optionsView; private View lastSeen; @@ -215,14 +216,16 @@ public class PostView extends LinearLayout implements View.OnClickListener { boolean showCountryFlag = isList() && !TextUtils.isEmpty(post.country) && !TextUtils.isEmpty(post.countryUrl); boolean showStickyIcon = isList() && post.sticky; - boolean showClosedIcon = isList() && post.closed; boolean showDeletedIcon = isList() && post.deleted; + boolean showArchivedIcon = isList() && post.archived; + boolean showClosedIcon = isList() && post.closed && !showArchivedIcon; - iconsView.setVisibility((showCountryFlag || showStickyIcon || showClosedIcon || showDeletedIcon) ? View.VISIBLE : View.GONE); + iconsView.setVisibility((showCountryFlag || showStickyIcon || showClosedIcon || showDeletedIcon || showArchivedIcon) ? View.VISIBLE : View.GONE); stickyView.setVisibility(showStickyIcon ? View.VISIBLE : View.GONE); closedView.setVisibility(showClosedIcon ? View.VISIBLE : View.GONE); deletedView.setVisibility(showDeletedIcon ? View.VISIBLE : View.GONE); + archivedView.setVisibility(showArchivedIcon ? View.VISIBLE : View.GONE); if (showCountryFlag) { countryView.setVisibility(View.VISIBLE); countryView.setImageUrl(post.countryUrl, ChanApplication.getVolleyImageLoader()); @@ -352,17 +355,21 @@ public class PostView extends LinearLayout implements View.OnClickListener { iconsView.setPadding(postPadding, iconPadding, postPadding, 0); stickyView = new ImageView(context); - stickyView.setImageBitmap(IconCache.stickyIcon); + stickyView.setImageDrawable(IconCache.stickyIcon); iconsView.addView(stickyView, new LinearLayout.LayoutParams(iconWidth, iconHeight)); closedView = new ImageView(context); - closedView.setImageBitmap(IconCache.closedIcon); + closedView.setImageDrawable(IconCache.closedIcon); iconsView.addView(closedView, new LinearLayout.LayoutParams(iconWidth, iconHeight)); deletedView = new ImageView(context); - deletedView.setImageBitmap(IconCache.trashIcon); + deletedView.setImageDrawable(IconCache.trashIcon); iconsView.addView(deletedView, new LinearLayout.LayoutParams(iconWidth, iconHeight)); + archivedView = new ImageView(context); + archivedView.setImageDrawable(IconCache.archivedIcon); + iconsView.addView(archivedView, new LinearLayout.LayoutParams(iconWidth, iconHeight)); + countryView = new NetworkImageView(context); countryView.setScaleType(ImageView.ScaleType.FIT_CENTER); iconsView.addView(countryView, new LinearLayout.LayoutParams(iconWidth, iconHeight)); diff --git a/Clover/app/src/main/java/org/floens/chan/utils/IconCache.java b/Clover/app/src/main/java/org/floens/chan/utils/IconCache.java index 57189ec0..1bebb0d3 100644 --- a/Clover/app/src/main/java/org/floens/chan/utils/IconCache.java +++ b/Clover/app/src/main/java/org/floens/chan/utils/IconCache.java @@ -18,19 +18,24 @@ package org.floens.chan.utils; import android.content.Context; +import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.drawable.BitmapDrawable; import org.floens.chan.R; public class IconCache { - public static Bitmap stickyIcon; - public static Bitmap closedIcon; - public static Bitmap trashIcon; + public static BitmapDrawable stickyIcon; + public static BitmapDrawable closedIcon; + public static BitmapDrawable trashIcon; + public static BitmapDrawable archivedIcon; public static void createIcons(final Context context) { - stickyIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.sticky_icon); - closedIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.closed_icon); - trashIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.trash_icon); + Resources res = context.getResources(); + stickyIcon = new BitmapDrawable(res, BitmapFactory.decodeResource(res, R.drawable.sticky_icon)); + closedIcon = new BitmapDrawable(res, BitmapFactory.decodeResource(res, R.drawable.closed_icon)); + trashIcon = new BitmapDrawable(res, BitmapFactory.decodeResource(res, R.drawable.trash_icon)); + archivedIcon = new BitmapDrawable(res, BitmapFactory.decodeResource(res, R.drawable.archived_icon)); } } diff --git a/Clover/app/src/main/res/drawable-mdpi/archived_icon.png b/Clover/app/src/main/res/drawable-mdpi/archived_icon.png new file mode 100644 index 00000000..94a38e2b Binary files /dev/null and b/Clover/app/src/main/res/drawable-mdpi/archived_icon.png differ