From 681cf9a8d3b33d0b24dc84ad2ceb5f696e9af953 Mon Sep 17 00:00:00 2001 From: Floens Date: Sun, 28 Jun 2015 11:48:26 +0200 Subject: [PATCH] Slant the replies/image count if it is over the limit. --- .../floens/chan/ui/cell/ThreadStatusCell.java | 21 +++++++++++++++++-- Clover/app/src/main/res/values/strings.xml | 1 - 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Clover/app/src/main/java/org/floens/chan/ui/cell/ThreadStatusCell.java b/Clover/app/src/main/java/org/floens/chan/ui/cell/ThreadStatusCell.java index 14f03cfc..84ccbca4 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/cell/ThreadStatusCell.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/cell/ThreadStatusCell.java @@ -18,14 +18,20 @@ package org.floens.chan.ui.cell; import android.content.Context; +import android.graphics.Typeface; import android.os.Handler; import android.os.Message; +import android.text.SpannableString; +import android.text.TextUtils; +import android.text.style.StyleSpan; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; +import org.floens.chan.Chan; import org.floens.chan.R; +import org.floens.chan.core.model.Board; import org.floens.chan.core.model.ChanThread; import org.floens.chan.core.model.Post; @@ -108,9 +114,20 @@ public class ThreadStatusCell extends LinearLayout implements View.OnClickListen } Post op = chanThread.op; - statusText += getContext().getString(R.string.thread_stats, op.replies, op.images, op.uniqueIps); - text.setText(statusText); + Board board = Chan.getBoardManager().getBoardByValue(chanThread.loadable.board); + if (board != null) { + SpannableString replies = new SpannableString(op.replies + "R"); + if (op.replies >= board.bumpLimit) { + replies.setSpan(new StyleSpan(Typeface.ITALIC), 0, replies.length(), 0); + } + SpannableString images = new SpannableString(op.images + "I"); + if (op.images >= board.imageLimit) { + images.setSpan(new StyleSpan(Typeface.ITALIC), 0, images.length(), 0); + } + + text.setText(TextUtils.concat(statusText, replies, " / ", images, " / ", String.valueOf(op.uniqueIps))); + } } } diff --git a/Clover/app/src/main/res/values/strings.xml b/Clover/app/src/main/res/values/strings.xml index 6d8fcc99..a738d8f8 100644 --- a/Clover/app/src/main/res/values/strings.xml +++ b/Clover/app/src/main/res/values/strings.xml @@ -103,7 +103,6 @@ along with this program. If not, see . Retry Archived Closed - %1$sR / %2$sI / %3$sP Board editor Add, remove and reorder your boards here.\nThe topmost board will be loaded automatically.