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-09 23:40:39 +05:30
|
|
|
import okhttp3.HttpUrl
|
|
|
|
import retrofit2.Retrofit
|
|
|
|
import retrofit2.converter.jackson.JacksonConverterFactory
|
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()
|
2022-02-09 23:40:39 +05:30
|
|
|
RetrofitInstance.lazyMgr.reset()
|
2022-02-08 19:57:13 +05:30
|
|
|
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
|
|
|
}
|
|
|
|
}
|