diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f4d3af897..5256b0ebc 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -138,8 +138,10 @@
android:launchMode="singleTop">
+
+
@@ -186,6 +188,8 @@
android:launchMode="singleTop" />
+
@@ -219,7 +227,6 @@
-
diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md
index cd31303d4..7ace22ee4 100644
--- a/app/src/main/assets/updateLog.md
+++ b/app/src/main/assets/updateLog.md
@@ -2,11 +2,19 @@
* 旧版数据导入教程:先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】。
* 请关注[开源阅读软件]()支持我,同时关注合作公众号[小说拾遗](),阅读公众号小编。
+**2020/03/06**
+* 添加隐藏标题
+* 行距段距改成倍距,根据字体大小变化
+* 修复翻页时右下角页数闪烁
+* 修复朗读错行
+* 添加底部分隔线,开关在边距设置里
+
**2020/03/05**
* 修复翻页动画
* 修复主题模式跟随
* 修复滚动翻页切换章节时跳动
* 适配阅读3.0的web做源
+* 本地目录规则网络导入
**2020/03/04**
* 修复仿真翻页动画
diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt
index b427f687b..1ba9ba6cf 100644
--- a/app/src/main/java/io/legado/app/constant/PreferKey.kt
+++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt
@@ -27,6 +27,7 @@ object PreferKey {
const val fontFolder = "fontFolder"
const val backupPath = "backupUri"
const val threadCount = "threadCount"
+ const val webPort = "webPort"
const val keepLight = "keep_light"
const val webService = "webService"
const val webDavUrl = "web_dav_url"
diff --git a/app/src/main/java/io/legado/app/data/dao/TxtTocRuleDao.kt b/app/src/main/java/io/legado/app/data/dao/TxtTocRuleDao.kt
index 5812b419c..1bd502a09 100644
--- a/app/src/main/java/io/legado/app/data/dao/TxtTocRuleDao.kt
+++ b/app/src/main/java/io/legado/app/data/dao/TxtTocRuleDao.kt
@@ -16,6 +16,9 @@ interface TxtTocRuleDao {
@get:Query("select * from txtTocRules where enable = 1 order by serialNumber")
val enabled: List
+ @get:Query("select ifNull(max(serialNumber), 0) from txtTocRules")
+ val lastOrderNum: Int
+
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insert(vararg rule: TxtTocRule)
diff --git a/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt b/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt
index 8744ce2cb..dc1364559 100644
--- a/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt
+++ b/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt
@@ -1,11 +1,14 @@
package io.legado.app.data.entities
import android.os.Parcelable
+import android.text.TextUtils
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
import kotlinx.android.parcel.Parcelize
+import java.util.regex.Pattern
+import java.util.regex.PatternSyntaxException
@Parcelize
@Entity(
@@ -37,4 +40,20 @@ data class ReplaceRule(
override fun hashCode(): Int {
return id.hashCode()
}
+
+ fun isValid(): Boolean{
+ if (TextUtils.isEmpty(pattern)){
+ return false;
+ }
+ //判断正则表达式是否正确
+ if (isRegex){
+ try {
+ Pattern.compile(pattern);
+ }
+ catch (ex: PatternSyntaxException){
+ return false;
+ }
+ }
+ return true;
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/io/legado/app/help/BlurTransformation.kt b/app/src/main/java/io/legado/app/help/BlurTransformation.kt
index fec7d0eef..4493228c4 100644
--- a/app/src/main/java/io/legado/app/help/BlurTransformation.kt
+++ b/app/src/main/java/io/legado/app/help/BlurTransformation.kt
@@ -8,10 +8,8 @@ import android.renderscript.Allocation
import android.renderscript.Element
import android.renderscript.RenderScript
import android.renderscript.ScriptIntrinsicBlur
-
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
-import com.bumptech.glide.load.resource.bitmap.BitmapTransformation
-
+import com.bumptech.glide.load.resource.bitmap.CenterCrop
import java.security.MessageDigest
import kotlin.math.min
import kotlin.math.roundToInt
@@ -21,15 +19,16 @@ import kotlin.math.roundToInt
* 模糊
* @radius: 0..25
*/
-class BlurTransformation(context: Context, private val radius: Int) : BitmapTransformation() {
+class BlurTransformation(context: Context, private val radius: Int) : CenterCrop() {
private val rs: RenderScript = RenderScript.create(context)
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
override fun transform(pool: BitmapPool, toTransform: Bitmap, outWidth: Int, outHeight: Int): Bitmap {
+ val transform = super.transform(pool, toTransform, outWidth, outHeight)
//图片缩小1/2
- val width = (min(outWidth, toTransform.width) / 2f).roundToInt()
- val height = (min(outHeight, toTransform.height) / 2f).roundToInt()
- val blurredBitmap = Bitmap.createScaledBitmap(toTransform, width, height, false);
+ val width = (min(outWidth, transform.width) / 2f).roundToInt()
+ val height = (min(outHeight, transform.height) / 2f).roundToInt()
+ val blurredBitmap = Bitmap.createScaledBitmap(transform, width, height, false);
// Allocate memory for Renderscript to work with
//分配用于渲染脚本的内存
val input = Allocation.createFromBitmap(
diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt
index dcef91c72..77dc45e9a 100644
--- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt
+++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt
@@ -165,10 +165,21 @@ object ReadBookConfig {
if (shareLayout) shareConfig.paragraphSpacing = value
else durConfig.paragraphSpacing = value
- var titleCenter: Boolean
- get() = if (shareLayout) shareConfig.titleCenter else durConfig.titleCenter
+ var titleMode: Int
+ get() = if (shareLayout) shareConfig.titleMode else durConfig.titleMode
set(value) =
- if (shareLayout) shareConfig.titleCenter = value else durConfig.titleCenter = value
+ if (shareLayout) shareConfig.titleMode = value else durConfig.titleMode = value
+
+ var titleTopSpacing: Int
+ get() = if (shareLayout) shareConfig.titleTopSpacing else durConfig.titleTopSpacing
+ set(value) =
+ if (shareLayout) shareConfig.titleTopSpacing = value
+ else durConfig.titleTopSpacing = value
+ var titleBottomSpacing: Int
+ get() = if (shareLayout) shareConfig.titleBottomSpacing else durConfig.titleBottomSpacing
+ set(value) =
+ if (shareLayout) shareConfig.titleBottomSpacing = value
+ else durConfig.titleBottomSpacing = value
var paddingBottom: Int
get() = if (shareLayout) shareConfig.paddingBottom else durConfig.paddingBottom
@@ -238,6 +249,12 @@ object ReadBookConfig {
if (shareLayout) shareConfig.footerPaddingTop = value
else durConfig.footerPaddingTop = value
+ var showFooterLine: Boolean
+ get() = if (shareLayout) shareConfig.showFooterLine else durConfig.showFooterLine
+ set(value) =
+ if (shareLayout) shareConfig.showFooterLine = value
+ else durConfig.showFooterLine = value
+
@Keep
class Config(
private var bgStr: String = "#EEEEEE",//白天背景
@@ -253,7 +270,9 @@ object ReadBookConfig {
var letterSpacing: Float = 0.5f,//字间距
var lineSpacingExtra: Int = 12,//行间距
var paragraphSpacing: Int = 12,//段距
- var titleCenter: Boolean = true,//标题居中
+ var titleMode: Int = 0,//标题居中
+ var titleTopSpacing: Int = 0,
+ var titleBottomSpacing: Int = 0,
var paddingBottom: Int = 6,
var paddingLeft: Int = 16,
var paddingRight: Int = 16,
@@ -265,7 +284,8 @@ object ReadBookConfig {
var footerPaddingBottom: Int = 6,
var footerPaddingLeft: Int = 16,
var footerPaddingRight: Int = 16,
- var footerPaddingTop: Int = 6
+ var footerPaddingTop: Int = 6,
+ var showFooterLine: Boolean = true
) {
fun setBg(bgType: Int, bg: String) {
if (AppConfig.isNightTheme) {
diff --git a/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt b/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt
index 8d0c9cd2c..4af39cbb2 100644
--- a/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt
+++ b/app/src/main/java/io/legado/app/help/storage/ImportOldData.kt
@@ -136,13 +136,17 @@ object ImportOldData {
return bookSources.size
}
+
+
fun importOldReplaceRule(json: String): Int {
val replaceRules = mutableListOf()
val items: List