pull/1119/head
gedoor 3 years ago
parent 58b94c26ce
commit 6e2b264536
  1. 10
      app/src/main/java/io/legado/app/data/entities/BookSource.kt
  2. 14
      app/src/main/java/io/legado/app/help/LifecycleHelp.kt
  3. 2
      app/src/main/java/io/legado/app/service/CheckSourceService.kt
  4. 2
      app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt
  5. 104
      app/src/main/res/values-es-rES/strings.xml

@ -11,6 +11,7 @@ import io.legado.app.help.CacheManager
import io.legado.app.help.JsExtensions
import io.legado.app.help.http.CookieStore
import io.legado.app.utils.*
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
import splitties.init.appCtx
import javax.script.SimpleBindings
@ -97,8 +98,11 @@ data class BookSource(
}
}
fun getExploreKinds(): List<ExploreKind> {
val exploreUrl = exploreUrl ?: return emptyList()
@delegate:Transient
@delegate:Ignore
@IgnoredOnParcel
val exploreKinds by lazy {
val exploreUrl = exploreUrl ?: return@lazy emptyList()
val kinds = arrayListOf<ExploreKind>()
var ruleStr = exploreUrl
if (ruleStr.isNotBlank()) {
@ -138,7 +142,7 @@ data class BookSource(
kinds.add(ExploreKind(it.localizedMessage ?: ""))
}
}
return kinds
return@lazy kinds
}
/**

@ -16,7 +16,7 @@ object LifecycleHelp : Application.ActivityLifecycleCallbacks {
private val activities: MutableList<WeakReference<Activity>> = arrayListOf()
private val services: MutableList<WeakReference<BaseService>> = arrayListOf()
private var finishedListener: (() -> Unit)? = null
private var appFinishedListener: (() -> Unit)? = null
fun activitySize(): Int {
return activities.size
@ -52,8 +52,8 @@ object LifecycleHelp : Application.ActivityLifecycleCallbacks {
}
}
fun setOnFinishedListener(finishedListener: (() -> Unit)) {
this.finishedListener = finishedListener
fun setOnAppFinishedListener(appFinishedListener: (() -> Unit)) {
this.appFinishedListener = appFinishedListener
}
override fun onActivityPaused(activity: Activity) {
@ -71,7 +71,7 @@ object LifecycleHelp : Application.ActivityLifecycleCallbacks {
if (temp.get() != null && temp.get() === activity) {
activities.remove(temp)
if (services.size == 0 && activities.size == 0) {
onFinished()
onAppFinished()
}
break
}
@ -102,14 +102,14 @@ object LifecycleHelp : Application.ActivityLifecycleCallbacks {
if (temp.get() != null && temp.get() === service) {
services.remove(temp)
if (services.size == 0 && activities.size == 0) {
onFinished()
onAppFinished()
}
break
}
}
}
private fun onFinished() {
finishedListener?.invoke()
private fun onAppFinished() {
appFinishedListener?.invoke()
}
}

@ -109,7 +109,7 @@ class CheckSourceService : BaseService() {
val webBook = WebBook(source)
var books = webBook.searchBookAwait(this, CheckSource.keyword)
if (books.isEmpty()) {
val exs = source.getExploreKinds()
val exs = source.exploreKinds
if (exs.isEmpty()) {
throw Exception("搜索内容为空并且没有发现")
}

@ -58,7 +58,7 @@ class ExploreAdapter(context: Context, private val scope: CoroutineScope, val ca
callBack.scrollTo(scrollTo)
}
Coroutine.async(scope) {
item.getExploreKinds()
item.exploreKinds
}.onSuccess { kindList ->
upKindList(flexbox, item.bookSourceUrl, kindList)
}.onFinally {

@ -116,7 +116,7 @@
<string name="cancel">Cancelar</string>
<string name="backup_confirmation">Confirmar respaldo</string>
<string name="backup_message">Los nuevos archivos de respaldo serán reemplazados con los anteriores.\n Carpeta de respaldo: YueDu</string>
<string name="restore_confirmation">Confirmar restauración<string>
<string name="restore_confirmation">Confirmar restauración</string>
<string name="restore_message">La restauración de los datos de la estantería reemplazará a los datos de la actual.</string>
<string name="backup_success">Respaldo completado</string>
<string name="backup_fail">Error de respaldo</string>
@ -356,7 +356,7 @@
<string name="go_to_top">Ir al principio</string>
<string name="go_to_bottom">Ir al final</string>
<string name="read_y">Leído: %s</string>
<string name="seek_more">Preparando actualización</string>
<string name="pursue_more">Awaiting update</string>
<string name="fattening">Preparando un poco más</string>
<string name="finish">Listo</string>
<string name="all_book">Todo</string>
@ -557,8 +557,8 @@
<string name="reading">Lecturas</string>
<string name="battery_show">%d%%</string>
<string name="timer_m">%d min</string>
<string name="shine_auto">Brillo automático %s</string>
<string name="read_aloud_by_page">Leer por páginas</string>
<string name="brightness_auto">Auto-Brightness %s</string>
<string name="speak_engine">Motor de voz</string>
<string name="bg_image">Imágenes de fondo</string>
<string name="bg_color">Color de fondo</string>
@ -628,25 +628,83 @@
<string name="service_stop">Servicio detenido</string>
<string name="service_start">Iniciando el servicio\nComprobando la barra de notificaciones para más detalles</string>
<string name="default_path">Carpeta predeterminada</string>
<string name="sys_folder_picker">Selector de carpetas del sistema</string>
<string name="app_folder_picker">Selector de carpetas de aplicaciones</string>
<string name="app_file_picker">Selector de archivos de la aplicación</string>
<string name="a10_permission_toast">En Android 10+ no puede leer ni guardar archivos debido a restricciones de permisos</string>
<string name="add_to_text_context_menu_s">Mantenga pulsado para mostrar Legado·Búsqueda en el menú de operaciones</string>
<string name="add_to_text_context_menu_t">Buscar en pantalla de operación de texto</string>
<string name="record_log">Registro</string>
<string name="log">Registro</string>
<string name="chinese_converter">Conversión a simplificada</string>
<string name="change_icon_error">El ícono es un ícono vectorial, que no era compatible antes de Android 8.0</string>
<!--color-->
<string name="primary">Primario</string>
<string name="accent">Resalte</string>
<string name="background_color">Color de fondo</string>
<string name="navbar_color">Color de la barra de navegación</string>
<string name="day">Día</string>
<string name="day_color_primary">Día, primario</string>
<string name="day_color_accent">Día, resalte</string>
<string name="day_background_color">Día, color de fondo</string>
<string name="sys_folder_picker">Selector de carpetas del sistema</string>
<string name="app_folder_picker">Selector de carpetas de aplicaciones</string>
<string name="app_file_picker">Selector de archivos de la aplicación</string>
<string name="a10_permission_toast">En Android 10+ no puede leer ni guardar archivos debido a restricciones de permisos</string>
<string name="add_to_text_context_menu_s">Mantenga pulsado para mostrar Legado·Búsqueda en el menú de operaciones</string>
<string name="add_to_text_context_menu_t">Buscar en pantalla de operación de texto</string>
<string name="record_log">Registro</string>
<string name="log">Registro</string>
<string name="chinese_converter">Conversión a simplificada</string>
<string name="change_icon_error">El ícono es un ícono vectorial, que no era compatible antes de Android 8.0</string>
<string name="aloud_config">Speech settings</string>
<string name="main_activity">Start page</string>
<string name="selectText">Long Tap to select text</string>
<string name="header">Header</string>
<string name="main_body">Content</string>
<string name="footer">Footer</string>
<string name="select_end">Select end</string>
<string name="select_start">Select start</string>
<string name="share_layout">Shared layout</string>
<string name="browser">Browser</string>
<string name="import_default_rule">Import default rules</string>
<string name="name">Name</string>
<string name="regex">Regex</string>
<string name="more_menu">More menu</string>
<string name="reduce">Minus</string>
<string name="plus">Plus</string>
<string name="system_typeface">System typeface</string>
<string name="delete_book_file">Delete source file</string>
<string name="default1">Default-1</string>
<string name="default2">Default-2</string>
<string name="default3">Default-3</string>
<string name="title">Title</string>
<string name="title_left">Left</string>
<string name="title_center">Center</string>
<string name="title_hide">Hide</string>
<string name="add_to_group">Add to Group</string>
<string name="save_image">Save image</string>
<string name="no_default_path">No default path</string>
<string name="change_group">Group settings</string>
<string name="view_toc">View Chapters</string>
<string name="bar_elevation">Navigation bar shadow</string>
<string name="bar_elevation_s">Current shadow size(elevation): %s</string>
<string name="btn_default_s">Default</string>
<string name="main_menu">Main menu</string>
<string name="request_permission">Tap to grant permission</string>
<string name="tip_local_perm_request_storage">Legado needs Storage permission, please tap the "Grant Permission" button below, or go to "Settings"-"Application Permissions"-to open the required permission. If the permission is still not work, please tap "Select Folder" in the upper right corner to use the system folder picker.</string>
<string name="alouding_disable">The selected text cannot be spoken in full text speech</string>
<string name="read_body_to_lh">Extend to cutout</string>
<string name="toc_updateing">Updating Chapters</string>
<string name="media_button_on_exit_title">Headset buttons are always available</string>
<string name="media_button_on_exit_summary">Headset buttons are available even exit the app.</string>
<string name="contributors">Contributors</string>
<string name="contact">Contact</string>
<string name="license">License</string>
<string name="other">Other</string>
<string name="official_account">开源阅读</string>
<string name="follow_official_account">Follow WeChat Official Accounts</string>
<string name="wechat">WeChat</string>
<string name="thanks">Supporting me will be appreciated</string>
<string name="about_official_account">Official Accounts[开源阅读]</string>
<string name="source_auto_changing">Changing source</string>
<string name="click_to_apply">Tap to join</string>
<string name="middle">Middle</string>
<string name="information">Information</string>
<string name="switchLayout">Switch Layout</string>
<string name="text_font_weight_converter">Text font weight switching</string>
<string name="full_screen_gestures_support">Full screen gestures support</string>
<!--color-->
<string name="primary">Primario</string>
<string name="accent">Resalte</string>
<string name="background_color">Color de fondo</string>
<string name="navbar_color">Color de la barra de navegación</string>
<string name="day">Día</string>
<string name="day_color_primary">Día, primario</string>
<string name="day_color_accent">Día, resalte</string>
<string name="day_background_color">Día, color de fondo</string>
<string name="day_navbar_color">Día, color de la barra de navegación</string>
<string name="night">Noche</string>
<string name="night_primary">Noche, primario</string>
@ -663,7 +721,7 @@
<string name="import_old_summary">Seleccione una carpeta de respaldo heredada</string>
<string name="enabled">Activado</string>
<string name="disabled">Desactivado</string>
<string name="Starting_download">Iniciando descarga</string>
<string name="starting_download">Iniciando descarga</string>
<string name="already_in_download">Este libro ya está en la lista de descargas</string>
<string name="click_to_open">Haga clic para abrir</string>
<string name="follow_public_account_summary">Siga [开源阅读] para obtener ayuda haciendo clic en los anuncios</string>

Loading…
Cancel
Save