mirror of
https://github.com/recloudstream/cloudstream-extensions.git
synced 2024-08-15 03:03:54 +00:00
Try viewbinding
This commit is contained in:
parent
f0e6917368
commit
4726f99f37
2 changed files with 27 additions and 18 deletions
|
@ -5,7 +5,7 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
@ -29,4 +29,9 @@ cloudstream {
|
||||||
"Movie",
|
"Movie",
|
||||||
)
|
)
|
||||||
requiresResources = true
|
requiresResources = true
|
||||||
|
}
|
||||||
|
android {
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding = true
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,9 +4,6 @@ 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
|
||||||
|
@ -15,9 +12,13 @@ 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?
|
||||||
|
@ -29,31 +30,34 @@ 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.findViewById<LinearLayout>(R.id.nginx_info)
|
||||||
val infoTextView = view.findViewById<TextView>(R.id.info_main_text)
|
// val infoTextView = view.findViewById<TextView>(R.id.info_main_text)
|
||||||
val infoSubTextView = view.findViewById<TextView>(R.id.info_sub_text)
|
// val infoSubTextView = view.findViewById<TextView>(R.id.info_sub_text)
|
||||||
val infoImageView = view.findViewById<ImageView>(R.id.nginx_info_imageview)
|
// val infoImageView = view.findViewById<ImageView>(R.id.nginx_info_imageview)
|
||||||
|
|
||||||
infoTextView.text = getString(nginx_info_title)
|
binding.infoMainText.text = getString(nginx_info_title)
|
||||||
infoSubTextView.text = getString(nginx_info_summary)
|
binding.infoSubText.text = getString(nginx_info_summary)
|
||||||
infoImageView.setImageResource(nginx_question)
|
binding.nginxInfoImageview.setImageResource(nginx_question)
|
||||||
|
|
||||||
val loginView = view.findViewById<LinearLayout>(R.id.nginx_login)
|
// val loginView = view.findViewById<LinearLayout>(R.id.nginx_login)
|
||||||
val loginTextView = view.findViewById<TextView>(R.id.main_text)
|
// val loginTextView = view.findViewById<TextView>(R.id.main_text)
|
||||||
val loginImageView = view.findViewById<ImageView>(R.id.nginx_login_imageview)
|
// val loginImageView = view.findViewById<ImageView>(R.id.nginx_login_imageview)
|
||||||
loginImageView.setImageResource(nginx)
|
binding.nginxLoginImageview.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
|
||||||
infoView.setOnClickListener(object : View.OnClickListener {
|
binding.nginxInfo.setOnClickListener(object : View.OnClickListener {
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
openBrowser(nginxApi.createAccountUrl)
|
openBrowser(nginxApi.createAccountUrl)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
loginTextView.text = getString(login_format).format(nginxApi.name, getString(account))
|
binding.mainText.text = getString(login_format).format(nginxApi.name, getString(account))
|
||||||
loginView.setOnClickListener(object : View.OnClickListener {
|
binding.nginxLogin.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) {
|
||||||
|
|
Loading…
Reference in a new issue