From b4b7ac5cf817edcdfa0be90ecdd7f94d9be57de0 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Mon, 15 Apr 2019 18:48:01 +0200 Subject: [PATCH] code cleanup --- .../fanfix/reader/ui/GuiReaderBookInfo.java | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReaderBookInfo.java b/src/be/nikiroo/fanfix/reader/ui/GuiReaderBookInfo.java index eb6dfbf..a5743c7 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReaderBookInfo.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReaderBookInfo.java @@ -155,7 +155,7 @@ public class GuiReaderBookInfo { meta.getTitle()); info.meta = meta; - info.count = formatNumber(meta.getWords()); + info.count = StringUtils.formatNumber(meta.getWords()); if (!info.count.isEmpty()) { info.count = GuiReader.trans( meta.isImageDocument() ? StringIdGui.BOOK_COUNT_IMAGES @@ -180,7 +180,8 @@ public class GuiReaderBookInfo { GuiReaderBookInfo info = new GuiReaderBookInfo(Type.SOURCE, "source_" + source, source); - info.count = formatNumber(lib.getListBySource(source).size()); + info.count = StringUtils.formatNumber(lib.getListBySource(source) + .size()); if (!info.count.isEmpty()) { info.count = GuiReader.trans(StringIdGui.BOOK_COUNT_STORIES, info.count); @@ -204,7 +205,8 @@ public class GuiReaderBookInfo { GuiReaderBookInfo info = new GuiReaderBookInfo(Type.AUTHOR, "author_" + author, author); - info.count = formatNumber(lib.getListByAuthor(author).size()); + info.count = StringUtils.formatNumber(lib.getListByAuthor(author) + .size()); if (!info.count.isEmpty()) { info.count = GuiReader.trans(StringIdGui.BOOK_COUNT_STORIES, info.count); @@ -212,30 +214,4 @@ public class GuiReaderBookInfo { return info; } - - /** - * Format a number for display (use the "k" notation if higher or equal to - * 4000). - * - * @param number - * the number to parse - * - * @return the displayable version of the number - * - * @deprecated use {@link StringUtils} after update instead - */ - @Deprecated - static private String formatNumber(long number) { - // TODO: replace with StringUtils after update - String displayNumber; - if (number >= 4000) { - displayNumber = "" + (number / 1000) + "k"; - } else if (number > 0) { - displayNumber = "" + number; - } else { - displayNumber = ""; - } - - return displayNumber; - } } -- 2.27.0