feat: make cloudstream fast boi, ksp migration (#689)

* migrate from kapt to ksp

* fook codefactor
This commit is contained in:
IndusAryan 2023-11-10 21:32:51 +05:30 committed by GitHub
parent 7e2908c0bb
commit c4aab5e5a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 14 deletions

View file

@ -5,6 +5,7 @@ import java.net.URL
plugins { plugins {
id("com.android.application") id("com.android.application")
id("com.google.devtools.ksp")
id("kotlin-android") id("kotlin-android")
id("kotlin-kapt") id("kotlin-kapt")
id("org.jetbrains.dokka") id("org.jetbrains.dokka")
@ -87,6 +88,11 @@ android {
) )
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
arg("exportSchema", "true")
}
kapt { kapt {
includeCompileClasspath = true includeCompileClasspath = true
} }
@ -181,9 +187,13 @@ dependencies {
implementation("androidx.preference:preference-ktx:1.2.1") implementation("androidx.preference:preference-ktx:1.2.1")
implementation("com.github.bumptech.glide:glide:4.13.1") implementation("com.github.bumptech.glide:glide:4.15.1")
kapt("com.github.bumptech.glide:compiler:4.13.1") ksp("com.github.bumptech.glide:ksp:4.15.1")
implementation("com.github.bumptech.glide:okhttp3-integration:4.13.0") implementation("com.github.bumptech.glide:okhttp3-integration:4.15.1")
// for ksp
ksp("dev.zacsweers.autoservice:auto-service-ksp:1.1.0")
implementation("dev.zacsweers.autoservice:auto-service-ksp:1.1.0")
implementation("com.google.guava:guava:32.1.2-android")
implementation("jp.wasabeef:glide-transformations:4.3.0") implementation("jp.wasabeef:glide-transformations:4.3.0")
@ -207,9 +217,6 @@ dependencies {
implementation("ch.acra:acra-core:5.11.2") implementation("ch.acra:acra-core:5.11.2")
implementation("ch.acra:acra-toast:5.11.2") implementation("ch.acra:acra-toast:5.11.2")
compileOnly("com.google.auto.service:auto-service-annotations:1.1.1")
//either for java sources:
annotationProcessor("com.google.auto.service:auto-service:1.1.1")
//or for kotlin sources (requires kapt gradle plugin): //or for kotlin sources (requires kapt gradle plugin):
kapt("com.google.auto.service:auto-service:1.1.1") kapt("com.google.auto.service:auto-service:1.1.1")

View file

@ -8,7 +8,6 @@ import android.content.Intent
import android.widget.Toast import android.widget.Toast
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import com.google.auto.service.AutoService
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall
import com.lagradost.cloudstream3.plugins.PluginManager import com.lagradost.cloudstream3.plugins.PluginManager
@ -37,7 +36,6 @@ import java.lang.ref.WeakReference
import kotlin.concurrent.thread import kotlin.concurrent.thread
import kotlin.system.exitProcess import kotlin.system.exitProcess
class CustomReportSender : ReportSender { class CustomReportSender : ReportSender {
// Sends all your crashes to google forms // Sends all your crashes to google forms
override fun send(context: Context, errorContent: CrashReportData) { override fun send(context: Context, errorContent: CrashReportData) {
@ -65,7 +63,6 @@ class CustomReportSender : ReportSender {
} }
} }
@AutoService(ReportSenderFactory::class)
class CustomSenderFactory : ReportSenderFactory { class CustomSenderFactory : ReportSenderFactory {
override fun create(context: Context, config: CoreConfiguration): ReportSender { override fun create(context: Context, config: CoreConfiguration): ReportSender {
return CustomReportSender() return CustomReportSender()

View file

@ -21,7 +21,6 @@ import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueT
import com.lagradost.cloudstream3.utils.AppUtils.html import com.lagradost.cloudstream3.utils.AppUtils.html
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
import com.lagradost.cloudstream3.utils.Coroutines.main import com.lagradost.cloudstream3.utils.Coroutines.main
import com.lagradost.cloudstream3.utils.GlideApp
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromTwoLettersToLanguage import com.lagradost.cloudstream3.utils.SubtitleHelper.fromTwoLettersToLanguage
import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso
import com.lagradost.cloudstream3.utils.UIHelper.setImage import com.lagradost.cloudstream3.utils.UIHelper.setImage
@ -87,7 +86,7 @@ class PluginAdapter(
override fun onViewRecycled(holder: RecyclerView.ViewHolder) { override fun onViewRecycled(holder: RecyclerView.ViewHolder) {
if (holder is PluginViewHolder) { if (holder is PluginViewHolder) {
holder.binding.entryIcon.let { pluginIcon -> holder.binding.entryIcon.let { pluginIcon ->
GlideApp.with(pluginIcon).clear(pluginIcon) com.bumptech.glide.Glide.with(pluginIcon).clear(pluginIcon)
} }
} }
super.onViewRecycled(holder) super.onViewRecycled(holder)

View file

@ -301,7 +301,7 @@ object UIHelper {
} ?: return false } ?: return false
return try { return try {
var builder = GlideApp.with(this) var builder = com.bumptech.glide.Glide.with(this)
.load(glideImage) .load(glideImage)
.skipMemoryCache(true) .skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.ALL).let { req -> .diskCacheStrategy(DiskCacheStrategy.ALL).let { req ->
@ -368,7 +368,7 @@ object UIHelper {
) { ) {
if (this == null || url.isNullOrBlank()) return if (this == null || url.isNullOrBlank()) return
try { try {
val res = GlideApp.with(this) val res = com.bumptech.glide.Glide.with(this)
.load(GlideUrl(url) { headers ?: emptyMap() }) .load(GlideUrl(url) { headers ?: emptyMap() })
.apply(bitmapTransform(BlurTransformation(radius, sample))) .apply(bitmapTransform(BlurTransformation(radius, sample)))
.transition( .transition(

View file

@ -234,7 +234,7 @@ object VideoDownloadManager {
return cachedBitmaps[url] return cachedBitmaps[url]
} }
val bitmap = GlideApp.with(this) val bitmap = com.bumptech.glide.Glide.with(this)
.asBitmap() .asBitmap()
.load(GlideUrl(url) { headers ?: emptyMap() }) .load(GlideUrl(url) { headers ?: emptyMap() })
.into(720, 720) .into(720, 720)

View file

@ -22,6 +22,10 @@ allprojects {
} }
} }
plugins {
id("com.google.devtools.ksp") version "1.8.20-1.0.11" apply false
}
tasks.register("clean", Delete::class) { tasks.register("clean", Delete::class) {
delete(rootProject.buildDir) delete(rootProject.buildDir)
} }