diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ff32133adb..f8923254ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ concurrency: cancel-in-progress: true on: - push: + pull_request: branches: # choose your default branch - master @@ -33,9 +33,11 @@ jobs: run: rm $GITHUB_WORKSPACE/builds/*.cs3 - name: Setup JDK 17 - uses: actions/setup-java@v1 + uses: actions/setup-java@v5 with: java-version: 17 + distribution: adopt + cache: gradle - name: Setup Android SDK uses: android-actions/setup-android@v2 @@ -45,6 +47,7 @@ jobs: cd $GITHUB_WORKSPACE/src chmod +x gradlew ./gradlew make makePluginsJson + ls -R . cp **/build/*.cs3 $GITHUB_WORKSPACE/builds cp build/plugins.json $GITHUB_WORKSPACE/builds diff --git a/ExampleProvider/build.gradle.kts b/ExampleProvider/build.gradle.kts index 3270d2912f..751801f4ca 100644 --- a/ExampleProvider/build.gradle.kts +++ b/ExampleProvider/build.gradle.kts @@ -1,6 +1,6 @@ dependencies { - implementation("com.google.android.material:material:1.12.0") - implementation("androidx.recyclerview:recyclerview:1.3.2") + implementation("com.google.android.material:material:1.13.0") + implementation("androidx.recyclerview:recyclerview:1.4.0") } // Use an integer for version numbers @@ -35,4 +35,27 @@ android { buildConfig = true viewBinding = true } -} \ No newline at end of file +} + +tasks.register("includeViewBindingInDex") { + group = "build" + description = "Ensures ViewBinding-generated classes are included in dex." + + dependsOn("compileDebugKotlin") + + val viewBindingDir = layout.buildDirectory.dir("generated/data_binding_base_class_source_out/debug/out") + val dexInputDir = layout.buildDirectory.dir("../src/main/java") + + from(viewBindingDir) + into(dexInputDir) + + doLast { + println("Included ViewBinding classes from: ${viewBindingDir.get().asFile}, to: ${dexInputDir.get().asFile}") + } +} + +tasks.named("compileDex") { + dependsOn("includeViewBindingInDex") + // val dexInputDir = layout.buildDirectory.dir("intermediates/classes.dex").get().asFile + // inputs.dir(dexInputDir) +} diff --git a/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt b/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt index 3d35a883cf..789767e76b 100644 --- a/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt +++ b/ExampleProvider/src/main/kotlin/com/example/BlankFragment.kt @@ -4,24 +4,21 @@ import android.annotation.SuppressLint import android.content.res.ColorStateList import android.graphics.drawable.Drawable import android.os.Build -import android.os.Bundle -import android.view.LayoutInflater import android.view.View -import android.view.ViewGroup -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.example.databinding.FragmentBlankBinding import com.lagradost.cloudstream3.R +import com.lagradost.cloudstream3.ui.BaseBottomSheetDialogFragment +import com.lagradost.cloudstream3.ui.BaseFragment import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute /** - * A simple [Fragment] subclass. + * A simple [BaseBottomSheetDialogFragment] subclass. */ -class BlankFragment(private val plugin: ExamplePlugin) : BottomSheetDialogFragment() { +class BlankFragment(private val plugin: ExamplePlugin) : BaseBottomSheetDialogFragment( + BaseFragment.BindingCreator.Inflate(FragmentBlankBinding::inflate) +) { // Helper function to get a drawable resource by name @SuppressLint("DiscouragedApi") @@ -34,61 +31,29 @@ 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? { + private fun getStringRes(name: String): String? { 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", BuildConfig.LIBRARY_PACKAGE_NAME) - return findViewById(id ?: return null) - } - - @SuppressLint("DiscouragedApi") - override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - // Inflate the layout for this fragment - val layoutId = plugin.resources?.getIdentifier("fragment_blank", "layout", BuildConfig.LIBRARY_PACKAGE_NAME) - return layoutId?.let { - inflater.inflate(plugin.resources?.getLayout(it), container, false) - } + override fun fixPadding(view: View) { + // Don't need any padding here } - @RequiresApi(Build.VERSION_CODES.M) - override fun onViewCreated( - view: View, - savedInstanceState: Bundle? - ) { - super.onViewCreated(view, savedInstanceState) + override fun onBindingCreated(binding: FragmentBlankBinding) { + binding.apply { + // Set text + textView.text = getStringRes("hello_fragment") + TextViewCompat.setTextAppearance(textView, R.style.ResultInfoText) - // 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") + textView2.text = root.context.resources.getText(R.string.legal_notice_text) - // Set text and styling if the views are found - textView?.apply { - text = getString("hello_fragment") - TextViewCompat.setTextAppearance(this, R.style.ResultInfoText) - } - - textView2?.text = view.context.resources.getText(R.string.legal_notice_text) - - // 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)) - } + // Set images + imageView.setImageDrawable(getDrawable("ic_android_24dp")) + imageView.imageTintList = ColorStateList.valueOf(root.context.getColor(R.color.white)) - imageView2?.apply { - setImageDrawable(getDrawable("ic_android_24dp")) - imageTintList = ColorStateList.valueOf(view.context.colorFromAttribute(R.attr.white)) + imageView2.setImageDrawable(getDrawable("ic_android_24dp")) + imageView2.imageTintList = ColorStateList.valueOf(root.context.colorFromAttribute(R.attr.white)) } } -} \ No newline at end of file +} diff --git a/build.gradle.kts b/build.gradle.kts index 7dc3f4709a..c3f454ea38 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,10 +12,10 @@ buildscript { } dependencies { - classpath("com.android.tools.build:gradle:8.7.3") + classpath("com.android.tools.build:gradle:8.13.0") // 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") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.2.21") } } @@ -46,8 +46,8 @@ subprojects { defaultConfig { minSdk = 21 - compileSdkVersion(35) - targetSdk = 35 + compileSdkVersion(36) + targetSdk = 36 } compileOptions { @@ -78,14 +78,14 @@ subprojects { // 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.github.Blatzar:NiceHttp:0.4.13") // HTTP Lib + implementation("org.jsoup:jsoup:1.21.2") // 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 } } -task("clean") { +tasks.register("clean") { 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 7d960c667c..534c947ea6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME \ No newline at end of file +zipStoreBase=GRADLE_USER_HOME diff --git a/repo.json b/repo.json new file mode 100644 index 0000000000..d94bfcb408 --- /dev/null +++ b/repo.json @@ -0,0 +1,8 @@ +{ + "name": "TestPlugins Fork", + "description": "TestPlugins Fork", + "manifestVersion": 1, + "pluginLists": [ + "https://raw.githubusercontent.com/Luna712/TestPlugins/builds/plugins.json" + ] +}