Merge branch 'master' into master

pull/1879/head
Xwite 3 years ago committed by GitHub
commit a3e3901ccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1654
      app/schemas/io.legado.app.data.AppDatabase/49.json
  2. 4
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt
  3. 4
      app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt
  4. 5
      app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
  5. 5
      app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt
  6. 9
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt
  7. 3
      app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt
  8. 7
      app/src/main/java/io/legado/app/ui/widget/checkbox/SmoothCheckBox.kt
  9. 9
      app/src/main/java/io/legado/app/utils/RegexExtensions.kt

File diff suppressed because it is too large Load Diff

@ -528,8 +528,10 @@ class AnalyzeUrl(
val domain = NetworkUtils.getSubDomain(tag ?: url)
//书源启用保存cookie时 添加内存中的cookie到数据库
if (enabledCookieJar) {
CacheManager.getFromMemory("${domain}_cookieJar")?.let {
val key = "${domain}_cookieJar"
CacheManager.getFromMemory(key)?.let {
CookieStore.replaceCookie(domain, it)
CacheManager.deleteMemory(key)
}
}
val cookie = CookieStore.getCookie(domain)

@ -75,7 +75,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
upCoverByRule(book)
bookSource = if (book.isLocalBook()) null else
appDb.bookSourceDao.getBookSource(book.origin)
isImportBookOnLine = bookSource?.bookSourceType ?: BookType.local == BookType.file
isImportBookOnLine = (bookSource?.bookSourceType ?: BookType.local) == BookType.file
if (book.tocUrl.isEmpty()) {
loadBookInfo(book)
} else if (!isImportBookOnLine) {
@ -111,7 +111,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
execute(scope) {
if (book.isLocalBook()) {
loadChapter(book, scope)
} else {
} else if (!isImportBookOnLine) {
bookSource?.let { bookSource ->
WebBook.getBookInfo(this, bookSource, book, canReName = canReName)
.onSuccess(IO) {

@ -32,6 +32,7 @@ import io.legado.app.utils.*
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.launch
import splitties.init.appCtx
import kotlin.collections.set
class BackupConfigFragment : PreferenceFragment(),
SharedPreferences.OnSharedPreferenceChangeListener {
@ -209,7 +210,9 @@ class BackupConfigFragment : PreferenceFragment(),
return super.onPreferenceTreeClick(preference)
}
/**
* 备份忽略设置
*/
private fun backupIgnore() {
val checkedItems = BooleanArray(BackupConfig.ignoreKeys.size) {
BackupConfig.ignoreConfig[BackupConfig.ignoreKeys[it]] ?: false

@ -6,6 +6,7 @@ import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.os.Bundle
import android.view.View
import androidx.core.view.postDelayed
import androidx.fragment.app.activityViewModels
import androidx.preference.ListPreference
import androidx.preference.Preference
@ -131,9 +132,9 @@ class OtherConfigFragment : PreferenceFragment(),
setProcessTextEnable(it.getBoolean(key, true))
}
PreferKey.showDiscovery, PreferKey.showRss -> postEvent(EventBus.NOTIFY_MAIN, true)
PreferKey.language -> listView.postDelayed({
PreferKey.language -> listView.postDelayed(1000) {
appCtx.restart()
}, 1000)
}
PreferKey.userAgent -> listView.post {
upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent)
}

@ -8,6 +8,7 @@ import android.view.KeyEvent
import android.view.MenuItem
import android.view.ViewGroup
import androidx.activity.viewModels
import androidx.core.view.postDelayed
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
@ -87,13 +88,13 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
upVersion()
//自动更新书籍
if (AppConfig.autoRefreshBook) {
binding.viewPagerMain.postDelayed({
binding.viewPagerMain.postDelayed(1000) {
viewModel.upAllBookToc()
}, 1000)
}
binding.viewPagerMain.postDelayed({
}
binding.viewPagerMain.postDelayed(3000) {
viewModel.postLoad()
}, 3000)
}
launch {
val lastBackupFile = withContext(IO) { AppWebDav.lastBackUp().getOrNull() }
?: return@launch

@ -3,6 +3,7 @@ package io.legado.app.ui.welcome
import android.content.Intent
import android.graphics.drawable.BitmapDrawable
import android.os.Bundle
import androidx.core.view.postDelayed
import io.legado.app.base.BaseActivity
import io.legado.app.constant.PreferKey
import io.legado.app.constant.Theme
@ -26,7 +27,7 @@ open class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {
if (intent.flags and Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT != 0) {
finish()
} else {
binding.root.postDelayed({ startMainActivity() }, 600)
binding.root.postDelayed(600) { startMainActivity() }
}
}

@ -7,6 +7,7 @@ import android.util.AttributeSet
import android.view.View
import android.view.animation.LinearInterpolator
import android.widget.Checkable
import androidx.core.view.postDelayed
import io.legado.app.R
import io.legado.app.lib.theme.ThemeStore
import io.legado.app.utils.dpToPx
@ -244,7 +245,7 @@ class SmoothCheckBox @JvmOverloads constructor(
}
// invalidate
if (mDrewDistance < mLeftLineDistance + mRightLineDistance) {
postDelayed({ this.postInvalidate() }, 10)
postDelayed(10) { this.postInvalidate() }
}
}
@ -298,10 +299,10 @@ class SmoothCheckBox @JvmOverloads constructor(
}
private fun drawTickDelayed() {
postDelayed({
postDelayed(mAnimDuration.toLong()) {
mTickDrawing = true
postInvalidate()
}, mAnimDuration.toLong())
}
}
companion object {

@ -1,5 +1,6 @@
package io.legado.app.utils
import androidx.core.os.postDelayed
import io.legado.app.exception.RegexTimeoutException
import io.legado.app.help.CrashHandler
import kotlinx.coroutines.suspendCancellableCoroutine
@ -23,20 +24,20 @@ suspend fun CharSequence.replace(regex: Regex, replacement: String, timeout: Lon
block.resumeWithException(e)
}
}
mainHandler.postDelayed({
mainHandler.postDelayed(timeout) {
if (thread.isAlive) {
val timeoutMsg = "替换超时,3秒后还未结束将重启应用\n替换规则$regex\n替换内容:${this}"
val exception = RegexTimeoutException(timeoutMsg)
block.cancel(exception)
appCtx.longToastOnUi(timeoutMsg)
CrashHandler.saveCrashInfo2File(exception)
mainHandler.postDelayed({
mainHandler.postDelayed(3000) {
if (thread.isAlive) {
appCtx.restart()
}
}, 3000)
}
}, timeout)
}
}
}
}

Loading…
Cancel
Save