|
|
@ -1,4 +1,4 @@ |
|
|
|
package io.legado.app.ui.sourceedit |
|
|
|
package io.legado.app.ui.book.source.edit |
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity |
|
|
|
import android.app.Activity |
|
|
|
import android.content.ClipData |
|
|
|
import android.content.ClipData |
|
|
@ -20,7 +20,7 @@ import io.legado.app.base.VMBaseActivity |
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
import io.legado.app.data.entities.rule.* |
|
|
|
import io.legado.app.data.entities.rule.* |
|
|
|
import io.legado.app.lib.theme.ATH |
|
|
|
import io.legado.app.lib.theme.ATH |
|
|
|
import io.legado.app.ui.sourcedebug.SourceDebugActivity |
|
|
|
import io.legado.app.ui.book.source.debug.SourceDebugActivity |
|
|
|
import io.legado.app.ui.widget.KeyboardToolPop |
|
|
|
import io.legado.app.ui.widget.KeyboardToolPop |
|
|
|
import io.legado.app.utils.GSON |
|
|
|
import io.legado.app.utils.GSON |
|
|
|
import io.legado.app.utils.getViewModel |
|
|
|
import io.legado.app.utils.getViewModel |
|
|
@ -147,67 +147,243 @@ class SourceEditActivity : |
|
|
|
with(bookSource) { |
|
|
|
with(bookSource) { |
|
|
|
sourceEntities.clear() |
|
|
|
sourceEntities.clear() |
|
|
|
sourceEntities |
|
|
|
sourceEntities |
|
|
|
.add(EditEntity("bookSourceUrl", this?.bookSourceUrl, R.string.book_source_url)) |
|
|
|
.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"bookSourceUrl", |
|
|
|
|
|
|
|
this?.bookSourceUrl, |
|
|
|
|
|
|
|
R.string.book_source_url |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
sourceEntities |
|
|
|
sourceEntities |
|
|
|
.add(EditEntity("bookSourceName", this?.bookSourceName, R.string.book_source_name)) |
|
|
|
.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"bookSourceName", |
|
|
|
|
|
|
|
this?.bookSourceName, |
|
|
|
|
|
|
|
R.string.book_source_name |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
sourceEntities.add( |
|
|
|
sourceEntities.add( |
|
|
|
EditEntity("bookSourceGroup", this?.bookSourceGroup, R.string.book_source_group) |
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"bookSourceGroup", |
|
|
|
|
|
|
|
this?.bookSourceGroup, |
|
|
|
|
|
|
|
R.string.book_source_group |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
sourceEntities |
|
|
|
sourceEntities |
|
|
|
.add(EditEntity("loginUrl", this?.loginUrl, R.string.book_source_login_url)) |
|
|
|
.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"loginUrl", |
|
|
|
|
|
|
|
this?.loginUrl, |
|
|
|
|
|
|
|
R.string.book_source_login_url |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
sourceEntities |
|
|
|
sourceEntities |
|
|
|
.add(EditEntity("bookUrlPattern", this?.bookUrlPattern, R.string.book_url_pattern)) |
|
|
|
.add( |
|
|
|
sourceEntities.add(EditEntity("header", this?.header, R.string.source_http_header)) |
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"bookUrlPattern", |
|
|
|
|
|
|
|
this?.bookUrlPattern, |
|
|
|
|
|
|
|
R.string.book_url_pattern |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
sourceEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"header", |
|
|
|
|
|
|
|
this?.header, |
|
|
|
|
|
|
|
R.string.source_http_header |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
//搜索 |
|
|
|
//搜索 |
|
|
|
with(bookSource?.getSearchRule()) { |
|
|
|
with(bookSource?.getSearchRule()) { |
|
|
|
searchEntities.clear() |
|
|
|
searchEntities.clear() |
|
|
|
searchEntities |
|
|
|
searchEntities |
|
|
|
.add(EditEntity("searchUrl", bookSource?.searchUrl, R.string.rule_search_url)) |
|
|
|
.add( |
|
|
|
searchEntities.add(EditEntity("bookList", this?.bookList, R.string.rule_book_list)) |
|
|
|
EditEntity( |
|
|
|
searchEntities.add(EditEntity("name", this?.name, R.string.rule_book_name)) |
|
|
|
"searchUrl", |
|
|
|
searchEntities.add(EditEntity("author", this?.author, R.string.rule_book_author)) |
|
|
|
bookSource?.searchUrl, |
|
|
|
searchEntities.add(EditEntity("kind", this?.kind, R.string.rule_book_kind)) |
|
|
|
R.string.rule_search_url |
|
|
|
searchEntities.add(EditEntity("wordCount", this?.wordCount, R.string.rule_word_count)) |
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
searchEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"bookList", |
|
|
|
|
|
|
|
this?.bookList, |
|
|
|
|
|
|
|
R.string.rule_book_list |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
searchEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"name", |
|
|
|
|
|
|
|
this?.name, |
|
|
|
|
|
|
|
R.string.rule_book_name |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
searchEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"author", |
|
|
|
|
|
|
|
this?.author, |
|
|
|
|
|
|
|
R.string.rule_book_author |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
searchEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"kind", |
|
|
|
|
|
|
|
this?.kind, |
|
|
|
|
|
|
|
R.string.rule_book_kind |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
searchEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"wordCount", |
|
|
|
|
|
|
|
this?.wordCount, |
|
|
|
|
|
|
|
R.string.rule_word_count |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
searchEntities |
|
|
|
searchEntities |
|
|
|
.add(EditEntity("lastChapter", this?.lastChapter, R.string.rule_last_chapter)) |
|
|
|
.add( |
|
|
|
searchEntities.add(EditEntity("intro", this?.intro, R.string.rule_book_intro)) |
|
|
|
EditEntity( |
|
|
|
searchEntities.add(EditEntity("coverUrl", this?.coverUrl, R.string.rule_cover_url)) |
|
|
|
"lastChapter", |
|
|
|
searchEntities.add(EditEntity("bookUrl", this?.bookUrl, R.string.rule_book_url)) |
|
|
|
this?.lastChapter, |
|
|
|
|
|
|
|
R.string.rule_last_chapter |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
searchEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"intro", |
|
|
|
|
|
|
|
this?.intro, |
|
|
|
|
|
|
|
R.string.rule_book_intro |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
searchEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"coverUrl", |
|
|
|
|
|
|
|
this?.coverUrl, |
|
|
|
|
|
|
|
R.string.rule_cover_url |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
searchEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"bookUrl", |
|
|
|
|
|
|
|
this?.bookUrl, |
|
|
|
|
|
|
|
R.string.rule_book_url |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
//详情页 |
|
|
|
//详情页 |
|
|
|
with(bookSource?.getBookInfoRule()) { |
|
|
|
with(bookSource?.getBookInfoRule()) { |
|
|
|
infoEntities.clear() |
|
|
|
infoEntities.clear() |
|
|
|
infoEntities.add(EditEntity("init", this?.init, R.string.rule_book_info_init)) |
|
|
|
|
|
|
|
infoEntities.add(EditEntity("name", this?.name, R.string.rule_book_name)) |
|
|
|
|
|
|
|
infoEntities.add(EditEntity("author", this?.author, R.string.rule_book_author)) |
|
|
|
|
|
|
|
infoEntities.add(EditEntity("coverUrl", this?.coverUrl, R.string.rule_cover_url)) |
|
|
|
|
|
|
|
infoEntities.add(EditEntity("intro", this?.intro, R.string.rule_book_intro)) |
|
|
|
|
|
|
|
infoEntities.add(EditEntity("kind", this?.kind, R.string.rule_book_kind)) |
|
|
|
|
|
|
|
infoEntities.add(EditEntity("wordCount", this?.wordCount, R.string.rule_word_count)) |
|
|
|
|
|
|
|
infoEntities.add( |
|
|
|
infoEntities.add( |
|
|
|
EditEntity("lastChapter", this?.lastChapter, R.string.rule_last_chapter) |
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"init", |
|
|
|
|
|
|
|
this?.init, |
|
|
|
|
|
|
|
R.string.rule_book_info_init |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
infoEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"name", |
|
|
|
|
|
|
|
this?.name, |
|
|
|
|
|
|
|
R.string.rule_book_name |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
infoEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"author", |
|
|
|
|
|
|
|
this?.author, |
|
|
|
|
|
|
|
R.string.rule_book_author |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
infoEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"coverUrl", |
|
|
|
|
|
|
|
this?.coverUrl, |
|
|
|
|
|
|
|
R.string.rule_cover_url |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
infoEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"intro", |
|
|
|
|
|
|
|
this?.intro, |
|
|
|
|
|
|
|
R.string.rule_book_intro |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
infoEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"kind", |
|
|
|
|
|
|
|
this?.kind, |
|
|
|
|
|
|
|
R.string.rule_book_kind |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
infoEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"wordCount", |
|
|
|
|
|
|
|
this?.wordCount, |
|
|
|
|
|
|
|
R.string.rule_word_count |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
infoEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"lastChapter", |
|
|
|
|
|
|
|
this?.lastChapter, |
|
|
|
|
|
|
|
R.string.rule_last_chapter |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
infoEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"tocUrl", |
|
|
|
|
|
|
|
this?.tocUrl, |
|
|
|
|
|
|
|
R.string.rule_toc_url |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
infoEntities.add(EditEntity("tocUrl", this?.tocUrl, R.string.rule_toc_url)) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//目录页 |
|
|
|
//目录页 |
|
|
|
with(bookSource?.getTocRule()) { |
|
|
|
with(bookSource?.getTocRule()) { |
|
|
|
tocEntities.clear() |
|
|
|
tocEntities.clear() |
|
|
|
tocEntities.add( |
|
|
|
tocEntities.add( |
|
|
|
EditEntity("chapterList", this?.chapterList, R.string.rule_chapter_list) |
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"chapterList", |
|
|
|
|
|
|
|
this?.chapterList, |
|
|
|
|
|
|
|
R.string.rule_chapter_list |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
tocEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"chapterName", |
|
|
|
|
|
|
|
this?.chapterName, |
|
|
|
|
|
|
|
R.string.rule_chapter_name |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
tocEntities.add( |
|
|
|
tocEntities.add( |
|
|
|
EditEntity("chapterName", this?.chapterName, R.string.rule_chapter_name) |
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"chapterUrl", |
|
|
|
|
|
|
|
this?.chapterUrl, |
|
|
|
|
|
|
|
R.string.rule_chapter_url |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
tocEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"nextTocUrl", |
|
|
|
|
|
|
|
this?.nextTocUrl, |
|
|
|
|
|
|
|
R.string.rule_next_toc_url |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
tocEntities.add(EditEntity("chapterUrl", this?.chapterUrl, R.string.rule_chapter_url)) |
|
|
|
|
|
|
|
tocEntities.add(EditEntity("nextTocUrl", this?.nextTocUrl, R.string.rule_next_toc_url)) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//正文页 |
|
|
|
//正文页 |
|
|
|
with(bookSource?.getContentRule()) { |
|
|
|
with(bookSource?.getContentRule()) { |
|
|
|
contentEntities.clear() |
|
|
|
contentEntities.clear() |
|
|
|
contentEntities.add(EditEntity("content", this?.content, R.string.rule_book_content)) |
|
|
|
|
|
|
|
contentEntities.add( |
|
|
|
contentEntities.add( |
|
|
|
EditEntity("nextContentUrl", this?.nextContentUrl, R.string.rule_content_url_next) |
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"content", |
|
|
|
|
|
|
|
this?.content, |
|
|
|
|
|
|
|
R.string.rule_book_content |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
contentEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"nextContentUrl", |
|
|
|
|
|
|
|
this?.nextContentUrl, |
|
|
|
|
|
|
|
R.string.rule_content_url_next |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -215,19 +391,75 @@ class SourceEditActivity : |
|
|
|
with(bookSource?.getExploreRule()) { |
|
|
|
with(bookSource?.getExploreRule()) { |
|
|
|
findEntities.clear() |
|
|
|
findEntities.clear() |
|
|
|
findEntities.add( |
|
|
|
findEntities.add( |
|
|
|
EditEntity("exploreUrl", bookSource?.exploreUrl, R.string.rule_find_url) |
|
|
|
EditEntity( |
|
|
|
) |
|
|
|
"exploreUrl", |
|
|
|
findEntities.add(EditEntity("bookList", this?.bookList, R.string.rule_book_list)) |
|
|
|
bookSource?.exploreUrl, |
|
|
|
findEntities.add(EditEntity("name", this?.name, R.string.rule_book_name)) |
|
|
|
R.string.rule_find_url |
|
|
|
findEntities.add(EditEntity("author", this?.author, R.string.rule_book_author)) |
|
|
|
) |
|
|
|
findEntities.add(EditEntity("kind", this?.kind, R.string.rule_book_kind)) |
|
|
|
) |
|
|
|
findEntities.add(EditEntity("wordCount", this?.wordCount, R.string.rule_word_count)) |
|
|
|
findEntities.add( |
|
|
|
findEntities.add(EditEntity("intro", this?.intro, R.string.rule_book_intro)) |
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"bookList", |
|
|
|
|
|
|
|
this?.bookList, |
|
|
|
|
|
|
|
R.string.rule_book_list |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
findEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"name", |
|
|
|
|
|
|
|
this?.name, |
|
|
|
|
|
|
|
R.string.rule_book_name |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
findEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"author", |
|
|
|
|
|
|
|
this?.author, |
|
|
|
|
|
|
|
R.string.rule_book_author |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
findEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"kind", |
|
|
|
|
|
|
|
this?.kind, |
|
|
|
|
|
|
|
R.string.rule_book_kind |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
findEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"wordCount", |
|
|
|
|
|
|
|
this?.wordCount, |
|
|
|
|
|
|
|
R.string.rule_word_count |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
findEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"intro", |
|
|
|
|
|
|
|
this?.intro, |
|
|
|
|
|
|
|
R.string.rule_book_intro |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
findEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"lastChapter", |
|
|
|
|
|
|
|
this?.lastChapter, |
|
|
|
|
|
|
|
R.string.rule_last_chapter |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
findEntities.add( |
|
|
|
|
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"coverUrl", |
|
|
|
|
|
|
|
this?.coverUrl, |
|
|
|
|
|
|
|
R.string.rule_cover_url |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
findEntities.add( |
|
|
|
findEntities.add( |
|
|
|
EditEntity("lastChapter", this?.lastChapter, R.string.rule_last_chapter) |
|
|
|
EditEntity( |
|
|
|
|
|
|
|
"bookUrl", |
|
|
|
|
|
|
|
this?.bookUrl, |
|
|
|
|
|
|
|
R.string.rule_book_url |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
findEntities.add(EditEntity("coverUrl", this?.coverUrl, R.string.rule_cover_url)) |
|
|
|
|
|
|
|
findEntities.add(EditEntity("bookUrl", this?.bookUrl, R.string.rule_book_url)) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
setEditEntities(0) |
|
|
|
setEditEntities(0) |
|
|
|
} |
|
|
|
} |