Compile to SDK 30, update lib dependencies (#7187)

This commit is contained in:
arkon 2021-05-22 16:04:17 -04:00 committed by GitHub
parent 5f10f155d9
commit 3d0af119ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 47 additions and 49 deletions

View File

@ -3,5 +3,5 @@ plugins {
}
dependencies {
compileOnly(Deps.kotlin.stdlib)
compileOnly(Dependencies.kotlin.stdlib)
}

View File

@ -0,0 +1,6 @@
object AndroidConfig {
const val compileSdk = 30
const val minSdk = 21
const val targetSdk = 29
const val buildTools = "30.0.3"
}

View File

@ -1,6 +0,0 @@
object Config {
const val compileSdk = 29
const val minSdk = 21
const val targetSdk = 29
const val buildTools = "29.0.3"
}

View File

@ -1,9 +1,9 @@
object Deps {
object Dependencies {
object kotlin {
const val version = "1.4.10"
const val version = "1.4.32"
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version"
}
const val jsoup = "org.jsoup:jsoup:1.13.1"
const val okhttp = "com.squareup.okhttp3:okhttp:3.10.0"
const val okhttp = "com.squareup.okhttp3:okhttp:4.9.1"
}

View File

@ -1,8 +1,8 @@
apply plugin: 'org.jmailen.kotlinter'
android {
compileSdkVersion Config.compileSdk
buildToolsVersion Config.buildTools
compileSdkVersion AndroidConfig.compileSdk
buildToolsVersion AndroidConfig.buildTools
buildTypes {
release {
@ -25,8 +25,8 @@ android {
}
defaultConfig {
minSdkVersion Config.minSdk
targetSdkVersion Config.targetSdk
minSdkVersion AndroidConfig.minSdk
targetSdkVersion AndroidConfig.targetSdk
applicationIdSuffix pkgNameSuffix
versionCode extVersionCode
versionName "$libVersion.$extVersionCode"

View File

@ -3,11 +3,11 @@ plugins {
}
android {
compileSdkVersion(Config.compileSdk)
buildToolsVersion(Config.buildTools)
compileSdkVersion(AndroidConfig.compileSdk)
buildToolsVersion(AndroidConfig.buildTools)
defaultConfig {
minSdkVersion(Config.minSdk)
minSdkVersion(AndroidConfig.minSdk)
}
sourceSets {

View File

@ -4,12 +4,12 @@ plugins {
}
android {
compileSdkVersion(Config.compileSdk)
buildToolsVersion(Config.buildTools)
compileSdkVersion(AndroidConfig.compileSdk)
buildToolsVersion(AndroidConfig.buildTools)
defaultConfig {
minSdkVersion(Config.minSdk)
targetSdkVersion(Config.targetSdk)
minSdkVersion(AndroidConfig.minSdk)
targetSdkVersion(AndroidConfig.targetSdk)
}
}
@ -18,7 +18,7 @@ repositories {
}
dependencies {
compileOnly(Deps.kotlin.stdlib)
compileOnly(Deps.okhttp)
compileOnly(Deps.jsoup)
compileOnly(Dependencies.kotlin.stdlib)
compileOnly(Dependencies.okhttp)
compileOnly(Dependencies.jsoup)
}

View File

@ -2,10 +2,10 @@ package eu.kanade.tachiyomi.lib.dataimage
import android.util.Base64
import okhttp3.Interceptor
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.Protocol
import okhttp3.Response
import okhttp3.ResponseBody
import okhttp3.ResponseBody.Companion.toResponseBody
import org.jsoup.nodes.Element
/**
@ -43,7 +43,7 @@ class DataImageInterceptor : Interceptor {
private val mediaTypePattern = Regex("""(^[^;,]*)[;,]""")
override fun intercept(chain: Interceptor.Chain): Response {
val url = chain.request().url().toString()
val url = chain.request().url.toString()
return if (url.startsWith("https://127.0.0.1/?image")) {
val dataString = url.substringAfter("?")
val byteArray = if (dataString.contains("base64")) {
@ -51,8 +51,8 @@ class DataImageInterceptor : Interceptor {
} else {
dataString.substringAfter(",").toByteArray()
}
val mediaType = MediaType.parse(mediaTypePattern.find(dataString)!!.value)
Response.Builder().body(ResponseBody.create(mediaType, byteArray))
val mediaType = mediaTypePattern.find(dataString)!!.value.toMediaTypeOrNull()
Response.Builder().body(byteArray.toResponseBody(mediaType))
.request(chain.request())
.protocol(Protocol.HTTP_1_0)
.code(200)

View File

@ -4,12 +4,12 @@ plugins {
}
android {
compileSdkVersion(Config.compileSdk)
buildToolsVersion(Config.buildTools)
compileSdkVersion(AndroidConfig.compileSdk)
buildToolsVersion(AndroidConfig.buildTools)
defaultConfig {
minSdkVersion(Config.minSdk)
targetSdkVersion(Config.targetSdk)
minSdkVersion(AndroidConfig.minSdk)
targetSdkVersion(AndroidConfig.targetSdk)
}
}
@ -18,6 +18,6 @@ repositories {
}
dependencies {
compileOnly(Deps.kotlin.stdlib)
compileOnly(Deps.okhttp)
compileOnly(Dependencies.kotlin.stdlib)
compileOnly(Dependencies.okhttp)
}

View File

@ -28,10 +28,10 @@ class SpecificHostRateLimitInterceptor(
private val requestQueue = ArrayList<Long>(permits)
private val rateLimitMillis = unit.toMillis(period)
private val host = httpUrl.host()
private val host = httpUrl.host
override fun intercept(chain: Interceptor.Chain): Response {
if (chain.request().url().host() != host) {
if (chain.request().url.host != host) {
return chain.proceed(chain.request())
}
synchronized(requestQueue) {

View File

@ -7,12 +7,12 @@ plugins {
}
android {
compileSdkVersion(Config.compileSdk)
buildToolsVersion(Config.buildTools)
compileSdkVersion(AndroidConfig.compileSdk)
buildToolsVersion(AndroidConfig.buildTools)
defaultConfig {
minSdkVersion(29)
targetSdkVersion(Config.targetSdk)
targetSdkVersion(AndroidConfig.targetSdk)
}
}

View File

@ -245,7 +245,7 @@ abstract class Madara(
private class ArtistFilter : Filter.Text("Artist")
private class YearFilter : Filter.Text("Year of Released")
private class StatusFilter(status: List<Tag>) : Filter.Group<Tag>("Status", status)
private class OrderByFilter : UriPartFilter(
"Order By",
arrayOf(
@ -258,7 +258,7 @@ abstract class Madara(
Pair("New", "new-manga")
)
)
private class GenreConditionFilter : UriPartFilter(
"Genre condition",
arrayOf(
@ -266,7 +266,7 @@ abstract class Madara(
Pair("and", "1")
)
)
private class AdultContentFilter : UriPartFilter(
"Adult Content",
arrayOf(
@ -275,7 +275,7 @@ abstract class Madara(
Pair("Only", "1")
)
)
private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Genres", genres)
class Genre(name: String, val id: String = name) : Filter.CheckBox(name)
@ -626,10 +626,8 @@ abstract class Madara(
val hostName = prefsEntries[prefsEntryValues.indexOf(validHost)]
Handler(Looper.getMainLooper()).post {
val toast = Toast.makeText(Injekt.get<Application>().applicationContext, "Host : $hostName\nYou may want to switch to this host to avoid unnecessary loading time", Toast.LENGTH_SHORT)
val view = toast.view.findViewById<TextView>(android.R.id.message)
view?.let {
view.gravity = Gravity.CENTER_HORIZONTAL
}
val view = toast.view?.findViewById<TextView>(android.R.id.message)
view?.let { it.gravity = Gravity.CENTER_HORIZONTAL }
toast.show()
}
}

View File

@ -38,7 +38,7 @@ if (System.getenv("CI") == null || System.getenv("CI_PUSH") == "true") {
* comment out the parts above and uncomment below.
*/
// val lang = "all"
// val name = "mmrcms"
// val name = "mangadex"
// include(":${lang}-${name}")
// project(":${lang}-${name}").projectDir = File("src/${lang}/${name}")
} else {