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
|
||||
version = 6
|
||||
version = 7
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.widget.ImageView
|
|||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.openBrowser
|
||||
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.utils.UIHelper.colorFromAttribute
|
||||
|
||||
const val packageName = "com.lagradost"
|
||||
|
||||
class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi) :
|
||||
BottomSheetDialogFragment() {
|
||||
|
@ -27,40 +27,24 @@ class NginxSettingsFragment(private val plugin: Plugin, val nginxApi: NginxApi)
|
|||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
// 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)
|
||||
return inflater.inflate(layout, container, false)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
private fun getString(name: String): String {
|
||||
val id = maxOf(
|
||||
// Fuck it lets see if any works
|
||||
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)
|
||||
private fun getString(name: String): String? {
|
||||
val id = plugin.resources!!.getIdentifier(name, "string", BuildConfig.LIBRARY_PACKAGE_NAME)
|
||||
return plugin.resources!!.getString(id)
|
||||
}
|
||||
|
||||
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")
|
||||
infoSubTextView.text = getString("nginx_info_summary")
|
||||
infoImageView.setImageDrawable(
|
||||
getDrawable("nginx_question")
|
||||
)
|
||||
infoImageView.setImageDrawable(getDrawable("nginx_question"))
|
||||
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 loginTextView = view.findView<TextView>("main_text")
|
||||
val loginImageView = view.findView<ImageView>("nginx_login_imageview")
|
||||
loginImageView.setImageDrawable(getDrawable("nginx"))
|
||||
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
|
||||
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