git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit '3519cb5c518d569235beaedfc3071cba45ec848d'
[fanfix.git]
/
src
/
be
/
nikiroo
/
fanfix
/
reader
/
ui
/
GuiReaderBookInfo.java
diff --git
a/src/be/nikiroo/fanfix/reader/ui/GuiReaderBookInfo.java
b/src/be/nikiroo/fanfix/reader/ui/GuiReaderBookInfo.java
index a5743c7b10f8ab80b21ff50a4aae5cf2273fbac4..c163834f493f875755ac0e3d15af12263433d7a2 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/ui/GuiReaderBookInfo.java
+++ b/
src/be/nikiroo/fanfix/reader/ui/GuiReaderBookInfo.java
@@
-1,5
+1,7
@@
package be.nikiroo.fanfix.reader.ui;
package be.nikiroo.fanfix.reader.ui;
+import java.io.IOException;
+
import be.nikiroo.fanfix.bundles.StringIdGui;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.bundles.StringIdGui;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Story;
@@
-51,6
+53,15
@@
public class GuiReaderBookInfo {
this.id = id;
this.value = value;
}
this.id = id;
this.value = value;
}
+
+ /**
+ * The type of {@link GuiReaderBookInfo}.
+ *
+ * @return the type
+ */
+ public Type getType() {
+ return type;
+ }
/**
* Get the main info to display for this book (a title, an author, a
/**
* Get the main info to display for this book (a title, an author, a
@@
-123,11
+134,22
@@
public class GuiReaderBookInfo {
* the {@link BasicLibrary} to use to fetch the image
*
* @return the base image
* the {@link BasicLibrary} to use to fetch the image
*
* @return the base image
+ *
+ * @throws IOException
+ * in case of I/O error
*/
*/
- public Image getBaseImage(BasicLibrary lib) {
+ public Image getBaseImage(BasicLibrary lib)
throws IOException
{
switch (type) {
case STORY:
switch (type) {
case STORY:
- return lib.getCover(meta.getLuid());
+ if (meta.getCover() != null) {
+ return meta.getCover();
+ }
+
+ if (meta.getLuid() != null) {
+ return lib.getCover(meta.getLuid());
+ }
+
+ return null;
case SOURCE:
return lib.getSourceCover(value);
case AUTHOR:
case SOURCE:
return lib.getSourceCover(value);
case AUTHOR:
@@
-150,6
+172,9
@@
public class GuiReaderBookInfo {
if (uid == null || uid.trim().isEmpty()) {
uid = meta.getLuid();
}
if (uid == null || uid.trim().isEmpty()) {
uid = meta.getLuid();
}
+ if (uid == null || uid.trim().isEmpty()) {
+ uid = meta.getUrl();
+ }
GuiReaderBookInfo info = new GuiReaderBookInfo(Type.STORY, uid,
meta.getTitle());
GuiReaderBookInfo info = new GuiReaderBookInfo(Type.STORY, uid,
meta.getTitle());
@@
-180,8
+205,13
@@
public class GuiReaderBookInfo {
GuiReaderBookInfo info = new GuiReaderBookInfo(Type.SOURCE, "source_"
+ source, source);
GuiReaderBookInfo info = new GuiReaderBookInfo(Type.SOURCE, "source_"
+ source, source);
- info.count = StringUtils.formatNumber(lib.getListBySource(source)
- .size());
+ int size = 0;
+ try {
+ size = lib.getListBySource(source).size();
+ } catch (IOException e) {
+ }
+
+ info.count = StringUtils.formatNumber(size);
if (!info.count.isEmpty()) {
info.count = GuiReader.trans(StringIdGui.BOOK_COUNT_STORIES,
info.count);
if (!info.count.isEmpty()) {
info.count = GuiReader.trans(StringIdGui.BOOK_COUNT_STORIES,
info.count);
@@
-205,8
+235,13
@@
public class GuiReaderBookInfo {
GuiReaderBookInfo info = new GuiReaderBookInfo(Type.AUTHOR, "author_"
+ author, author);
GuiReaderBookInfo info = new GuiReaderBookInfo(Type.AUTHOR, "author_"
+ author, author);
- info.count = StringUtils.formatNumber(lib.getListByAuthor(author)
- .size());
+ int size = 0;
+ try {
+ size = lib.getListByAuthor(author).size();
+ } catch (IOException e) {
+ }
+
+ info.count = StringUtils.formatNumber(size);
if (!info.count.isEmpty()) {
info.count = GuiReader.trans(StringIdGui.BOOK_COUNT_STORIES,
info.count);
if (!info.count.isEmpty()) {
info.count = GuiReader.trans(StringIdGui.BOOK_COUNT_STORIES,
info.count);