From ca915ebc7e45c115469e6569da36d4535f371e9a Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Thu, 18 Aug 2022 19:21:50 +0200 Subject: [PATCH] Lets try with tags :) --- NginxProvider/build.gradle.kts | 7 +--- .../com/lagradost/NginxSettingsFragment.kt | 37 +++++++++---------- .../src/main/res/layout/nginx_settings.xml | 16 ++++---- 3 files changed, 26 insertions(+), 34 deletions(-) diff --git a/NginxProvider/build.gradle.kts b/NginxProvider/build.gradle.kts index c570eb6..b85afb6 100644 --- a/NginxProvider/build.gradle.kts +++ b/NginxProvider/build.gradle.kts @@ -5,7 +5,7 @@ dependencies { } // use an integer for version numbers -version = 4 +version = 5 cloudstream { @@ -29,9 +29,4 @@ cloudstream { "Movie", ) requiresResources = true -} -android { - buildFeatures { - viewBinding = true - } } \ No newline at end of file diff --git a/NginxProvider/src/main/kotlin/com/lagradost/NginxSettingsFragment.kt b/NginxProvider/src/main/kotlin/com/lagradost/NginxSettingsFragment.kt index 63fcfa1..da60dff 100644 --- a/NginxProvider/src/main/kotlin/com/lagradost/NginxSettingsFragment.kt +++ b/NginxProvider/src/main/kotlin/com/lagradost/NginxSettingsFragment.kt @@ -4,6 +4,9 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View 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.lagradost.cloudstream3.AcraApplication.Companion.openBrowser 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.ui.settings.SettingsAccount.Companion.showLoginInfo import com.lagradost.cloudstream3.ui.settings.SettingsAccount.Companion.addAccount -import com.lagradost.databinding.NginxSettingsBinding class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi) : BottomSheetDialogFragment() { - private lateinit var binding: NginxSettingsBinding - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -30,34 +30,31 @@ class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - binding = NginxSettingsBinding.inflate(layoutInflater) - - super.onViewCreated(view, savedInstanceState) -// val infoView = view.findViewById(R.id.nginx_info) -// val infoTextView = view.findViewById(R.id.info_main_text) -// val infoSubTextView = view.findViewById(R.id.info_sub_text) -// val infoImageView = view.findViewById(R.id.nginx_info_imageview) + val infoView = view.findViewWithTag("nginx_info") + val infoTextView = view.findViewWithTag("info_main_text") + val infoSubTextView = view.findViewWithTag("info_sub_text") + val infoImageView = view.findViewWithTag("nginx_info_imageview") - binding.infoMainText.text = getString(nginx_info_title) - binding.infoSubText.text = getString(nginx_info_summary) - binding.nginxInfoImageview.setImageResource(nginx_question) + infoTextView.text = getString(nginx_info_title) + infoSubTextView.text = getString(nginx_info_summary) + infoImageView.setImageResource(nginx_question) -// val loginView = view.findViewById(R.id.nginx_login) -// val loginTextView = view.findViewById(R.id.main_text) -// val loginImageView = view.findViewById(R.id.nginx_login_imageview) - binding.nginxLoginImageview.setImageResource(nginx) + val loginView = view.findViewWithTag("nginx_login") + val loginTextView = view.findViewWithTag("main_text") + val loginImageView = view.findViewWithTag("nginx_login_imageview") + loginImageView.setImageResource(nginx) // 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?) { openBrowser(nginxApi.createAccountUrl) } }) - binding.mainText.text = getString(login_format).format(nginxApi.name, getString(account)) - binding.nginxLogin.setOnClickListener(object : View.OnClickListener { + loginTextView.text = getString(login_format).format(nginxApi.name, getString(account)) + loginView.setOnClickListener(object : View.OnClickListener { override fun onClick(v: View?) { val info = nginxApi.loginInfo() if (info != null) { diff --git a/NginxProvider/src/main/res/layout/nginx_settings.xml b/NginxProvider/src/main/res/layout/nginx_settings.xml index b1c4bd8..b065b3c 100644 --- a/NginxProvider/src/main/res/layout/nginx_settings.xml +++ b/NginxProvider/src/main/res/layout/nginx_settings.xml @@ -2,20 +2,20 @@ --> @@ -51,14 +51,14 @@