mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
benene 2
This commit is contained in:
parent
bb9c75de6d
commit
bb2f8a3e56
2 changed files with 42 additions and 27 deletions
|
@ -14,8 +14,8 @@ import com.lagradost.cloudstream3.utils.InAppUpdater.Companion.runAutoUpdate
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import java.lang.Exception
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import kotlin.Exception
|
||||||
import kotlin.concurrent.thread
|
import kotlin.concurrent.thread
|
||||||
|
|
||||||
class SettingsFragment : PreferenceFragmentCompat() {
|
class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
|
@ -61,22 +61,32 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
|
||||||
|
|
||||||
count = settingsManager.getInt(getString(R.string.benene_count), 0)
|
|
||||||
usernameUUID = settingsManager.getString(getString(R.string.benene_count_uuid), UUID.randomUUID().toString())
|
|
||||||
|
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
setPreferencesFromResource(R.xml.settings, rootKey)
|
setPreferencesFromResource(R.xml.settings, rootKey)
|
||||||
val updatePrefrence = findPreference<Preference>(getString(R.string.manual_check_update_key))!!
|
val updatePrefrence = findPreference<Preference>(getString(R.string.manual_check_update_key))!!
|
||||||
|
|
||||||
val benenePref = findPreference<Preference>(getString(R.string.benene_count))!!
|
val benenePref = findPreference<Preference>(getString(R.string.benene_count))!!
|
||||||
|
if (ScoreManager.privateCode.isNullOrBlank()) {
|
||||||
|
benenePref.isVisible = false
|
||||||
|
} else {
|
||||||
|
benenePref.isVisible = true
|
||||||
|
try {
|
||||||
|
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
|
||||||
|
count = settingsManager.getInt(getString(R.string.benene_count), 0)
|
||||||
|
usernameUUID =
|
||||||
|
settingsManager.getString(getString(R.string.benene_count_uuid), UUID.randomUUID().toString())
|
||||||
if (count > 20) {
|
if (count > 20) {
|
||||||
thread {
|
thread {
|
||||||
scoreboard = normalSafeApiCall { ScoreManager.getScore() }
|
scoreboard = normalSafeApiCall { ScoreManager.getScore() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
benenePref.summary = if(count <= 0) getString(R.string.benene_count_text_none) else getString(R.string.benene_count_text).format(count)
|
benenePref.summary =
|
||||||
|
if (count <= 0) getString(R.string.benene_count_text_none) else getString(R.string.benene_count_text).format(
|
||||||
|
count
|
||||||
|
)
|
||||||
benenePref.setOnPreferenceClickListener {
|
benenePref.setOnPreferenceClickListener {
|
||||||
try {
|
try {
|
||||||
count++
|
count++
|
||||||
|
@ -99,6 +109,11 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
return@setOnPreferenceClickListener true
|
return@setOnPreferenceClickListener true
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
updatePrefrence.setOnPreferenceClickListener {
|
updatePrefrence.setOnPreferenceClickListener {
|
||||||
thread {
|
thread {
|
||||||
|
|
Loading…
Reference in a new issue