feat: 优化代码

pull/141/head
kunfei 5 years ago
parent 00caf1e9c9
commit fa6b84589e
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  2. 8
      app/src/main/java/io/legado/app/web/HttpServer.kt
  3. 2
      app/src/main/java/io/legado/app/web/controller/BookshelfController.kt

@ -108,7 +108,7 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack {
textBold = !textBold textBold = !textBold
tv_text_bold.isSelected = textBold tv_text_bold.isSelected = textBold
} }
postEvent(EventBus.UP_CONFIG, false) postEvent(EventBus.UP_CONFIG, true)
} }
tv_text_font.onClick { tv_text_font.onClick {
FontSelectDialog().show(childFragmentManager, "fontSelectDialog") FontSelectDialog().show(childFragmentManager, "fontSelectDialog")

@ -47,10 +47,10 @@ class HttpServer(port: Int) : NanoHTTPD(port) {
"/getSource" -> returnData = SourceController().getSource(parameters) "/getSource" -> returnData = SourceController().getSource(parameters)
"/getSources" -> returnData = SourceController().sources "/getSources" -> returnData = SourceController().sources
"/getBookshelf" -> returnData = BookshelfController().bookshelf "/getBookshelf" -> returnData = BookshelfController().bookshelf
"/getChapterList" -> returnData = "/getChapterList" ->
BookshelfController().getChapterList(parameters) returnData = BookshelfController().getChapterList(parameters)
"/getBookContent" -> returnData = "/getBookContent" ->
BookshelfController().getBookContent(parameters) returnData = BookshelfController().getBookContent(parameters)
} }
} }
} }

@ -37,7 +37,7 @@ class BookshelfController {
return returnData.setErrorMsg("参数url不能为空,请指定内容地址") return returnData.setErrorMsg("参数url不能为空,请指定内容地址")
} }
val book = App.db.bookDao().getBook(strings[0]) val book = App.db.bookDao().getBook(strings[0])
val chapter = App.db.bookChapterDao().getChapter(strings[0], strings[1].toInt()) val chapter = App.db.bookChapterDao().getChapter(strings[0], 1)
if (book == null || chapter == null) { if (book == null || chapter == null) {
returnData.setErrorMsg("未找到") returnData.setErrorMsg("未找到")
} else { } else {

Loading…
Cancel
Save