From fdc55375d1439a3d70159b8bcb0d433c74d96200 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Mon, 4 Mar 2019 14:26:35 +0100 Subject: [PATCH] small code cleanup --- .../fanfix/reader/tui/TuiReaderApplication.java | 1 - .../fanfix/reader/tui/TuiReaderStoryWindow.java | 14 ++++++++++---- src/be/nikiroo/fanfix/supported/BasicSupport.java | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java b/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java index 9e991e4..b7109ab 100644 --- a/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java +++ b/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java @@ -57,7 +57,6 @@ class TuiReaderApplication extends TApplication implements Reader { public TuiReaderApplication(Reader reader, String source, TApplication.BackendType backend) throws Exception { super(backend); - init(reader); main = new TuiReaderMainWindow(this); diff --git a/src/be/nikiroo/fanfix/reader/tui/TuiReaderStoryWindow.java b/src/be/nikiroo/fanfix/reader/tui/TuiReaderStoryWindow.java index e4587e7..ead70d4 100644 --- a/src/be/nikiroo/fanfix/reader/tui/TuiReaderStoryWindow.java +++ b/src/be/nikiroo/fanfix/reader/tui/TuiReaderStoryWindow.java @@ -133,7 +133,10 @@ class TuiReaderStoryWindow extends TWindow { String name; if (chapter == 0) { chap = getStory().getMeta().getResume(); - name = String.format(" %s", chap.getName()); + if (chap != null) + name = String.format(" %s", chap.getName()); + else + name = "[No RESUME]"; } else { chap = getStory().getChapters().get(chapter - 1); name = String @@ -148,14 +151,17 @@ class TuiReaderStoryWindow extends TWindow { StringBuilder builder = new StringBuilder(); // TODO: i18n - String c = String.format("Chapter %d: %s", chapter, chap.getName()); + String c = String.format("Chapter %d: %s", chapter, + chap == null ? "[No RESUME]" : chap.getName()); builder.append(c).append("\n"); for (int i = 0; i < c.length(); i++) { builder.append("═"); } builder.append("\n\n"); - for (Paragraph para : chap) { - builder.append(para.getContent()).append("\n\n"); + if (chap != null) { + for (Paragraph para : chap) { + builder.append(para.getContent()).append("\n\n"); + } } textField.setText(builder.toString()); textField.reflow(); diff --git a/src/be/nikiroo/fanfix/supported/BasicSupport.java b/src/be/nikiroo/fanfix/supported/BasicSupport.java index 388f572..4337626 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupport.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupport.java @@ -295,7 +295,7 @@ public abstract class BasicSupport { getDesc(), isHtml(), null)); } - pg.setProgress(100); + pg.done(); return story; } @@ -394,6 +394,7 @@ public abstract class BasicSupport { } pgChaps.setName("Extracting chapters"); + pgChaps.done(); } pg.done(); -- 2.27.0