优化
This commit is contained in:
@@ -146,7 +146,9 @@ class ContentProcessor private constructor(
|
|||||||
effectiveReplaceRules = arrayListOf()
|
effectiveReplaceRules = arrayListOf()
|
||||||
mContent = mContent.lines().joinToString("\n") { it.trim() }
|
mContent = mContent.lines().joinToString("\n") { it.trim() }
|
||||||
getContentReplaceRules().forEach { item ->
|
getContentReplaceRules().forEach { item ->
|
||||||
if (item.pattern.isNotEmpty()) {
|
if (item.pattern.isEmpty()) {
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
val tmp = if (item.isRegex) {
|
val tmp = if (item.isRegex) {
|
||||||
mContent.replace(
|
mContent.replace(
|
||||||
@@ -173,7 +175,6 @@ class ContentProcessor private constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (includeTitle) {
|
if (includeTitle) {
|
||||||
//重新添加标题
|
//重新添加标题
|
||||||
mContent = chapter.getDisplayTitle(
|
mContent = chapter.getDisplayTitle(
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ object Restore {
|
|||||||
if (!BuildConfig.DEBUG) {
|
if (!BuildConfig.DEBUG) {
|
||||||
LauncherIconHelp.changeIcon(appCtx.getPrefString(PreferKey.launcherIcon))
|
LauncherIconHelp.changeIcon(appCtx.getPrefString(PreferKey.launcherIcon))
|
||||||
}
|
}
|
||||||
|
ThemeConfig.applyDayNight(appCtx)
|
||||||
postEvent(EventBus.RECREATE, "")
|
postEvent(EventBus.RECREATE, "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ class PermissionActivity : AppCompatActivity() {
|
|||||||
Request.TYPE_MANAGE_ALL_FILES_ACCESS -> showSettingDialog(permissions, rationale) {
|
Request.TYPE_MANAGE_ALL_FILES_ACCESS -> showSettingDialog(permissions, rationale) {
|
||||||
try {
|
try {
|
||||||
if (Permissions.isManageExternalStorage()) {
|
if (Permissions.isManageExternalStorage()) {
|
||||||
val settingIntent = Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)
|
val settingIntent =
|
||||||
|
Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)
|
||||||
settingActivityResult.launch(settingIntent)
|
settingActivityResult.launch(settingIntent)
|
||||||
} else {
|
} else {
|
||||||
throw NoStackTraceException("no MANAGE_ALL_FILES_ACCESS_PERMISSION")
|
throw NoStackTraceException("no MANAGE_ALL_FILES_ACCESS_PERMISSION")
|
||||||
@@ -53,6 +54,7 @@ class PermissionActivity : AppCompatActivity() {
|
|||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Request.TYPE_REQUEST_NOTIFICATIONS -> showSettingDialog(permissions, rationale) {
|
Request.TYPE_REQUEST_NOTIFICATIONS -> showSettingDialog(permissions, rationale) {
|
||||||
kotlin.runCatching {
|
kotlin.runCatching {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
@@ -135,6 +137,10 @@ class PermissionActivity : AppCompatActivity() {
|
|||||||
)
|
)
|
||||||
finish()
|
finish()
|
||||||
}.setOnCancelListener {
|
}.setOnCancelListener {
|
||||||
|
RequestPlugins.sRequestCallback?.onRequestPermissionsResult(
|
||||||
|
permissions,
|
||||||
|
IntArray(0)
|
||||||
|
)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.legado.app.lib.permission
|
package io.legado.app.lib.permission
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
@@ -49,6 +50,7 @@ internal class Request : OnRequestPermissionsResultCallback {
|
|||||||
this.rationale = rationale
|
this.rationale = rationale
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ObsoleteSdkInt")
|
||||||
fun start() {
|
fun start() {
|
||||||
RequestPlugins.setOnRequestPermissionsCallback(this)
|
RequestPlugins.setOnRequestPermissionsCallback(this)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user