forked from recloudstream/cloudstream
benene 3
This commit is contained in:
parent
bb2f8a3e56
commit
3e3e1b6a9d
1 changed files with 48 additions and 48 deletions
|
@ -35,6 +35,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
}
|
||||
|
||||
private fun saveAndUpload() {
|
||||
if (ScoreManager.privateCode.isNullOrBlank()) return
|
||||
try {
|
||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val uuid = usernameUUID
|
||||
if (uuid != null) {
|
||||
|
@ -48,6 +50,9 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
@ -61,17 +66,12 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
|
||||
|
||||
hideKeyboard()
|
||||
setPreferencesFromResource(R.xml.settings, rootKey)
|
||||
val updatePrefrence = findPreference<Preference>(getString(R.string.manual_check_update_key))!!
|
||||
|
||||
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)
|
||||
|
||||
|
@ -79,10 +79,12 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
usernameUUID =
|
||||
settingsManager.getString(getString(R.string.benene_count_uuid), UUID.randomUUID().toString())
|
||||
if (count > 20) {
|
||||
if (!ScoreManager.privateCode.isNullOrBlank()) {
|
||||
thread {
|
||||
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
|
||||
|
@ -112,8 +114,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updatePrefrence.setOnPreferenceClickListener {
|
||||
thread {
|
||||
|
|
Loading…
Reference in a new issue