add very cursed fragment (search for openFragment)

master
C10udburst 2022-08-10 12:30:14 +02:00
parent 537c5c03aa
commit 0791413efc
5 changed files with 91 additions and 3 deletions

View File

@ -1,3 +1,8 @@
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")
}
// use an integer for version numbers
version = 1
@ -19,4 +24,12 @@ cloudstream {
// Set to true to get an 18+ symbol next to the plugin
adult = true
requiresResources = true
}
android {
buildFeatures {
viewBinding = true
}
}

View File

@ -0,0 +1,42 @@
package com.example
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
// 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)
}
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
val id = plugin.resources!!.getIdentifier("fragment_blank", "layout", "com.example")
val layout = plugin.resources!!.getLayout(id)
return inflater.inflate(layout, container, false)
}
}

View File

@ -4,11 +4,16 @@ 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
@CloudstreamPlugin
class TestPlugin: Plugin() {
var activity: AppCompatActivity? = null
override fun load(context: Context) {
activity = context as AppCompatActivity
// All providers should be added in this manner
registerMainAPI(ExampleProvider())
registerMainAPI(ExampleProvider(this))
}
}

View File

@ -1,12 +1,13 @@
package com.example
import androidx.appcompat.app.AppCompatActivity
import com.lagradost.cloudstream3.TvType
import com.lagradost.cloudstream3.MainAPI
import com.lagradost.cloudstream3.SearchResponse
class ExampleProvider : MainAPI() { // all providers must be an intstance of MainAPI
class ExampleProvider(val plugin: TestPlugin) : MainAPI() { // all providers must be an intstance of MainAPI
override var mainUrl = "https://example.com/"
override var name = "Example provider"
override var name = "Example sex provider"
override val supportedTypes = setOf(TvType.Movie)
override var lang = "en"
@ -16,6 +17,11 @@ class ExampleProvider : MainAPI() { // all providers must be an intstance of Mai
// this function gets called when you search for something
override suspend fun search(query: String): List<SearchResponse> {
if (query == "openFragment") {
val frag = BlankFragment(plugin)
frag.show(plugin.activity!!.supportFragmentManager, "sexFrag")
}
return listOf<SearchResponse>()
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".BlankFragment">
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="24dp"
android:text="Hello Funny fragment!!" />
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="21dp" />
</androidx.constraintlayout.widget.ConstraintLayout>