From 3d9460d4b6fbd1a7368a507add27e7c740290dd9 Mon Sep 17 00:00:00 2001 From: Florens Douwes Date: Sun, 6 Apr 2014 21:50:30 +0200 Subject: [PATCH] Added the closed icon to PostView The closed icon is placed alongside the sticky icon, and is visible when a post is closed. --- Chan/res/drawable-mdpi/closed_icon.png | Bin 0 -> 394 bytes Chan/src/org/floens/chan/ui/view/PostView.java | 9 ++++++++- Chan/src/org/floens/chan/utils/IconCache.java | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 Chan/res/drawable-mdpi/closed_icon.png diff --git a/Chan/res/drawable-mdpi/closed_icon.png b/Chan/res/drawable-mdpi/closed_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..565fc9384f2bd6c396106a3ab585b46c46d1010a GIT binary patch literal 394 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL8%hgh?3y^w370~qEv=}#LT=BJwMkFg)(D3 zQ$0gN_s>q|Kvh3IT^vI!{F4`OM(ikfSf3-I)hpj1vaj;Kpc?=%P9)YiCr6;&eDu5W>9 z4Cx>B-mo>y@jcP7W~%=G;wkTr&7@SyQ29qm;swQYIPOJ*?~p7V>au kOmK>kSk)VJ-~a=|*30u2dAY|$0|SA<)78&qol`;+03yYpCjbBd literal 0 HcmV?d00001 diff --git a/Chan/src/org/floens/chan/ui/view/PostView.java b/Chan/src/org/floens/chan/ui/view/PostView.java index d37f4fb2..9b7fcef8 100644 --- a/Chan/src/org/floens/chan/ui/view/PostView.java +++ b/Chan/src/org/floens/chan/ui/view/PostView.java @@ -52,6 +52,7 @@ public class PostView extends LinearLayout implements View.OnClickListener, View private TextView repliesCountView; private LinearLayout iconView; private ImageView stickyView; + private ImageView closedView; private NetworkImageView countryView; /** @@ -189,10 +190,12 @@ public class PostView extends LinearLayout implements View.OnClickListener, View boolean showCountryFlag = !TextUtils.isEmpty(post.country); boolean showStickyIcon = post.sticky; + boolean showClosedIcon = post.closed; - iconView.setVisibility((showCountryFlag || showStickyIcon) ? View.VISIBLE : View.GONE); + iconView.setVisibility((showCountryFlag || showStickyIcon || showClosedIcon) ? View.VISIBLE : View.GONE); stickyView.setVisibility(showStickyIcon ? View.VISIBLE : View.GONE); + closedView.setVisibility(showClosedIcon ? View.VISIBLE : View.GONE); if (showCountryFlag) { countryView.setVisibility(View.VISIBLE); countryView.setImageUrl(ChanUrls.getCountryFlagUrl(post.country), ChanApplication.getImageLoader()); @@ -272,6 +275,10 @@ public class PostView extends LinearLayout implements View.OnClickListener, View stickyView.setImageBitmap(IconCache.stickyIcon); iconView.addView(stickyView, new LinearLayout.LayoutParams(iconWidth, iconHeight)); + closedView = new ImageView(context); + closedView.setImageBitmap(IconCache.closedIcon); + iconView.addView(closedView, new LinearLayout.LayoutParams(iconWidth, iconHeight)); + countryView = new NetworkImageView(context); countryView.setScaleType(ImageView.ScaleType.FIT_CENTER); iconView.addView(countryView, new LinearLayout.LayoutParams(iconWidth, iconHeight)); diff --git a/Chan/src/org/floens/chan/utils/IconCache.java b/Chan/src/org/floens/chan/utils/IconCache.java index 71d01538..3b19916a 100644 --- a/Chan/src/org/floens/chan/utils/IconCache.java +++ b/Chan/src/org/floens/chan/utils/IconCache.java @@ -8,7 +8,8 @@ import android.graphics.BitmapFactory; public class IconCache { public static Bitmap stickyIcon; - + public static Bitmap closedIcon; + /** * Load the icons in the cache. Lightweight icons only! Icons can be null! * @param context @@ -18,6 +19,7 @@ public class IconCache { @Override public void run() { stickyIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.sticky_icon); + closedIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.closed_icon); } }).start(); }