diff --git a/app/src/main/java/io/legado/app/data/entities/BookChapter.kt b/app/src/main/java/io/legado/app/data/entities/BookChapter.kt
index 76a9da66e..ba0380472 100644
--- a/app/src/main/java/io/legado/app/data/entities/BookChapter.kt
+++ b/app/src/main/java/io/legado/app/data/entities/BookChapter.kt
@@ -5,6 +5,7 @@ import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Ignore
import androidx.room.Index
+import io.legado.app.R
import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.model.analyzeRule.RuleDataInterface
import io.legado.app.utils.GSON
@@ -13,6 +14,7 @@ import io.legado.app.utils.NetworkUtils
import io.legado.app.utils.fromJsonObject
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
+import splitties.init.appCtx
@Parcelize
@Entity(
@@ -69,11 +71,21 @@ data class BookChapter(
return false
}
- fun getAbsoluteURL():String{
+ fun getDisplayTitle(): String {
+ return when {
+ !isVip -> title
+ isPay -> appCtx.getString(R.string.payed_title, title)
+ else -> appCtx.getString(R.string.vip_title, title)
+ }
+ }
+
+ fun getAbsoluteURL(): String {
val urlMatcher = AnalyzeUrl.paramPattern.matcher(url)
- val urlBefore = if(urlMatcher.find())url.substring(0,urlMatcher.start()) else url
- val urlAbsoluteBefore = NetworkUtils.getAbsoluteURL(baseUrl,urlBefore)
- return if(urlBefore.length == url.length) urlAbsoluteBefore else urlAbsoluteBefore + ',' + url.substring(urlMatcher.end())
+ val urlBefore = if (urlMatcher.find()) url.substring(0, urlMatcher.start()) else url
+ val urlAbsoluteBefore = NetworkUtils.getAbsoluteURL(baseUrl, urlBefore)
+ return if (urlBefore.length == url.length) urlAbsoluteBefore else urlAbsoluteBefore + ',' + url.substring(
+ urlMatcher.end()
+ )
}
fun getFileName(): String = String.format("%05d-%s.nb", index, MD5Utils.md5Encode16(title))
diff --git a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt
index 15eebaeb6..aec125643 100644
--- a/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt
+++ b/app/src/main/java/io/legado/app/ui/book/toc/ChapterListAdapter.kt
@@ -36,7 +36,7 @@ class ChapterListAdapter(context: Context, val callback: Callback) :
} else {
tvChapterName.setTextColor(context.getCompatColor(R.color.primaryText))
}
- tvChapterName.text = item.title
+ tvChapterName.text = item.getDisplayTitle()
if (!item.tag.isNullOrEmpty()) {
tvTag.text = item.tag
tvTag.visible()
diff --git a/app/src/main/res/values/non_translat.xml b/app/src/main/res/values/non_translat.xml
index defba67b0..7d066484b 100644
--- a/app/src/main/res/values/non_translat.xml
+++ b/app/src/main/res/values/non_translat.xml
@@ -4,5 +4,7 @@
http://%1$s:%2$d
GitHub
【%s】
+ 🔒%s
+ 🔓%s
\ No newline at end of file