Lets try with tags :)

This commit is contained in:
Blatzar 2022-08-18 19:21:50 +02:00
parent 4726f99f37
commit ca915ebc7e
3 changed files with 26 additions and 34 deletions

View file

@ -5,7 +5,7 @@ dependencies {
} }
// use an integer for version numbers // use an integer for version numbers
version = 4 version = 5
cloudstream { cloudstream {
@ -29,9 +29,4 @@ cloudstream {
"Movie", "Movie",
) )
requiresResources = true requiresResources = true
}
android {
buildFeatures {
viewBinding = true
}
} }

View file

@ -4,6 +4,9 @@ import android.os.Bundle
import android.view.LayoutInflater 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.LinearLayout
import android.widget.TextView
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.lagradost.cloudstream3.AcraApplication.Companion.openBrowser import com.lagradost.cloudstream3.AcraApplication.Companion.openBrowser
import com.lagradost.cloudstream3.R.drawable.nginx import com.lagradost.cloudstream3.R.drawable.nginx
@ -12,13 +15,10 @@ import com.lagradost.cloudstream3.R.string.*
import com.lagradost.cloudstream3.plugins.Plugin import com.lagradost.cloudstream3.plugins.Plugin
import com.lagradost.cloudstream3.ui.settings.SettingsAccount.Companion.showLoginInfo import com.lagradost.cloudstream3.ui.settings.SettingsAccount.Companion.showLoginInfo
import com.lagradost.cloudstream3.ui.settings.SettingsAccount.Companion.addAccount import com.lagradost.cloudstream3.ui.settings.SettingsAccount.Companion.addAccount
import com.lagradost.databinding.NginxSettingsBinding
class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi) : class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi) :
BottomSheetDialogFragment() { BottomSheetDialogFragment() {
private lateinit var binding: NginxSettingsBinding
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle? savedInstanceState: Bundle?
@ -30,34 +30,31 @@ class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi)
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
binding = NginxSettingsBinding.inflate(layoutInflater)
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
// val infoView = view.findViewById<LinearLayout>(R.id.nginx_info) val infoView = view.findViewWithTag<LinearLayout>("nginx_info")
// val infoTextView = view.findViewById<TextView>(R.id.info_main_text) val infoTextView = view.findViewWithTag<TextView>("info_main_text")
// val infoSubTextView = view.findViewById<TextView>(R.id.info_sub_text) val infoSubTextView = view.findViewWithTag<TextView>("info_sub_text")
// val infoImageView = view.findViewById<ImageView>(R.id.nginx_info_imageview) val infoImageView = view.findViewWithTag<ImageView>("nginx_info_imageview")
binding.infoMainText.text = getString(nginx_info_title) infoTextView.text = getString(nginx_info_title)
binding.infoSubText.text = getString(nginx_info_summary) infoSubTextView.text = getString(nginx_info_summary)
binding.nginxInfoImageview.setImageResource(nginx_question) infoImageView.setImageResource(nginx_question)
// val loginView = view.findViewById<LinearLayout>(R.id.nginx_login) val loginView = view.findViewWithTag<LinearLayout>("nginx_login")
// val loginTextView = view.findViewById<TextView>(R.id.main_text) val loginTextView = view.findViewWithTag<TextView>("main_text")
// val loginImageView = view.findViewById<ImageView>(R.id.nginx_login_imageview) val loginImageView = view.findViewWithTag<ImageView>("nginx_login_imageview")
binding.nginxLoginImageview.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
binding.nginxInfo.setOnClickListener(object : View.OnClickListener { infoView.setOnClickListener(object : View.OnClickListener {
override fun onClick(v: View?) { override fun onClick(v: View?) {
openBrowser(nginxApi.createAccountUrl) openBrowser(nginxApi.createAccountUrl)
} }
}) })
binding.mainText.text = getString(login_format).format(nginxApi.name, getString(account)) loginTextView.text = getString(login_format).format(nginxApi.name, getString(account))
binding.nginxLogin.setOnClickListener(object : View.OnClickListener { loginView.setOnClickListener(object : View.OnClickListener {
override fun onClick(v: View?) { override fun onClick(v: View?) {
val info = nginxApi.loginInfo() val info = nginxApi.loginInfo()
if (info != null) { if (info != null) {

View file

@ -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:id="@+id/settings_root" android:tag="@+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:id="@+id/nginx_login" android:tag="@+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:id="@+id/nginx_login_imageview" android:tag="@+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:id="@+id/main_text" android:tag="@+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:id="@+id/nginx_info" android:tag="@+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:id="@+id/nginx_info_imageview" android:tag="@+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:id="@+id/info_main_text" android:tag="@+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:id="@+id/info_sub_text" android:tag="@+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" />