Merge branch 'master' of https://github.com/gedoor/legado
	
		
	
				
					
				
			# Conflicts: # app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt # app/src/main/res/xml/pref_main.xmlpull/209/head
@ -1,4 +1,4 @@ | 
				
			|||||||
<resources> | 
					<resources> | 
				
			||||||
    <string name="app_name">阅读.debug</string> | 
					    <string name="app_name">阅读·D</string> | 
				
			||||||
    <string name="receiving_shared_label">阅读.debug·搜索</string> | 
					    <string name="receiving_shared_label">阅读·D·搜索</string> | 
				
			||||||
</resources> | 
					</resources> | 
				
			||||||
@ -0,0 +1,6 @@ | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||||
 | 
					<resources> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <string name="app_name">閱讀Pro</string> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</resources> | 
				
			||||||
@ -0,0 +1,6 @@ | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||||
 | 
					<resources> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <string name="app_name">阅读Pro</string> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</resources> | 
				
			||||||
@ -0,0 +1,46 @@ | 
				
			|||||||
 | 
					<!DOCTYPE html> | 
				
			||||||
 | 
					<html lang=en style="padding: 0;height:100%"> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<head> | 
				
			||||||
 | 
					  <meta charset=utf-8> | 
				
			||||||
 | 
					  <meta http-equiv=X-UA-Compatible content="IE=edge"> | 
				
			||||||
 | 
					  <meta name=viewport content="width=device-width,initial-scale=1"> | 
				
			||||||
 | 
					  <!--[if IE]><link rel="icon" href="favicon.ico" /><![endif]--> | 
				
			||||||
 | 
					  <title>yd-web-tool</title> | 
				
			||||||
 | 
					  <link href=css/about.f23c15cb.css rel=prefetch> | 
				
			||||||
 | 
					  <link href=css/detail.42c41bd6.css rel=prefetch> | 
				
			||||||
 | 
					  <link href=js/about.2589b5fe.js rel=prefetch> | 
				
			||||||
 | 
					  <link href=js/about~detail.08c372e6.js rel=prefetch> | 
				
			||||||
 | 
					  <link href=js/detail.043d6e39.js rel=prefetch> | 
				
			||||||
 | 
					  <link href=css/app.e1c0d2e4.css rel=preload as=style> | 
				
			||||||
 | 
					  <link href=css/chunk-vendors.ad4ff18f.css rel=preload as=style> | 
				
			||||||
 | 
					  <link href=js/app.b25f3cec.js rel=preload as=script> | 
				
			||||||
 | 
					  <link href=js/chunk-vendors.b3838a2d.js rel=preload as=script> | 
				
			||||||
 | 
					  <link href=css/chunk-vendors.ad4ff18f.css rel=stylesheet> | 
				
			||||||
 | 
					  <link href=css/app.e1c0d2e4.css rel=stylesheet> | 
				
			||||||
 | 
					  <link rel=icon type=image/png sizes=32x32 href=img/icons/favicon-32x32.png> | 
				
			||||||
 | 
					  <link rel=icon type=image/png sizes=16x16 href=img/icons/favicon-16x16.png> | 
				
			||||||
 | 
					  <link rel=manifest href=manifest.json> | 
				
			||||||
 | 
					  <meta name=theme-color content=#4DBA87> | 
				
			||||||
 | 
					  <meta name=apple-mobile-web-app-capable content=no> | 
				
			||||||
 | 
					  <meta name=apple-mobile-web-app-status-bar-style content=default> | 
				
			||||||
 | 
					  <meta name=apple-mobile-web-app-title content=yd-web-tool> | 
				
			||||||
 | 
					  <link rel=apple-touch-icon href=img/icons/apple-touch-icon-152x152.png> | 
				
			||||||
 | 
					  <link rel=mask-icon href=img/icons/safari-pinned-tab.svg color=#4DBA87> | 
				
			||||||
 | 
					  <meta name=msapplication-TileImage content=img/icons/msapplication-icon-144x144.png> | 
				
			||||||
 | 
					  <meta name=msapplication-TileColor content=#000000> | 
				
			||||||
 | 
					</head> | 
				
			||||||
 | 
					<style> | 
				
			||||||
 | 
					  body::-webkit-scrollbar { | 
				
			||||||
 | 
					    display: none; | 
				
			||||||
 | 
					  } | 
				
			||||||
 | 
					</style> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<body style="margin: 0;height:100%"><noscript><strong>We're sorry but yd-web-tool doesn't work properly without | 
				
			||||||
 | 
					      JavaScript enabled. Please enable it to continue.</strong></noscript> | 
				
			||||||
 | 
					  <div id=app></div> | 
				
			||||||
 | 
					  <script src=js/chunk-vendors.b3838a2d.js></script> | 
				
			||||||
 | 
					  <script src=js/app.b25f3cec.js></script> | 
				
			||||||
 | 
					</body> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</html> | 
				
			||||||
| 
		 Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB  | 
| 
		 Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB  | 
| 
		 Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB  | 
| 
		 Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB  | 
| 
		 Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB  | 
| 
		 Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB  | 
| 
		 Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB  | 
| 
		 Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB  | 
| 
		 Before Width: | Height: | Size: 799 B After Width: | Height: | Size: 799 B  | 
| 
		 Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB  | 
| 
		 Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB  | 
| 
		 Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB  | 
| 
		 Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB  | 
| 
		 Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB  | 
@ -1,8 +1,39 @@ | 
				
			|||||||
package io.legado.app.data.entities.rule | 
					package io.legado.app.data.entities.rule | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.os.Parcel | 
				
			||||||
 | 
					import android.os.Parcelable | 
				
			||||||
 | 
					
 | 
				
			||||||
data class ContentRule( | 
					data class ContentRule( | 
				
			||||||
    var content: String? = null, | 
					    var content: String? = null, | 
				
			||||||
    var nextContentUrl: String? = null, | 
					    var nextContentUrl: String? = null, | 
				
			||||||
    var webJs: String? = null, | 
					    var webJs: String? = null, | 
				
			||||||
    var sourceRegex: String? = null | 
					    var sourceRegex: String? = null | 
				
			||||||
 | 
					) : Parcelable { | 
				
			||||||
 | 
					    constructor(parcel: Parcel) : this( | 
				
			||||||
 | 
					        parcel.readString(), | 
				
			||||||
 | 
					        parcel.readString(), | 
				
			||||||
 | 
					        parcel.readString(), | 
				
			||||||
 | 
					        parcel.readString() | 
				
			||||||
    ) | 
					    ) | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    override fun writeToParcel(dest: Parcel, flags: Int) { | 
				
			||||||
 | 
					        dest.writeString(content) | 
				
			||||||
 | 
					        dest.writeString(nextContentUrl) | 
				
			||||||
 | 
					        dest.writeString(webJs) | 
				
			||||||
 | 
					        dest.writeString(sourceRegex) | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    override fun describeContents(): Int { | 
				
			||||||
 | 
					        return 0 | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    companion object CREATOR : Parcelable.Creator<ContentRule> { | 
				
			||||||
 | 
					        override fun createFromParcel(parcel: Parcel): ContentRule { | 
				
			||||||
 | 
					            return ContentRule(parcel) | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        override fun newArray(size: Int): Array<ContentRule?> { | 
				
			||||||
 | 
					            return arrayOfNulls(size) | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,74 @@ | 
				
			|||||||
 | 
					package io.legado.app.help | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import io.legado.app.App | 
				
			||||||
 | 
					import io.legado.app.R | 
				
			||||||
 | 
					import io.legado.app.utils.getPrefBoolean | 
				
			||||||
 | 
					import io.legado.app.utils.getPrefInt | 
				
			||||||
 | 
					import io.legado.app.utils.putPrefBoolean | 
				
			||||||
 | 
					import io.legado.app.utils.putPrefInt | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					object ReadTipConfig { | 
				
			||||||
 | 
					    val tipArray: Array<String> = App.INSTANCE.resources.getStringArray(R.array.read_tip) | 
				
			||||||
 | 
					    const val none = 0 | 
				
			||||||
 | 
					    const val chapterTitle = 1 | 
				
			||||||
 | 
					    const val time = 2 | 
				
			||||||
 | 
					    const val battery = 3 | 
				
			||||||
 | 
					    const val page = 4 | 
				
			||||||
 | 
					    const val totalProgress = 5 | 
				
			||||||
 | 
					    const val pageAndTotal = 6 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    val tipHeaderLeftStr: String get() = tipArray.getOrElse(tipHeaderLeft) { tipArray[none] } | 
				
			||||||
 | 
					    val tipHeaderMiddleStr: String get() = tipArray.getOrElse(tipHeaderMiddle) { tipArray[none] } | 
				
			||||||
 | 
					    val tipHeaderRightStr: String get() = tipArray.getOrElse(tipHeaderRight) { tipArray[none] } | 
				
			||||||
 | 
					    val tipFooterLeftStr: String get() = tipArray.getOrElse(tipFooterLeft) { tipArray[none] } | 
				
			||||||
 | 
					    val tipFooterMiddleStr: String get() = tipArray.getOrElse(tipFooterMiddle) { tipArray[none] } | 
				
			||||||
 | 
					    val tipFooterRightStr: String get() = tipArray.getOrElse(tipFooterRight) { tipArray[none] } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var tipHeaderLeft: Int | 
				
			||||||
 | 
					        get() = App.INSTANCE.getPrefInt("tipHeaderLeft", time) | 
				
			||||||
 | 
					        set(value) { | 
				
			||||||
 | 
					            App.INSTANCE.putPrefInt("tipHeaderLeft", value) | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var tipHeaderMiddle: Int | 
				
			||||||
 | 
					        get() = App.INSTANCE.getPrefInt("tipHeaderMiddle", none) | 
				
			||||||
 | 
					        set(value) { | 
				
			||||||
 | 
					            App.INSTANCE.putPrefInt("tipHeaderMiddle", value) | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var tipHeaderRight: Int | 
				
			||||||
 | 
					        get() = App.INSTANCE.getPrefInt("tipHeaderRight", battery) | 
				
			||||||
 | 
					        set(value) { | 
				
			||||||
 | 
					            App.INSTANCE.putPrefInt("tipHeaderRight", value) | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var tipFooterLeft: Int | 
				
			||||||
 | 
					        get() = App.INSTANCE.getPrefInt("tipFooterLeft", chapterTitle) | 
				
			||||||
 | 
					        set(value) { | 
				
			||||||
 | 
					            App.INSTANCE.putPrefInt("tipFooterLeft", value) | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var tipFooterMiddle: Int | 
				
			||||||
 | 
					        get() = App.INSTANCE.getPrefInt("tipFooterMiddle", none) | 
				
			||||||
 | 
					        set(value) { | 
				
			||||||
 | 
					            App.INSTANCE.putPrefInt("tipFooterMiddle", value) | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var tipFooterRight: Int | 
				
			||||||
 | 
					        get() = App.INSTANCE.getPrefInt("tipFooterRight", pageAndTotal) | 
				
			||||||
 | 
					        set(value) { | 
				
			||||||
 | 
					            App.INSTANCE.putPrefInt("tipFooterRight", value) | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var hideHeader: Boolean | 
				
			||||||
 | 
					        get() = App.INSTANCE.getPrefBoolean("hideHeader", true) | 
				
			||||||
 | 
					        set(value) { | 
				
			||||||
 | 
					            App.INSTANCE.putPrefBoolean("hideHeader", value) | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var hideFooter: Boolean | 
				
			||||||
 | 
					        get() = App.INSTANCE.getPrefBoolean("hideFooter", false) | 
				
			||||||
 | 
					        set(value) { | 
				
			||||||
 | 
					            App.INSTANCE.putPrefBoolean("hideFooter", value) | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,32 @@ | 
				
			|||||||
 | 
					package io.legado.app.help.storage | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import io.legado.app.data.entities.ReplaceRule | 
				
			||||||
 | 
					import io.legado.app.utils.* | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					object OldReplace { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    fun jsonToReplaceRule(json: String): ReplaceRule? { | 
				
			||||||
 | 
					        var replaceRule: ReplaceRule? = null | 
				
			||||||
 | 
					        runCatching { | 
				
			||||||
 | 
					            replaceRule = GSON.fromJsonObject<ReplaceRule>(json.trim()) | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        runCatching { | 
				
			||||||
 | 
					            if (replaceRule == null || replaceRule?.pattern.isNullOrBlank()) { | 
				
			||||||
 | 
					                val jsonItem = Restore.jsonPath.parse(json.trim()) | 
				
			||||||
 | 
					                val rule = ReplaceRule() | 
				
			||||||
 | 
					                rule.id = jsonItem.readLong("$.id") ?: System.currentTimeMillis() | 
				
			||||||
 | 
					                rule.pattern = jsonItem.readString("$.regex") ?: "" | 
				
			||||||
 | 
					                if (rule.pattern.isEmpty()) return null | 
				
			||||||
 | 
					                rule.name = jsonItem.readString("$.replaceSummary") ?: "" | 
				
			||||||
 | 
					                rule.replacement = jsonItem.readString("$.replacement") ?: "" | 
				
			||||||
 | 
					                rule.isRegex = jsonItem.readBool("$.isRegex") == true | 
				
			||||||
 | 
					                rule.scope = jsonItem.readString("$.useTo") | 
				
			||||||
 | 
					                rule.isEnabled = jsonItem.readBool("$.enable") == true | 
				
			||||||
 | 
					                rule.order = jsonItem.readInt("$.serialNumber") ?: 0 | 
				
			||||||
 | 
					                return rule | 
				
			||||||
 | 
					            } | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        return replaceRule | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} | 
				
			||||||