mirror of
https://github.com/gedoor/legado.git
synced 2024-07-19 01:17:25 +08:00
修复一些过时方法
This commit is contained in:
parent
0ccac4a8d1
commit
2524081858
@ -160,7 +160,7 @@ dependencies {
|
||||
testImplementation "androidx.room:room-testing:$room_version"
|
||||
|
||||
//paging
|
||||
implementation 'androidx.paging:paging-runtime-ktx:3.0.0'
|
||||
implementation 'androidx.paging:paging-runtime-ktx:2.1.2'
|
||||
|
||||
//liveEventBus
|
||||
implementation 'com.jeremyliao:live-event-bus-x:1.5.7'
|
||||
|
@ -54,6 +54,7 @@ abstract class BasePreferenceFragment : PreferenceFragmentCompat() {
|
||||
}
|
||||
}
|
||||
f.setTargetFragment(this, 0)
|
||||
|
||||
f.show(parentFragmentManager, dialogFragmentTag)
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ interface JsExtensions {
|
||||
if (font1 == null || font2 == null) return text
|
||||
val contentArray = text.toCharArray()
|
||||
contentArray.forEachIndexed { index, s ->
|
||||
val oldCode = s.toInt()
|
||||
val oldCode = s.code
|
||||
if (font1.inLimit(s)) {
|
||||
val code = font2.getCodeByGlyf(font1.getGlyfByCode(oldCode))
|
||||
if (code != 0) contentArray[index] = code.toChar()
|
||||
|
@ -51,7 +51,7 @@ object RssParserByRule {
|
||||
Debug.log(sourceUrl, "└列表大小:${collections.size}")
|
||||
if (!rssSource.ruleNextPage.isNullOrEmpty()) {
|
||||
Debug.log(sourceUrl, "┌获取下一页链接")
|
||||
if (rssSource.ruleNextPage!!.toUpperCase(Locale.getDefault()) == "PAGE") {
|
||||
if (rssSource.ruleNextPage!!.uppercase(Locale.getDefault()) == "PAGE") {
|
||||
nextUrl = sortUrl
|
||||
} else {
|
||||
nextUrl = analyzeRule.getString(rssSource.ruleNextPage)
|
||||
|
@ -141,7 +141,7 @@ class FontSelectDialog : BaseDialogFragment(),
|
||||
val fontDir =
|
||||
FileUtils.createFolderIfNotExist(requireContext().externalFilesDir, "font")
|
||||
fontDir.listFiles { pathName ->
|
||||
pathName.name.toLowerCase(Locale.getDefault()).matches(fontRegex)
|
||||
pathName.name.lowercase(Locale.getDefault()).matches(fontRegex)
|
||||
}?.forEach {
|
||||
fontItems.add(
|
||||
DocItem(
|
||||
@ -161,7 +161,7 @@ class FontSelectDialog : BaseDialogFragment(),
|
||||
val fontItems = arrayListOf<DocItem>()
|
||||
val docItems = DocumentUtils.listFiles(appCtx, doc.uri)
|
||||
docItems.forEach { item ->
|
||||
if (item.name.toLowerCase(Locale.getDefault()).matches(fontRegex)) {
|
||||
if (item.name.lowercase(Locale.getDefault()).matches(fontRegex)) {
|
||||
fontItems.add(item)
|
||||
}
|
||||
}
|
||||
@ -188,7 +188,7 @@ class FontSelectDialog : BaseDialogFragment(),
|
||||
val fontItems = arrayListOf<DocItem>()
|
||||
val file = File(path)
|
||||
file.listFiles { pathName ->
|
||||
pathName.name.toLowerCase(Locale.getDefault()).matches(fontRegex)
|
||||
pathName.name.lowercase(Locale.getDefault()).matches(fontRegex)
|
||||
}?.forEach {
|
||||
fontItems.add(
|
||||
DocItem(
|
||||
|
@ -525,7 +525,7 @@ class ACache private constructor(cacheDir: File, max_size: Long, max_count: Int)
|
||||
}
|
||||
|
||||
fun hasDateInfo(data: ByteArray?): Boolean {
|
||||
return (data != null && data.size > 15 && data[13] == '-'.toByte()
|
||||
return (data != null && data.size > 15 && data[13] == '-'.code.toByte()
|
||||
&& indexOf(data, mSeparator) > 14)
|
||||
}
|
||||
|
||||
@ -546,7 +546,7 @@ class ACache private constructor(cacheDir: File, max_size: Long, max_count: Int)
|
||||
@Suppress("SameParameterValue")
|
||||
private fun indexOf(data: ByteArray, c: Char): Int {
|
||||
for (i in data.indices) {
|
||||
if (data[i] == c.toByte()) {
|
||||
if (data[i] == c.code.toByte()) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ object EncoderUtils {
|
||||
fun escape(src: String): String {
|
||||
val tmp = StringBuilder()
|
||||
for (char in src) {
|
||||
val charCode = char.toInt()
|
||||
val charCode = char.code
|
||||
if (charCode in 48..57 || charCode in 65..90 || charCode in 97..122) {
|
||||
tmp.append(char)
|
||||
continue
|
||||
|
@ -26,14 +26,14 @@ object EncodingDetect {
|
||||
}
|
||||
val content = metaTag.attr("content")
|
||||
val httpEquiv = metaTag.attr("http-equiv")
|
||||
if (httpEquiv.toLowerCase(Locale.getDefault()) == "content-type") {
|
||||
charsetStr = if (content.toLowerCase(Locale.getDefault()).contains("charset")) {
|
||||
if (httpEquiv.lowercase(Locale.getDefault()) == "content-type") {
|
||||
charsetStr = if (content.lowercase(Locale.getDefault()).contains("charset")) {
|
||||
content.substring(
|
||||
content.toLowerCase(Locale.getDefault())
|
||||
content.lowercase(Locale.getDefault())
|
||||
.indexOf("charset") + "charset=".length
|
||||
)
|
||||
} else {
|
||||
content.substring(content.toLowerCase(Locale.getDefault()).indexOf(";") + 1)
|
||||
content.substring(content.lowercase(Locale.getDefault()).indexOf(";") + 1)
|
||||
}
|
||||
if (!TextUtils.isEmpty(charsetStr)) {
|
||||
return charsetStr
|
||||
|
@ -12,17 +12,17 @@ object NetworkUtils {
|
||||
|
||||
private val notNeedEncoding: BitSet by lazy {
|
||||
val bitSet = BitSet(256)
|
||||
for (i in 'a'.toInt()..'z'.toInt()) {
|
||||
for (i in 'a'.code..'z'.code) {
|
||||
bitSet.set(i)
|
||||
}
|
||||
for (i in 'A'.toInt()..'Z'.toInt()) {
|
||||
for (i in 'A'.code..'Z'.code) {
|
||||
bitSet.set(i)
|
||||
}
|
||||
for (i in '0'.toInt()..'9'.toInt()) {
|
||||
for (i in '0'.code..'9'.code) {
|
||||
bitSet.set(i)
|
||||
}
|
||||
for (char in "+-_.$:()!*@&#,[]") {
|
||||
bitSet.set(char.toInt())
|
||||
bitSet.set(char.code)
|
||||
}
|
||||
return@lazy bitSet
|
||||
}
|
||||
@ -38,7 +38,7 @@ object NetworkUtils {
|
||||
var i = 0
|
||||
while (i < str.length) {
|
||||
val c = str[i]
|
||||
if (notNeedEncoding.get(c.toInt())) {
|
||||
if (notNeedEncoding.get(c.code)) {
|
||||
i++
|
||||
continue
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ object StringUtils {
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
fun toFirstCapital(str: String): String {
|
||||
return str.substring(0, 1).toUpperCase() + str.substring(1)
|
||||
return str.substring(0, 1).uppercase(Locale.getDefault()) + str.substring(1)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,7 +123,7 @@ object StringUtils {
|
||||
fun halfToFull(input: String): String {
|
||||
val c = input.toCharArray()
|
||||
for (i in c.indices) {
|
||||
if (c[i].toInt() == 32)
|
||||
if (c[i].code == 32)
|
||||
//半角空格
|
||||
{
|
||||
c[i] = 12288.toChar()
|
||||
@ -133,9 +133,9 @@ object StringUtils {
|
||||
//if (c[i] == 46) //半角点号,不转换
|
||||
// continue;
|
||||
|
||||
if (c[i].toInt() in 33..126)
|
||||
if (c[i].code in 33..126)
|
||||
//其他符号都转换为全角
|
||||
c[i] = (c[i].toInt() + 65248).toChar()
|
||||
c[i] = (c[i].code + 65248).toChar()
|
||||
}
|
||||
return String(c)
|
||||
}
|
||||
@ -144,15 +144,15 @@ object StringUtils {
|
||||
fun fullToHalf(input: String): String {
|
||||
val c = input.toCharArray()
|
||||
for (i in c.indices) {
|
||||
if (c[i].toInt() == 12288)
|
||||
if (c[i].code == 12288)
|
||||
//全角空格
|
||||
{
|
||||
c[i] = 32.toChar()
|
||||
continue
|
||||
}
|
||||
|
||||
if (c[i].toInt() in 65281..65374)
|
||||
c[i] = (c[i].toInt() - 65248).toChar()
|
||||
if (c[i].code in 65281..65374)
|
||||
c[i] = (c[i].code - 65248).toChar()
|
||||
}
|
||||
return String(c)
|
||||
}
|
||||
@ -255,10 +255,10 @@ object StringUtils {
|
||||
var start = 0
|
||||
val len = s.length
|
||||
var end = len - 1
|
||||
while (start < end && (s[start].toInt() <= 0x20 || s[start] == ' ')) {
|
||||
while (start < end && (s[start].code <= 0x20 || s[start] == ' ')) {
|
||||
++start
|
||||
}
|
||||
while (start < end && (s[end].toInt() <= 0x20 || s[end] == ' ')) {
|
||||
while (start < end && (s[end].code <= 0x20 || s[end] == ' ')) {
|
||||
--end
|
||||
}
|
||||
if (end < len) ++end
|
||||
|
@ -4,7 +4,7 @@ buildscript {
|
||||
ext.kotlin_version = '1.5.0'
|
||||
repositories {
|
||||
google()
|
||||
maven { url "https://maven.aliyun.com/nexus/content/groups/public/" }
|
||||
maven { url 'https://maven.aliyun.com/repository/public/'}
|
||||
maven { url "https://s3.amazonaws.com/fabric-artifacts/public" }
|
||||
maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
|
||||
maven { url "https://plugins.gradle.org/m2/" }
|
||||
@ -19,10 +19,9 @@ buildscript {
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
maven { url "https://maven.aliyun.com/nexus/content/groups/public/" }
|
||||
maven { url 'https://maven.aliyun.com/repository/public/'}
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url "https://maven.google.com/" }
|
||||
//maven { url "https://github.com/psiegman/mvn-repo/raw/master/releases" }
|
||||
}
|
||||
}
|
||||
|
||||
|
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
||||
#Tue Oct 13 11:35:54 CST 2020
|
||||
#Fri May 07 15:24:46 CST 2021
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
Loading…
Reference in New Issue
Block a user