master
C10udburst 2022-08-19 12:07:45 +02:00
parent 38267380a8
commit 64559801b7
3 changed files with 14 additions and 2 deletions

View File

@ -4,7 +4,7 @@ dependencies {
implementation("androidx.recyclerview:recyclerview:1.2.1") implementation("androidx.recyclerview:recyclerview:1.2.1")
} }
// use an integer for version numbers // use an integer for version numbers
version = 3 version = 4
cloudstream { cloudstream {

View File

@ -7,6 +7,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.res.ResourcesCompat import androidx.core.content.res.ResourcesCompat
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
@ -38,6 +39,11 @@ class BlankFragment(val plugin: TestPlugin) : BottomSheetDialogFragment() {
return ResourcesCompat.getDrawable(plugin.resources!!, id, null) return ResourcesCompat.getDrawable(plugin.resources!!, id, null)
} }
private fun getString(name: String): String? {
val id = plugin.resources!!.getIdentifier(name, "string", BuildConfig.LIBRARY_PACKAGE_NAME)
return plugin.resources!!.getString(id)
}
private fun <T : View> View.findView(name: String): T { private fun <T : View> View.findView(name: String): T {
val id = plugin.resources!!.getIdentifier(name, "id", BuildConfig.LIBRARY_PACKAGE_NAME) val id = plugin.resources!!.getIdentifier(name, "id", BuildConfig.LIBRARY_PACKAGE_NAME)
return this.findViewById(id) return this.findViewById(id)
@ -55,8 +61,14 @@ class BlankFragment(val plugin: TestPlugin) : BottomSheetDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val imageView = view.findView<ImageView>("imageView") val imageView = view.findView<ImageView>("imageView")
val textView = view.findView<TextView>("textView")
textView.text = getString("hello_fragment")
imageView.setImageDrawable( imageView.setImageDrawable(
getDrawable("ic_android_24dp") getDrawable("ic_android_24dp")
) )
} }
} }

View File

@ -11,7 +11,7 @@
<TextView <TextView
android:id="@+id/textView" android:id="@+id/textView"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/hello_fragment" /> android:text="@string/hello_fragment" />