uh fix? maybe

master
C10udburst 2022-08-19 11:59:56 +02:00
parent 0369d024b3
commit 38267380a8
3 changed files with 22 additions and 3 deletions

View File

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

View File

@ -1,10 +1,13 @@
package com.example
import android.graphics.drawable.Drawable
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.core.content.res.ResourcesCompat
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
// TODO: Rename parameter arguments, choose names that match
@ -30,6 +33,16 @@ class BlankFragment(val plugin: TestPlugin) : BottomSheetDialogFragment() {
}
}
private fun getDrawable(name: String): Drawable? {
val id = plugin.resources!!.getIdentifier(name, "drawable", BuildConfig.LIBRARY_PACKAGE_NAME)
return ResourcesCompat.getDrawable(plugin.resources!!, id, null)
}
private fun <T : View> View.findView(name: String): T {
val id = plugin.resources!!.getIdentifier(name, "id", BuildConfig.LIBRARY_PACKAGE_NAME)
return this.findViewById(id)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
@ -39,4 +52,11 @@ class BlankFragment(val plugin: TestPlugin) : BottomSheetDialogFragment() {
val layout = plugin.resources!!.getLayout(id)
return inflater.inflate(layout, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val imageView = view.findView<ImageView>("imageView")
imageView.setImageDrawable(
getDrawable("ic_android_24dp")
)
}
}

View File

@ -18,7 +18,6 @@
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_android_24dp" />
android:layout_height="wrap_content" />
</LinearLayout>