From 629f95348ec3e8367b91a839c7da26ac1846cd34 Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Sun, 5 Jan 2025 13:21:45 -0700 Subject: [PATCH 01/12] Upgrade gradle and cleanup --- .github/workflows/build.yml | 4 +- ExampleProvider/build.gradle.kts | 2 +- ExampleProvider/src/main/AndroidManifest.xml | 2 +- build.gradle.kts | 53 +++++++++++--------- gradle/wrapper/gradle-wrapper.properties | 3 +- 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02b75c930..ff32133ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,10 +32,10 @@ jobs: - name: Clean old builds run: rm $GITHUB_WORKSPACE/builds/*.cs3 - - name: Setup JDK 11 + - name: Setup JDK 17 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Setup Android SDK uses: android-actions/setup-android@v2 diff --git a/ExampleProvider/build.gradle.kts b/ExampleProvider/build.gradle.kts index cf02229a3..02c124aee 100644 --- a/ExampleProvider/build.gradle.kts +++ b/ExampleProvider/build.gradle.kts @@ -27,7 +27,7 @@ cloudstream { requiresResources = true language = "en" - // random cc logo i found + // Random cc logo I found iconUrl = "https://upload.wikimedia.org/wikipedia/commons/2/2f/Korduene_Logo.png" } diff --git a/ExampleProvider/src/main/AndroidManifest.xml b/ExampleProvider/src/main/AndroidManifest.xml index 1863f02aa..568741e54 100644 --- a/ExampleProvider/src/main/AndroidManifest.xml +++ b/ExampleProvider/src/main/AndroidManifest.xml @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index ef029d331..58cc77c95 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,19 +1,21 @@ -import com.lagradost.cloudstream3.gradle.CloudstreamExtension import com.android.build.gradle.BaseExtension +import com.lagradost.cloudstream3.gradle.CloudstreamExtension +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile buildscript { repositories { google() mavenCentral() - // Shitpack repo which contains our tools and dependencies + // Shitpack repo which contains our tools and dependencies maven("https://jitpack.io") } dependencies { - classpath("com.android.tools.build:gradle:7.0.4") - // Cloudstream gradle plugin which makes everything work and builds plugins + classpath("com.android.tools.build:gradle:8.7.3") + // CloudStream gradle plugin which makes everything work and builds plugins classpath("com.github.recloudstream:gradle:-SNAPSHOT") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0") } } @@ -40,10 +42,12 @@ subprojects { } android { + namespace = "com.example" + defaultConfig { minSdk = 21 - compileSdkVersion(33) - targetSdk = 33 + compileSdkVersion(35) + targetSdk = 35 } compileOptions { @@ -51,14 +55,14 @@ subprojects { targetCompatibility = JavaVersion.VERSION_1_8 } - tasks.withType { - kotlinOptions { - jvmTarget = "1.8" // Required - // Disables some unnecessary features - freeCompilerArgs = freeCompilerArgs + - "-Xno-call-assertions" + - "-Xno-param-assertions" + - "-Xno-receiver-assertions" + tasks.withType { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_1_8) // Required + freeCompilerArgs.addAll( + "-Xno-call-assertions", + "-Xno-param-assertions", + "-Xno-receiver-assertions" + ) } } } @@ -70,17 +74,16 @@ subprojects { // Stubs for all Cloudstream classes apk("com.lagradost:cloudstream3:pre-release") - // these dependencies can include any of those which are added by the app, - // but you dont need to include any of them if you dont need them - // https://github.com/recloudstream/cloudstream/blob/master/app/build.gradle - implementation(kotlin("stdlib")) // adds standard kotlin features - implementation("com.github.Blatzar:NiceHttp:0.4.4") // http library - implementation("org.jsoup:jsoup:1.16.2") // html parser - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.16.0") - implementation("com.fasterxml.jackson.core:jackson-databind:2.16.0") + // These dependencies can include any of those which are added by the app, + // but you don't need to include any of them if you don't need them. + // https://github.com/recloudstream/cloudstream/blob/master/app/build.gradle.kts + implementation(kotlin("stdlib")) // Adds Standard Kotlin Features + implementation("com.github.Blatzar:NiceHttp:0.4.11") // HTTP Lib + implementation("org.jsoup:jsoup:1.18.3") // HTML Parser + implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1") // JSON Parser } } task("clean") { - delete(rootProject.buildDir) -} + delete(rootProject.layout.buildDirectory) +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d2f276a43..7d960c667 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sun Feb 20 16:26:11 CET 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME \ No newline at end of file From a262dc6934f8a420941141c57f4d90e96938128a Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Sun, 5 Jan 2025 19:39:41 -0700 Subject: [PATCH 02/12] Replace apk --- build.gradle.kts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 58cc77c95..e873a08db 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -68,11 +68,11 @@ subprojects { } dependencies { - val apk by configurations + val cloudstream by configurations val implementation by configurations // Stubs for all Cloudstream classes - apk("com.lagradost:cloudstream3:pre-release") + cloudstream("com.lagradost:cloudstream3:pre-release") // These dependencies can include any of those which are added by the app, // but you don't need to include any of them if you don't need them. @@ -81,7 +81,7 @@ subprojects { implementation("com.github.Blatzar:NiceHttp:0.4.11") // HTTP Lib implementation("org.jsoup:jsoup:1.18.3") // HTML Parser implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1") // JSON Parser - } + i } task("clean") { From 3557de653ce10d5a594d8d61097ba663e93be91b Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Sun, 5 Jan 2025 19:42:20 -0700 Subject: [PATCH 03/12] Fix --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index e873a08db..1638bc604 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -81,7 +81,7 @@ subprojects { implementation("com.github.Blatzar:NiceHttp:0.4.11") // HTTP Lib implementation("org.jsoup:jsoup:1.18.3") // HTML Parser implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1") // JSON Parser - i + } } task("clean") { From 642d4619e56a4029ad0b966093fd6bd69421b461 Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Sun, 5 Jan 2025 19:46:04 -0700 Subject: [PATCH 04/12] Case --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1638bc604..4dd92973e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -71,7 +71,7 @@ subprojects { val cloudstream by configurations val implementation by configurations - // Stubs for all Cloudstream classes + // Stubs for all cloudstream classes cloudstream("com.lagradost:cloudstream3:pre-release") // These dependencies can include any of those which are added by the app, From 9f4f93f74923d404a13f72cc2edbc9eebd1891b8 Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:33:23 -0700 Subject: [PATCH 05/12] Cleanup --- ExampleProvider/build.gradle.kts | 20 ++-- .../main/kotlin/com/example/BlankFragment.kt | 103 +++++++++--------- .../main/kotlin/com/example/ExamplePlugin.kt | 21 ++-- .../kotlin/com/example/ExampleProvider.kt | 11 +- 4 files changed, 80 insertions(+), 75 deletions(-) diff --git a/ExampleProvider/build.gradle.kts b/ExampleProvider/build.gradle.kts index 02c124aee..5033f41dc 100644 --- a/ExampleProvider/build.gradle.kts +++ b/ExampleProvider/build.gradle.kts @@ -1,33 +1,33 @@ dependencies { - implementation("androidx.legacy:legacy-support-v4:1.0.0") - implementation("com.google.android.material:material:1.4.0") - implementation("androidx.recyclerview:recyclerview:1.2.1") + implementation("com.google.android.material:material:1.12.0") + implementation("androidx.recyclerview:recyclerview:1.3.2") } -// use an integer for version numbers + +// Use an integer for version numbers version = -1 cloudstream { - // All of these properties are optional, you can safely remove them + // All of these properties are optional, you can safely remove them. description = "Lorem ipsum" authors = listOf("Cloudburst") /** - * Status int as the following: + * Status int as one of the following: * 0: Down * 1: Ok * 2: Slow * 3: Beta only - * */ - status = 1 + **/ + status = 1 // Will be 3 if unspecified tvTypes = listOf("Movie") requiresResources = true language = "en" - // Random cc logo I found + // Random CC logo I found iconUrl = "https://upload.wikimedia.org/wikipedia/commons/2/2f/Korduene_Logo.png" } @@ -35,4 +35,4 @@ android { buildFeatures { viewBinding = true } -} +} \ No newline at end of file diff --git a/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt b/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt index be2dc268b..a5672eb8e 100644 --- a/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt +++ b/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt @@ -1,88 +1,93 @@ package com.example +import android.annotation.SuppressLint import android.content.res.ColorStateList import android.graphics.drawable.Drawable import android.os.Build import android.os.Bundle -import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import com.lagradost.cloudstream3.R import android.widget.ImageView import android.widget.TextView import androidx.annotation.RequiresApi import androidx.core.content.res.ResourcesCompat +import androidx.core.widget.TextViewCompat +import androidx.fragment.app.Fragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute -// TODO: Rename parameter arguments, choose names that match -// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER -private const val ARG_PARAM1 = "param1" -private const val ARG_PARAM2 = "param2" - /** * A simple [Fragment] subclass. - * Use the [BlankFragment.newInstance] factory method to - * create an instance of this fragment. */ -class BlankFragment(val plugin: TestPlugin) : BottomSheetDialogFragment() { - // TODO: Rename and change types of parameters - private var param1: String? = null - private var param2: String? = null - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - arguments?.let { - param1 = it.getString(ARG_PARAM1) - param2 = it.getString(ARG_PARAM2) - } - } +class BlankFragment(private val plugin: ExamplePlugin) : BottomSheetDialogFragment() { + // Helper function to get a drawable resource by name + @SuppressLint("DiscouragedApi") + @Suppress("SameParameterValue") private fun getDrawable(name: String): Drawable? { - val id = plugin.resources!!.getIdentifier(name, "drawable", BuildConfig.LIBRARY_PACKAGE_NAME) - return ResourcesCompat.getDrawable(plugin.resources!!, id, null) + val id = plugin.resources?.getIdentifier(name, "drawable", "com.example") + return id?.let { ResourcesCompat.getDrawable(plugin.resources ?: return null, it, null) } } + // Helper function to get a string resource by name + @SuppressLint("DiscouragedApi") private fun getString(name: String): String? { - val id = plugin.resources!!.getIdentifier(name, "string", BuildConfig.LIBRARY_PACKAGE_NAME) - return plugin.resources!!.getString(id) + val id = plugin.resources?.getIdentifier(name, "string", "com.example") + return id?.let { plugin.resources?.getString(it) } } - private fun View.findView(name: String): T { - val id = plugin.resources!!.getIdentifier(name, "id", BuildConfig.LIBRARY_PACKAGE_NAME) - return this.findViewById(id) + // Generic findView function to find views by name + @SuppressLint("DiscouragedApi") + private fun View.findViewByName(name: String): T? { + val id = plugin.resources?.getIdentifier(name, "id", "com.example") + return findViewById(id ?: return null) } + @SuppressLint("DiscouragedApi") override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, + inflater: LayoutInflater, + container: ViewGroup?, savedInstanceState: Bundle? ): View? { // Inflate the layout for this fragment - val id = plugin.resources!!.getIdentifier("fragment_blank", "layout", BuildConfig.LIBRARY_PACKAGE_NAME) - val layout = plugin.resources!!.getLayout(id) - return inflater.inflate(layout, container, false) + val layoutId = plugin.resources?.getIdentifier("fragment_blank", "layout", "com.example") + return layoutId?.let { + inflater.inflate(plugin.resources?.getLayout(it), container, false) + } } @RequiresApi(Build.VERSION_CODES.M) - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - val imageView = view.findView("imageView") - val imageView2 = view.findView("imageView2") - val textView = view.findView("textView") - val textView2 = view.findView("textView2") + override fun onViewCreated( + view: View, + savedInstanceState: Bundle? + ) { + super.onViewCreated(view, savedInstanceState) - textView.text = getString("hello_fragment") - textView.setTextAppearance(view.context, R.style.ResultInfoText) - textView2.text = view.context.resources.getText(R.string.legal_notice_text) + // Initialize views + val imageView: ImageView? = view.findViewByName("imageView") + val imageView2: ImageView? = view.findViewByName("imageView2") + val textView: TextView? = view.findViewByName("textView") + val textView2: TextView? = view.findViewByName("textView2") + + // Set text and styling if the views are found + textView?.apply { + text = getString("hello_fragment") + TextViewCompat.setTextAppearance(this, R.style.ResultInfoText) + } - imageView.setImageDrawable( - getDrawable("ic_android_24dp") - ) - imageView.imageTintList = ColorStateList.valueOf(view.context.getColor(R.color.white)) + textView2?.text = view.context.resources.getText(R.string.legal_notice_text) - imageView2.setImageDrawable( - getDrawable("ic_android_24dp") - ) - imageView2.imageTintList = ColorStateList.valueOf(view.context.colorFromAttribute(R.attr.white)) + // Set image resources and tint if the views are found + imageView?.apply { + setImageDrawable(getDrawable("ic_android_24dp")) + imageTintList = ColorStateList.valueOf(view.context.getColor(R.color.white)) + } + + imageView2?.apply { + setImageDrawable(getDrawable("ic_android_24dp")) + imageTintList = ColorStateList.valueOf(view.context.colorFromAttribute(R.attr.white)) + } } -} +} \ No newline at end of file diff --git a/ExampleProvider/src/main/kotlin/com/example/ExamplePlugin.kt b/ExampleProvider/src/main/kotlin/com/example/ExamplePlugin.kt index a2c4135b0..79fffa5ea 100644 --- a/ExampleProvider/src/main/kotlin/com/example/ExamplePlugin.kt +++ b/ExampleProvider/src/main/kotlin/com/example/ExamplePlugin.kt @@ -1,24 +1,25 @@ package com.example -import com.lagradost.cloudstream3.plugins.CloudstreamPlugin -import com.lagradost.cloudstream3.plugins.Plugin -import com.lagradost.cloudstream3.APIHolder import android.content.Context -import android.util.Log import androidx.appcompat.app.AppCompatActivity +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin @CloudstreamPlugin -class TestPlugin: Plugin() { - var activity: AppCompatActivity? = null +class ExamplePlugin: Plugin() { + private var activity: AppCompatActivity? = null override fun load(context: Context) { - activity = context as AppCompatActivity + activity = context as? AppCompatActivity + // All providers should be added in this manner - registerMainAPI(ExampleProvider(this)) + registerMainAPI(ExampleProvider()) - openSettings = { ctx -> + openSettings = { val frag = BlankFragment(this) - frag.show(activity!!.supportFragmentManager, "Frag") + activity?.let { + frag.show(it.supportFragmentManager, "Frag") + } } } } \ No newline at end of file diff --git a/ExampleProvider/src/main/kotlin/com/example/ExampleProvider.kt b/ExampleProvider/src/main/kotlin/com/example/ExampleProvider.kt index e2eb00b94..e788021aa 100644 --- a/ExampleProvider/src/main/kotlin/com/example/ExampleProvider.kt +++ b/ExampleProvider/src/main/kotlin/com/example/ExampleProvider.kt @@ -1,22 +1,21 @@ package com.example -import androidx.appcompat.app.AppCompatActivity -import com.lagradost.cloudstream3.TvType import com.lagradost.cloudstream3.MainAPI import com.lagradost.cloudstream3.SearchResponse +import com.lagradost.cloudstream3.TvType -class ExampleProvider(val plugin: TestPlugin) : MainAPI() { // all providers must be an intstance of MainAPI +class ExampleProvider : MainAPI() { // All providers must be an instance of MainAPI override var mainUrl = "https://example.com/" override var name = "Example provider" override val supportedTypes = setOf(TvType.Movie) override var lang = "en" - // enable this when your provider has a main page + // Enable this when your provider has a main page override val hasMainPage = true - // this function gets called when you search for something + // This function gets called when you search for something override suspend fun search(query: String): List { - return listOf() + return listOf() } } \ No newline at end of file From 4002df358a2e95598ed9745db7609e7dd16df53d Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:31:34 -0700 Subject: [PATCH 06/12] Autoload plugins --- ExampleProvider/build.gradle.kts | 4 ++-- settings.gradle.kts | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ExampleProvider/build.gradle.kts b/ExampleProvider/build.gradle.kts index 5033f41dc..8efd4f022 100644 --- a/ExampleProvider/build.gradle.kts +++ b/ExampleProvider/build.gradle.kts @@ -4,14 +4,14 @@ dependencies { } // Use an integer for version numbers -version = -1 +version = 1 cloudstream { // All of these properties are optional, you can safely remove them. description = "Lorem ipsum" - authors = listOf("Cloudburst") + authors = listOf("Cloudburst", "Luna712") /** * Status int as one of the following: diff --git a/settings.gradle.kts b/settings.gradle.kts index 43f715c33..c733a2089 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,9 +1,19 @@ rootProject.name = "CloudstreamPlugins" -// This file sets what projects are included. Every time you add a new project, you must add it -// to the includes below. +// This file sets what projects are included. +// All new projects should get automatically included unless specified in the "disabled" variable. -// Plugins are included like this -include( - "ExampleProvider" -) +val disabled = listOf() + +File(rootDir, ".").eachDir { dir -> + if (!disabled.contains(dir.name) && File(dir, "build.gradle.kts").exists()) { + include(dir.name) + } +} + +fun File.eachDir(block: (File) -> Unit) { + listFiles()?.filter { it.isDirectory }?.forEach { block(it) } +} + +// To only include a single project, comment out the previous lines (except the first one), and include your plugin like so: +// include("PluginName") \ No newline at end of file From 11e393d7be32ffdd0443d7f843ace75f66b8def2 Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:32:52 -0700 Subject: [PATCH 07/12] Remove newline --- ExampleProvider/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/ExampleProvider/build.gradle.kts b/ExampleProvider/build.gradle.kts index 8efd4f022..20ed46e8d 100644 --- a/ExampleProvider/build.gradle.kts +++ b/ExampleProvider/build.gradle.kts @@ -6,7 +6,6 @@ dependencies { // Use an integer for version numbers version = 1 - cloudstream { // All of these properties are optional, you can safely remove them. From 7b7fb2e59a44a39a8a339d1d872dca752533cdb2 Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:39:54 -0700 Subject: [PATCH 08/12] Fix using BuildConfig.LIBRARY_PACKAGE_NAME --- ExampleProvider/build.gradle.kts | 1 + .../src/main/kotlin/com/example/BlankFragment.kt | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ExampleProvider/build.gradle.kts b/ExampleProvider/build.gradle.kts index 20ed46e8d..0db6456af 100644 --- a/ExampleProvider/build.gradle.kts +++ b/ExampleProvider/build.gradle.kts @@ -32,6 +32,7 @@ cloudstream { android { buildFeatures { + buildConfig = true viewBinding = true } } \ No newline at end of file diff --git a/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt b/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt index a5672eb8e..c8cd6d74b 100644 --- a/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt +++ b/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt @@ -27,21 +27,21 @@ class BlankFragment(private val plugin: ExamplePlugin) : BottomSheetDialogFragme @SuppressLint("DiscouragedApi") @Suppress("SameParameterValue") private fun getDrawable(name: String): Drawable? { - val id = plugin.resources?.getIdentifier(name, "drawable", "com.example") + val id = plugin.resources?.getIdentifier(name, "drawable", BuildConfig.LIBRARY_PACKAGE_NAME) return id?.let { ResourcesCompat.getDrawable(plugin.resources ?: return null, it, null) } } // Helper function to get a string resource by name @SuppressLint("DiscouragedApi") private fun getString(name: String): String? { - val id = plugin.resources?.getIdentifier(name, "string", "com.example") + val id = plugin.resources?.getIdentifier(name, "string", BuildConfig.LIBRARY_PACKAGE_NAME) return id?.let { plugin.resources?.getString(it) } } // Generic findView function to find views by name @SuppressLint("DiscouragedApi") private fun View.findViewByName(name: String): T? { - val id = plugin.resources?.getIdentifier(name, "id", "com.example") + val id = plugin.resources?.getIdentifier(name, "id", BuildConfig.LIBRARY_PACKAGE_NAME) return findViewById(id ?: return null) } @@ -52,7 +52,7 @@ class BlankFragment(private val plugin: ExamplePlugin) : BottomSheetDialogFragme savedInstanceState: Bundle? ): View? { // Inflate the layout for this fragment - val layoutId = plugin.resources?.getIdentifier("fragment_blank", "layout", "com.example") + val layoutId = plugin.resources?.getIdentifier("fragment_blank", "layout", BuildConfig.LIBRARY_PACKAGE_NAME) return layoutId?.let { inflater.inflate(plugin.resources?.getLayout(it), container, false) } From e2dbc8ecefb27c72a9cac7049e004899a6020c2e Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:42:51 -0700 Subject: [PATCH 09/12] Add Suppress --- ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt b/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt index c8cd6d74b..3d35a883c 100644 --- a/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt +++ b/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt @@ -33,6 +33,7 @@ class BlankFragment(private val plugin: ExamplePlugin) : BottomSheetDialogFragme // Helper function to get a string resource by name @SuppressLint("DiscouragedApi") + @Suppress("SameParameterValue") private fun getString(name: String): String? { val id = plugin.resources?.getIdentifier(name, "string", BuildConfig.LIBRARY_PACKAGE_NAME) return id?.let { plugin.resources?.getString(it) } From b61d428a30cd9d60b8d63344ba754d39458bdbfb Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:59:27 -0700 Subject: [PATCH 10/12] Cleanup --- .../src/main/res/drawable/ic_android_24dp.xml | 2 +- ExampleProvider/src/main/res/layout/fragment_blank.xml | 9 +++++---- ExampleProvider/src/main/res/values-pl/strings.xml | 1 + ExampleProvider/src/main/res/values/strings.xml | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ExampleProvider/src/main/res/drawable/ic_android_24dp.xml b/ExampleProvider/src/main/res/drawable/ic_android_24dp.xml index fe5123074..fd8ed435a 100644 --- a/ExampleProvider/src/main/res/drawable/ic_android_24dp.xml +++ b/ExampleProvider/src/main/res/drawable/ic_android_24dp.xml @@ -2,4 +2,4 @@ android:viewportHeight="24" android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> - + \ No newline at end of file diff --git a/ExampleProvider/src/main/res/layout/fragment_blank.xml b/ExampleProvider/src/main/res/layout/fragment_blank.xml index 4c4dbf64e..26f8b6cf0 100644 --- a/ExampleProvider/src/main/res/layout/fragment_blank.xml +++ b/ExampleProvider/src/main/res/layout/fragment_blank.xml @@ -1,6 +1,5 @@ + android:text="@string/loaded_from_app_trans" /> + tools:src="@drawable/ic_android_24dp" + tools:ignore="ContentDescription" /> + tools:src="@drawable/ic_android_24dp" + tools:ignore="ContentDescription" /> \ No newline at end of file diff --git a/ExampleProvider/src/main/res/values-pl/strings.xml b/ExampleProvider/src/main/res/values-pl/strings.xml index cdcf0b5ac..c03f461eb 100644 --- a/ExampleProvider/src/main/res/values-pl/strings.xml +++ b/ExampleProvider/src/main/res/values-pl/strings.xml @@ -1,4 +1,5 @@ Witaj zabawny fragmencie!! + [ZaƂadowane z aplikacji trans] \ No newline at end of file diff --git a/ExampleProvider/src/main/res/values/strings.xml b/ExampleProvider/src/main/res/values/strings.xml index 9ed67e24f..2f86e1160 100644 --- a/ExampleProvider/src/main/res/values/strings.xml +++ b/ExampleProvider/src/main/res/values/strings.xml @@ -1,4 +1,5 @@ Hello funny fragment!! + [loaded from app trans] \ No newline at end of file From 70d146e215b7cfd7d5453733788fb29cbcf7ee3f Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:31:18 -0700 Subject: [PATCH 11/12] Wording --- ExampleProvider/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ExampleProvider/build.gradle.kts b/ExampleProvider/build.gradle.kts index 0db6456af..7ab35a154 100644 --- a/ExampleProvider/build.gradle.kts +++ b/ExampleProvider/build.gradle.kts @@ -7,7 +7,7 @@ dependencies { version = 1 cloudstream { - // All of these properties are optional, you can safely remove them. + // All of these properties are optional, you can safely remove any of them. description = "Lorem ipsum" authors = listOf("Cloudburst", "Luna712") From e187239814fff72a2371f6023ce5e19c6aea2f89 Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:04:54 -0700 Subject: [PATCH 12/12] Cleanup --- ExampleProvider/build.gradle.kts | 2 +- build.gradle.kts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ExampleProvider/build.gradle.kts b/ExampleProvider/build.gradle.kts index 7ab35a154..3270d2912 100644 --- a/ExampleProvider/build.gradle.kts +++ b/ExampleProvider/build.gradle.kts @@ -17,7 +17,7 @@ cloudstream { * 0: Down * 1: Ok * 2: Slow - * 3: Beta only + * 3: Beta-only **/ status = 1 // Will be 3 if unspecified diff --git a/build.gradle.kts b/build.gradle.kts index 4dd92973e..7dc3f4709 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ buildscript { dependencies { classpath("com.android.tools.build:gradle:8.7.3") - // CloudStream gradle plugin which makes everything work and builds plugins + // Cloudstream gradle plugin which makes everything work and builds plugins classpath("com.github.recloudstream:gradle:-SNAPSHOT") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0") } @@ -80,6 +80,8 @@ subprojects { implementation(kotlin("stdlib")) // Adds Standard Kotlin Features implementation("com.github.Blatzar:NiceHttp:0.4.11") // HTTP Lib implementation("org.jsoup:jsoup:1.18.3") // HTML Parser + // IMPORTANT: Do not bump Jackson above 2.13.1, as newer versions will + // break compatibility on older Android devices. implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1") // JSON Parser } }