Added the closed icon to PostView

The closed icon is placed alongside the sticky icon, and is visible when a post is closed.
captchafix
Florens Douwes 11 years ago
parent e828739666
commit 3d9460d4b6
  1. BIN
      Chan/res/drawable-mdpi/closed_icon.png
  2. 9
      Chan/src/org/floens/chan/ui/view/PostView.java
  3. 2
      Chan/src/org/floens/chan/utils/IconCache.java

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

@ -52,6 +52,7 @@ public class PostView extends LinearLayout implements View.OnClickListener, View
private TextView repliesCountView; private TextView repliesCountView;
private LinearLayout iconView; private LinearLayout iconView;
private ImageView stickyView; private ImageView stickyView;
private ImageView closedView;
private NetworkImageView countryView; private NetworkImageView countryView;
/** /**
@ -189,10 +190,12 @@ public class PostView extends LinearLayout implements View.OnClickListener, View
boolean showCountryFlag = !TextUtils.isEmpty(post.country); boolean showCountryFlag = !TextUtils.isEmpty(post.country);
boolean showStickyIcon = post.sticky; 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); stickyView.setVisibility(showStickyIcon ? View.VISIBLE : View.GONE);
closedView.setVisibility(showClosedIcon ? View.VISIBLE : View.GONE);
if (showCountryFlag) { if (showCountryFlag) {
countryView.setVisibility(View.VISIBLE); countryView.setVisibility(View.VISIBLE);
countryView.setImageUrl(ChanUrls.getCountryFlagUrl(post.country), ChanApplication.getImageLoader()); 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); stickyView.setImageBitmap(IconCache.stickyIcon);
iconView.addView(stickyView, new LinearLayout.LayoutParams(iconWidth, iconHeight)); 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 = new NetworkImageView(context);
countryView.setScaleType(ImageView.ScaleType.FIT_CENTER); countryView.setScaleType(ImageView.ScaleType.FIT_CENTER);
iconView.addView(countryView, new LinearLayout.LayoutParams(iconWidth, iconHeight)); iconView.addView(countryView, new LinearLayout.LayoutParams(iconWidth, iconHeight));

@ -8,6 +8,7 @@ import android.graphics.BitmapFactory;
public class IconCache { public class IconCache {
public static Bitmap stickyIcon; public static Bitmap stickyIcon;
public static Bitmap closedIcon;
/** /**
* Load the icons in the cache. Lightweight icons only! Icons can be null! * Load the icons in the cache. Lightweight icons only! Icons can be null!
@ -18,6 +19,7 @@ public class IconCache {
@Override @Override
public void run() { public void run() {
stickyIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.sticky_icon); stickyIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.sticky_icon);
closedIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.closed_icon);
} }
}).start(); }).start();
} }

Loading…
Cancel
Save