LibreTube/app/src/main/java/com/github/libretube/Settings.kt

27 lines
923 B
Kotlin
Raw Normal View History

2022-02-08 14:58:50 +05:30
package com.github.libretube
import android.os.Bundle
2022-02-08 19:57:13 +05:30
import android.util.Log
import androidx.preference.ListPreference
import androidx.preference.Preference
2022-02-08 14:58:50 +05:30
import androidx.preference.PreferenceFragmentCompat
2022-02-08 19:57:13 +05:30
import androidx.preference.SwitchPreferenceCompat
2022-02-08 14:58:50 +05:30
class Settings : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.settings, rootKey)
2022-02-08 19:57:13 +05:30
val instance = findPreference<ListPreference>("instance")
instance?.setOnPreferenceChangeListener { preference, newValue ->
RetrofitInstance.url=newValue.toString()
true
}
val login = findPreference<Preference>("login_register")
login?.setOnPreferenceClickListener {
val newFragment = LoginDialog()
newFragment.show(childFragmentManager,"fuck")
true
}
2022-02-08 14:58:50 +05:30
}
}