diff --git a/app/src/main/java/io/legado/app/api/ReaderProvider.kt b/app/src/main/java/io/legado/app/api/ReaderProvider.kt index 3ae8c7963..23c74aa98 100644 --- a/app/src/main/java/io/legado/app/api/ReaderProvider.kt +++ b/app/src/main/java/io/legado/app/api/ReaderProvider.kt @@ -11,8 +11,8 @@ import android.database.* import android.net.Uri import android.os.Bundle import com.google.gson.Gson -import io.legado.app.web.controller.BookshelfController -import io.legado.app.web.controller.SourceController +import io.legado.app.api.controller.BookshelfController +import io.legado.app.api.controller.SourceController import io.legado.app.web.utils.ReturnData import java.util.* diff --git a/app/src/main/java/io/legado/app/web/controller/BookshelfController.kt b/app/src/main/java/io/legado/app/api/controller/BookshelfController.kt similarity index 94% rename from app/src/main/java/io/legado/app/web/controller/BookshelfController.kt rename to app/src/main/java/io/legado/app/api/controller/BookshelfController.kt index dba45d4c1..2130340c3 100644 --- a/app/src/main/java/io/legado/app/web/controller/BookshelfController.kt +++ b/app/src/main/java/io/legado/app/api/controller/BookshelfController.kt @@ -1,4 +1,4 @@ -package io.legado.app.web.controller +package io.legado.app.api.controller import io.legado.app.App import io.legado.app.constant.PreferKey @@ -79,6 +79,10 @@ object BookshelfController { val returnData = ReturnData() if (book != null) { App.db.bookDao().insert(book) + if (ReadBook.book?.bookUrl == book.bookUrl) { + ReadBook.book = book + ReadBook.durChapterIndex = book.durChapterIndex + } return returnData.setData("") } return returnData.setErrorMsg("格式不对") diff --git a/app/src/main/java/io/legado/app/web/controller/SourceController.kt b/app/src/main/java/io/legado/app/api/controller/SourceController.kt similarity index 98% rename from app/src/main/java/io/legado/app/web/controller/SourceController.kt rename to app/src/main/java/io/legado/app/api/controller/SourceController.kt index a76fe31e9..47236c9f5 100644 --- a/app/src/main/java/io/legado/app/web/controller/SourceController.kt +++ b/app/src/main/java/io/legado/app/api/controller/SourceController.kt @@ -1,4 +1,4 @@ -package io.legado.app.web.controller +package io.legado.app.api.controller import android.text.TextUtils diff --git a/app/src/main/java/io/legado/app/web/HttpServer.kt b/app/src/main/java/io/legado/app/web/HttpServer.kt index 066a921c3..da7c03400 100644 --- a/app/src/main/java/io/legado/app/web/HttpServer.kt +++ b/app/src/main/java/io/legado/app/web/HttpServer.kt @@ -2,8 +2,8 @@ package io.legado.app.web import com.google.gson.Gson import fi.iki.elonen.NanoHTTPD -import io.legado.app.web.controller.BookshelfController -import io.legado.app.web.controller.SourceController +import io.legado.app.api.controller.BookshelfController +import io.legado.app.api.controller.SourceController import io.legado.app.web.utils.AssetsWeb import io.legado.app.web.utils.ReturnData import java.util.* diff --git a/app/src/main/java/io/legado/app/web/controller/SourceDebugWebSocket.kt b/app/src/main/java/io/legado/app/web/SourceDebugWebSocket.kt similarity index 98% rename from app/src/main/java/io/legado/app/web/controller/SourceDebugWebSocket.kt rename to app/src/main/java/io/legado/app/web/SourceDebugWebSocket.kt index ae3172d2f..0a3fab8ef 100644 --- a/app/src/main/java/io/legado/app/web/controller/SourceDebugWebSocket.kt +++ b/app/src/main/java/io/legado/app/web/SourceDebugWebSocket.kt @@ -1,4 +1,4 @@ -package io.legado.app.web.controller +package io.legado.app.web import fi.iki.elonen.NanoHTTPD diff --git a/app/src/main/java/io/legado/app/web/WebSocketServer.kt b/app/src/main/java/io/legado/app/web/WebSocketServer.kt index c885a1e0a..d6a259687 100644 --- a/app/src/main/java/io/legado/app/web/WebSocketServer.kt +++ b/app/src/main/java/io/legado/app/web/WebSocketServer.kt @@ -1,7 +1,6 @@ package io.legado.app.web import fi.iki.elonen.NanoWSD -import io.legado.app.web.controller.SourceDebugWebSocket class WebSocketServer(port: Int) : NanoWSD(port) {