Merge branch 'master' into master
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -528,8 +528,10 @@ class AnalyzeUrl(
|
|||||||
val domain = NetworkUtils.getSubDomain(tag ?: url)
|
val domain = NetworkUtils.getSubDomain(tag ?: url)
|
||||||
//书源启用保存cookie时 添加内存中的cookie到数据库
|
//书源启用保存cookie时 添加内存中的cookie到数据库
|
||||||
if (enabledCookieJar) {
|
if (enabledCookieJar) {
|
||||||
CacheManager.getFromMemory("${domain}_cookieJar")?.let {
|
val key = "${domain}_cookieJar"
|
||||||
|
CacheManager.getFromMemory(key)?.let {
|
||||||
CookieStore.replaceCookie(domain, it)
|
CookieStore.replaceCookie(domain, it)
|
||||||
|
CacheManager.deleteMemory(key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val cookie = CookieStore.getCookie(domain)
|
val cookie = CookieStore.getCookie(domain)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
upCoverByRule(book)
|
upCoverByRule(book)
|
||||||
bookSource = if (book.isLocalBook()) null else
|
bookSource = if (book.isLocalBook()) null else
|
||||||
appDb.bookSourceDao.getBookSource(book.origin)
|
appDb.bookSourceDao.getBookSource(book.origin)
|
||||||
isImportBookOnLine = bookSource?.bookSourceType ?: BookType.local == BookType.file
|
isImportBookOnLine = (bookSource?.bookSourceType ?: BookType.local) == BookType.file
|
||||||
if (book.tocUrl.isEmpty()) {
|
if (book.tocUrl.isEmpty()) {
|
||||||
loadBookInfo(book)
|
loadBookInfo(book)
|
||||||
} else if (!isImportBookOnLine) {
|
} else if (!isImportBookOnLine) {
|
||||||
@@ -111,7 +111,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
execute(scope) {
|
execute(scope) {
|
||||||
if (book.isLocalBook()) {
|
if (book.isLocalBook()) {
|
||||||
loadChapter(book, scope)
|
loadChapter(book, scope)
|
||||||
} else {
|
} else if (!isImportBookOnLine) {
|
||||||
bookSource?.let { bookSource ->
|
bookSource?.let { bookSource ->
|
||||||
WebBook.getBookInfo(this, bookSource, book, canReName = canReName)
|
WebBook.getBookInfo(this, bookSource, book, canReName = canReName)
|
||||||
.onSuccess(IO) {
|
.onSuccess(IO) {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import io.legado.app.utils.*
|
|||||||
import kotlinx.coroutines.Dispatchers.Main
|
import kotlinx.coroutines.Dispatchers.Main
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
|
import kotlin.collections.set
|
||||||
|
|
||||||
class BackupConfigFragment : PreferenceFragment(),
|
class BackupConfigFragment : PreferenceFragment(),
|
||||||
SharedPreferences.OnSharedPreferenceChangeListener {
|
SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
@@ -209,7 +210,9 @@ class BackupConfigFragment : PreferenceFragment(),
|
|||||||
return super.onPreferenceTreeClick(preference)
|
return super.onPreferenceTreeClick(preference)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备份忽略设置
|
||||||
|
*/
|
||||||
private fun backupIgnore() {
|
private fun backupIgnore() {
|
||||||
val checkedItems = BooleanArray(BackupConfig.ignoreKeys.size) {
|
val checkedItems = BooleanArray(BackupConfig.ignoreKeys.size) {
|
||||||
BackupConfig.ignoreConfig[BackupConfig.ignoreKeys[it]] ?: false
|
BackupConfig.ignoreConfig[BackupConfig.ignoreKeys[it]] ?: false
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.content.SharedPreferences
|
|||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.core.view.postDelayed
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
@@ -131,9 +132,9 @@ class OtherConfigFragment : PreferenceFragment(),
|
|||||||
setProcessTextEnable(it.getBoolean(key, true))
|
setProcessTextEnable(it.getBoolean(key, true))
|
||||||
}
|
}
|
||||||
PreferKey.showDiscovery, PreferKey.showRss -> postEvent(EventBus.NOTIFY_MAIN, true)
|
PreferKey.showDiscovery, PreferKey.showRss -> postEvent(EventBus.NOTIFY_MAIN, true)
|
||||||
PreferKey.language -> listView.postDelayed({
|
PreferKey.language -> listView.postDelayed(1000) {
|
||||||
appCtx.restart()
|
appCtx.restart()
|
||||||
}, 1000)
|
}
|
||||||
PreferKey.userAgent -> listView.post {
|
PreferKey.userAgent -> listView.post {
|
||||||
upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent)
|
upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.view.KeyEvent
|
|||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
|
import androidx.core.view.postDelayed
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter
|
import androidx.fragment.app.FragmentStatePagerAdapter
|
||||||
@@ -87,13 +88,13 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
|||||||
upVersion()
|
upVersion()
|
||||||
//自动更新书籍
|
//自动更新书籍
|
||||||
if (AppConfig.autoRefreshBook) {
|
if (AppConfig.autoRefreshBook) {
|
||||||
binding.viewPagerMain.postDelayed({
|
binding.viewPagerMain.postDelayed(1000) {
|
||||||
viewModel.upAllBookToc()
|
viewModel.upAllBookToc()
|
||||||
}, 1000)
|
|
||||||
}
|
}
|
||||||
binding.viewPagerMain.postDelayed({
|
}
|
||||||
|
binding.viewPagerMain.postDelayed(3000) {
|
||||||
viewModel.postLoad()
|
viewModel.postLoad()
|
||||||
}, 3000)
|
}
|
||||||
launch {
|
launch {
|
||||||
val lastBackupFile = withContext(IO) { AppWebDav.lastBackUp().getOrNull() }
|
val lastBackupFile = withContext(IO) { AppWebDav.lastBackUp().getOrNull() }
|
||||||
?: return@launch
|
?: return@launch
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.legado.app.ui.welcome
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import androidx.core.view.postDelayed
|
||||||
import io.legado.app.base.BaseActivity
|
import io.legado.app.base.BaseActivity
|
||||||
import io.legado.app.constant.PreferKey
|
import io.legado.app.constant.PreferKey
|
||||||
import io.legado.app.constant.Theme
|
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) {
|
if (intent.flags and Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT != 0) {
|
||||||
finish()
|
finish()
|
||||||
} else {
|
} 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.View
|
||||||
import android.view.animation.LinearInterpolator
|
import android.view.animation.LinearInterpolator
|
||||||
import android.widget.Checkable
|
import android.widget.Checkable
|
||||||
|
import androidx.core.view.postDelayed
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.lib.theme.ThemeStore
|
import io.legado.app.lib.theme.ThemeStore
|
||||||
import io.legado.app.utils.dpToPx
|
import io.legado.app.utils.dpToPx
|
||||||
@@ -244,7 +245,7 @@ class SmoothCheckBox @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
// invalidate
|
// invalidate
|
||||||
if (mDrewDistance < mLeftLineDistance + mRightLineDistance) {
|
if (mDrewDistance < mLeftLineDistance + mRightLineDistance) {
|
||||||
postDelayed({ this.postInvalidate() }, 10)
|
postDelayed(10) { this.postInvalidate() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,10 +299,10 @@ class SmoothCheckBox @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun drawTickDelayed() {
|
private fun drawTickDelayed() {
|
||||||
postDelayed({
|
postDelayed(mAnimDuration.toLong()) {
|
||||||
mTickDrawing = true
|
mTickDrawing = true
|
||||||
postInvalidate()
|
postInvalidate()
|
||||||
}, mAnimDuration.toLong())
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.legado.app.utils
|
package io.legado.app.utils
|
||||||
|
|
||||||
|
import androidx.core.os.postDelayed
|
||||||
import io.legado.app.exception.RegexTimeoutException
|
import io.legado.app.exception.RegexTimeoutException
|
||||||
import io.legado.app.help.CrashHandler
|
import io.legado.app.help.CrashHandler
|
||||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||||
@@ -23,20 +24,20 @@ suspend fun CharSequence.replace(regex: Regex, replacement: String, timeout: Lon
|
|||||||
block.resumeWithException(e)
|
block.resumeWithException(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mainHandler.postDelayed({
|
mainHandler.postDelayed(timeout) {
|
||||||
if (thread.isAlive) {
|
if (thread.isAlive) {
|
||||||
val timeoutMsg = "替换超时,3秒后还未结束将重启应用\n替换规则$regex\n替换内容:${this}"
|
val timeoutMsg = "替换超时,3秒后还未结束将重启应用\n替换规则$regex\n替换内容:${this}"
|
||||||
val exception = RegexTimeoutException(timeoutMsg)
|
val exception = RegexTimeoutException(timeoutMsg)
|
||||||
block.cancel(exception)
|
block.cancel(exception)
|
||||||
appCtx.longToastOnUi(timeoutMsg)
|
appCtx.longToastOnUi(timeoutMsg)
|
||||||
CrashHandler.saveCrashInfo2File(exception)
|
CrashHandler.saveCrashInfo2File(exception)
|
||||||
mainHandler.postDelayed({
|
mainHandler.postDelayed(3000) {
|
||||||
if (thread.isAlive) {
|
if (thread.isAlive) {
|
||||||
appCtx.restart()
|
appCtx.restart()
|
||||||
}
|
}
|
||||||
}, 3000)
|
|
||||||
}
|
}
|
||||||
}, timeout)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user