mirror of
https://github.com/recloudstream/cloudstream-extensions.git
synced 2024-08-15 03:03:54 +00:00
Lets try with getIdentifier :(
This commit is contained in:
parent
ca915ebc7e
commit
2f1774a844
2 changed files with 20 additions and 15 deletions
|
@ -29,20 +29,25 @@ class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi)
|
||||||
return inflater.inflate(layout, container, false)
|
return inflater.inflate(layout, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun <T : View> View.findView(name: String): T {
|
||||||
|
val id = plugin.resources!!.getIdentifier(name, "id", "com.lagradost")
|
||||||
|
return this.findViewById(id)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
val infoView = view.findViewWithTag<LinearLayout>("nginx_info")
|
val infoView = view.findView<LinearLayout>("nginx_info")
|
||||||
val infoTextView = view.findViewWithTag<TextView>("info_main_text")
|
val infoTextView = view.findView<TextView>("info_main_text")
|
||||||
val infoSubTextView = view.findViewWithTag<TextView>("info_sub_text")
|
val infoSubTextView = view.findView<TextView>("info_sub_text")
|
||||||
val infoImageView = view.findViewWithTag<ImageView>("nginx_info_imageview")
|
val infoImageView = view.findView<ImageView>("nginx_info_imageview")
|
||||||
|
|
||||||
infoTextView.text = getString(nginx_info_title)
|
infoTextView.text = getString(nginx_info_title)
|
||||||
infoSubTextView.text = getString(nginx_info_summary)
|
infoSubTextView.text = getString(nginx_info_summary)
|
||||||
infoImageView.setImageResource(nginx_question)
|
infoImageView.setImageResource(nginx_question)
|
||||||
|
|
||||||
val loginView = view.findViewWithTag<LinearLayout>("nginx_login")
|
val loginView = view.findView<LinearLayout>("nginx_login")
|
||||||
val loginTextView = view.findViewWithTag<TextView>("main_text")
|
val loginTextView = view.findView<TextView>("main_text")
|
||||||
val loginImageView = view.findViewWithTag<ImageView>("nginx_login_imageview")
|
val loginImageView = view.findView<ImageView>("nginx_login_imageview")
|
||||||
loginImageView.setImageResource(nginx)
|
loginImageView.setImageResource(nginx)
|
||||||
|
|
||||||
// object : View.OnClickListener is required to make it compile because otherwise it used invoke-customs
|
// object : View.OnClickListener is required to make it compile because otherwise it used invoke-customs
|
||||||
|
|
|
@ -2,20 +2,20 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:tag="@+id/settings_root"
|
android:id="@+id/settings_root"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:tag="@+id/nginx_login"
|
android:id="@+id/nginx_login"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="20dp">
|
android:padding="20dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:tag="@+id/nginx_login_imageview"
|
android:id="@+id/nginx_login_imageview"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:layout_gravity="start|center_vertical"
|
android:layout_gravity="start|center_vertical"
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<!-- android:orientation="horizontal">-->
|
<!-- android:orientation="horizontal">-->
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:tag="@+id/main_text"
|
android:id="@+id/main_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
@ -51,14 +51,14 @@
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:tag="@+id/nginx_info"
|
android:id="@+id/nginx_info"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="20dp">
|
android:padding="20dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:tag="@+id/nginx_info_imageview"
|
android:id="@+id/nginx_info_imageview"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:layout_gravity="start|center_vertical"
|
android:layout_gravity="start|center_vertical"
|
||||||
|
@ -77,14 +77,14 @@
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:tag="@+id/info_main_text"
|
android:id="@+id/info_main_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:tag="@+id/info_sub_text"
|
android:id="@+id/info_sub_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
Loading…
Reference in a new issue