From 1f2a91b98ff47cda5168f6d863c40b305c08e7e4 Mon Sep 17 00:00:00 2001 From: GKF Date: Tue, 6 Nov 2018 08:25:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/monke/monkeybook/model/ImportBookModel.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/monke/monkeybook/model/ImportBookModel.java b/app/src/main/java/com/monke/monkeybook/model/ImportBookModel.java index 4f1c14c25a..fc9ea13ead 100644 --- a/app/src/main/java/com/monke/monkeybook/model/ImportBookModel.java +++ b/app/src/main/java/com/monke/monkeybook/model/ImportBookModel.java @@ -45,9 +45,15 @@ public Observable importBook(final File file) { int authorIndex = fileName.indexOf("作者"); if (authorIndex != -1) { bookInfoBean.setAuthor(FormatWebText.getAuthor(fileName.substring(authorIndex))); - bookInfoBean.setName(fileName.substring(0, authorIndex)); + fileName = fileName.substring(0, authorIndex-1); } else { bookInfoBean.setAuthor(""); + } + int smhStart = fileName.indexOf("《"); + int smhEnd = fileName.indexOf("》"); + if (smhStart != -1 && smhEnd != -1) { + bookInfoBean.setName(fileName.substring(smhStart + 1, smhEnd)); + } else { bookInfoBean.setName(fileName); } bookInfoBean.setFinalRefreshData(file.lastModified());