mirror of
https://github.com/recloudstream/cloudstream-extensions.git
synced 2024-08-15 03:03:54 +00:00
update nginx provider
This commit is contained in:
parent
6d4592b2be
commit
d1a69088f3
14 changed files with 71 additions and 29 deletions
|
@ -5,7 +5,7 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 6
|
version = 7
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
|
import com.lagradost.cloudstream3.R
|
||||||
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.plugins.Plugin
|
import com.lagradost.cloudstream3.plugins.Plugin
|
||||||
|
@ -17,7 +18,6 @@ import com.lagradost.cloudstream3.ui.settings.SettingsAccount.Companion.showLogi
|
||||||
import com.lagradost.cloudstream3.ui.settings.SettingsAccount.Companion.addAccount
|
import com.lagradost.cloudstream3.ui.settings.SettingsAccount.Companion.addAccount
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
|
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
|
||||||
|
|
||||||
const val packageName = "com.lagradost"
|
|
||||||
|
|
||||||
class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi) :
|
class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi) :
|
||||||
BottomSheetDialogFragment() {
|
BottomSheetDialogFragment() {
|
||||||
|
@ -27,40 +27,24 @@ class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi)
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
val id = plugin.resources!!.getIdentifier("nginx_settings", "layout", packageName)
|
val id = plugin.resources!!.getIdentifier("nginx_settings", "layout", BuildConfig.LIBRARY_PACKAGE_NAME)
|
||||||
val layout = plugin.resources!!.getLayout(id)
|
val layout = plugin.resources!!.getLayout(id)
|
||||||
return inflater.inflate(layout, container, false)
|
return inflater.inflate(layout, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <T : View> View.findView(name: String): T {
|
private fun <T : View> View.findView(name: String): T {
|
||||||
val id = plugin.resources!!.getIdentifier(name, "id", packageName)
|
val id = plugin.resources!!.getIdentifier(name, "id", BuildConfig.LIBRARY_PACKAGE_NAME)
|
||||||
return this.findViewById(id)
|
return this.findViewById(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getDrawable(name: String): Drawable? {
|
private fun getDrawable(name: String): Drawable? {
|
||||||
val id = plugin.resources!!.getIdentifier(name, "drawable", packageName)
|
val id = plugin.resources!!.getIdentifier(name, "drawable", BuildConfig.LIBRARY_PACKAGE_NAME)
|
||||||
return ResourcesCompat.getDrawable(plugin.resources!!, id, null)
|
return ResourcesCompat.getDrawable(plugin.resources!!, id, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getString(name: String): String {
|
private fun getString(name: String): String? {
|
||||||
val id = maxOf(
|
val id = plugin.resources!!.getIdentifier(name, "string", BuildConfig.LIBRARY_PACKAGE_NAME)
|
||||||
// Fuck it lets see if any works
|
return plugin.resources!!.getString(id)
|
||||||
plugin.resources!!.getIdentifier(name, "string", packageName),
|
|
||||||
plugin.resources!!.getIdentifier(name, "string", "$packageName.cloudstream3"),
|
|
||||||
this.context?.resources?.getIdentifier(name, "string", "$packageName.cloudstream3")
|
|
||||||
?: 0,
|
|
||||||
this.context?.resources?.getIdentifier(name, "string", packageName) ?: 0,
|
|
||||||
this.activity?.resources?.getIdentifier(name, "string", "$packageName.cloudstream3") ?: 0,
|
|
||||||
this.activity?.resources?.getIdentifier(name, "string", packageName) ?: 0,
|
|
||||||
)
|
|
||||||
return if (id <= 0)
|
|
||||||
""
|
|
||||||
else
|
|
||||||
this.getString(id)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getAttr(name: String): Int {
|
|
||||||
return plugin.resources!!.getIdentifier(name, "attr", packageName)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
@ -72,18 +56,16 @@ class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi)
|
||||||
|
|
||||||
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.setImageDrawable(
|
infoImageView.setImageDrawable(getDrawable("nginx_question"))
|
||||||
getDrawable("nginx_question")
|
|
||||||
)
|
|
||||||
infoImageView.imageTintList =
|
infoImageView.imageTintList =
|
||||||
ColorStateList.valueOf(view.context.colorFromAttribute(getAttr("white")))
|
ColorStateList.valueOf(view.context.colorFromAttribute(R.attr.white))
|
||||||
|
|
||||||
val loginView = view.findView<LinearLayout>("nginx_login")
|
val loginView = view.findView<LinearLayout>("nginx_login")
|
||||||
val loginTextView = view.findView<TextView>("main_text")
|
val loginTextView = view.findView<TextView>("main_text")
|
||||||
val loginImageView = view.findView<ImageView>("nginx_login_imageview")
|
val loginImageView = view.findView<ImageView>("nginx_login_imageview")
|
||||||
loginImageView.setImageDrawable(getDrawable("nginx"))
|
loginImageView.setImageDrawable(getDrawable("nginx"))
|
||||||
loginImageView.imageTintList =
|
loginImageView.imageTintList =
|
||||||
ColorStateList.valueOf(view.context.colorFromAttribute(getAttr("white")))
|
ColorStateList.valueOf(view.context.colorFromAttribute(R.attr.white))
|
||||||
|
|
||||||
// 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 {
|
infoView.setOnClickListener(object : View.OnClickListener {
|
||||||
|
|
5
NginxProvider/src/main/res/values-bp/strings.xml
Normal file
5
NginxProvider/src/main/res/values-bp/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_title">O que é Nginx ?</string>
|
||||||
|
<string name="nginx_info_summary">Nginx é um software que pode ser usado para exibir arquivos de um servidor que você possui. Clique para ver um guia de configuração do Nginx</string>
|
||||||
|
</resources>
|
5
NginxProvider/src/main/res/values-cs/strings.xml
Normal file
5
NginxProvider/src/main/res/values-cs/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_title">Co je to Nginx?</string>
|
||||||
|
<string name="nginx_info_summary">Nginx je software, který může být použit ke zobrazení souborů na serveru, který vlastníte. Klikněte pro zobrazení návodu k nastavení Nginx</string>
|
||||||
|
</resources>
|
5
NginxProvider/src/main/res/values-es/strings.xml
Normal file
5
NginxProvider/src/main/res/values-es/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_title">¿Qué es Nginx?</string>
|
||||||
|
<string name="nginx_info_summary">Nginx es un software que se puede usar para mostrar archivos de un servidor de su propiedad. Pulse para ver una guía de configuración de Nginx</string>
|
||||||
|
</resources>
|
5
NginxProvider/src/main/res/values-fr/strings.xml
Normal file
5
NginxProvider/src/main/res/values-fr/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_summary">Nginx est un logiciel utilisé pour afficher les fichier d\'un server que vous possèdez. Cliquez pour voir un guide de mise en place.</string>
|
||||||
|
<string name="nginx_url_pref">Addresse du serveur Nginx</string>
|
||||||
|
</resources>
|
5
NginxProvider/src/main/res/values-in/strings.xml
Normal file
5
NginxProvider/src/main/res/values-in/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_title">Apa itu Nginx ?</string>
|
||||||
|
<string name="nginx_info_summary">Nginx adalah sebuah software yang dapat digunakan untuk menampilkan file dari server yang anda miliki. Klik untuk melihat panduan pengaturan Nginx</string>
|
||||||
|
</resources>
|
5
NginxProvider/src/main/res/values-it/strings.xml
Normal file
5
NginxProvider/src/main/res/values-it/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_title">Cos\'è Nginx?</string>
|
||||||
|
<string name="nginx_info_summary">Nginx è un software che può essere utilizzato per visualizzare i file da un server di proprietà. Fare clic per vedere la guida all\'installazione di Nginx</string>
|
||||||
|
</resources>
|
5
NginxProvider/src/main/res/values-nl/strings.xml
Normal file
5
NginxProvider/src/main/res/values-nl/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_title">Wat is Nginx ?</string>
|
||||||
|
<string name="nginx_info_summary">Nginx is een software die kan worden gebruikt om bestanden weer te geven van een server die u bezit. Klik om een Nginx installatiegids te zien</string>
|
||||||
|
</resources>
|
5
NginxProvider/src/main/res/values-pl/strings.xml
Normal file
5
NginxProvider/src/main/res/values-pl/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_title">Co to Nginx?</string>
|
||||||
|
<string name="nginx_info_summary">Nginx to oprogramowanie, które może być używane do wyświetlania plików z serwera, którego jesteś właścicielem. Kliknij, aby zobaczyć przewodnik konfiguracji Nginx</string>
|
||||||
|
</resources>
|
5
NginxProvider/src/main/res/values-ro/strings.xml
Normal file
5
NginxProvider/src/main/res/values-ro/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_title">Ce este Nginx?</string>
|
||||||
|
<string name="nginx_info_summary">Nginx este un software care poate fi utilizat pentru a vizualiza fișiere de pe un server proprietar. Faceți clic pentru a vedea ghidul de instalare Nginx</string>
|
||||||
|
</resources>
|
5
NginxProvider/src/main/res/values-tr/strings.xml
Normal file
5
NginxProvider/src/main/res/values-tr/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_title">Nginx nedir?</string>
|
||||||
|
<string name="nginx_info_summary">Nginx, sahip olduğunuz bir sunucudan dosyaları görüntülemek için kullanılabilecek bir yazılımdır. Nginx kurulum kılavuzunu görmek için tıklayın</string>
|
||||||
|
</resources>
|
5
NginxProvider/src/main/res/values-vi/strings.xml
Normal file
5
NginxProvider/src/main/res/values-vi/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_title">Nginx là gì?</string>
|
||||||
|
<string name="nginx_info_summary">Nginx được dùng để hiển thị các tệp từ máy chủ mà bạn sở hữu. Chọn để xem hướng dẫn thiết lập Nginx</string>
|
||||||
|
</resources>
|
5
NginxProvider/src/main/res/values/strings.xml
Normal file
5
NginxProvider/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="nginx_info_title">What is Nginx ?</string>
|
||||||
|
<string name="nginx_info_summary">Nginx is a software that can be used to display files from a server that you own. Click to see a Nginx setup guide</string>
|
||||||
|
</resources>
|
Loading…
Reference in a new issue