2022-06-07 16:12:59 +05:30
|
|
|
package com.github.libretube.preferences
|
|
|
|
|
|
|
|
import android.os.Bundle
|
2022-06-07 23:46:58 +05:30
|
|
|
import android.widget.TextView
|
2022-06-07 16:12:59 +05:30
|
|
|
import androidx.preference.Preference
|
|
|
|
import androidx.preference.PreferenceFragmentCompat
|
|
|
|
import androidx.preference.PreferenceManager
|
|
|
|
import com.github.libretube.R
|
|
|
|
|
2022-06-07 20:22:06 +05:30
|
|
|
class AdvancedSettings : PreferenceFragmentCompat() {
|
|
|
|
val TAG = "AdvancedSettings"
|
2022-06-09 17:52:07 +05:30
|
|
|
|
2022-06-07 16:12:59 +05:30
|
|
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
2022-06-07 20:22:06 +05:30
|
|
|
setPreferencesFromResource(R.xml.advanced_settings, rootKey)
|
|
|
|
|
2022-06-08 00:52:35 +05:30
|
|
|
val topBarTextView = activity?.findViewById<TextView>(R.id.topBar_textView)
|
|
|
|
topBarTextView?.text = getString(R.string.advanced)
|
2022-06-07 23:46:58 +05:30
|
|
|
|
2022-06-07 20:22:06 +05:30
|
|
|
val clearHistory = findPreference<Preference>("clear_history")
|
|
|
|
clearHistory?.setOnPreferenceClickListener {
|
|
|
|
val sharedPreferences =
|
|
|
|
PreferenceManager.getDefaultSharedPreferences(requireContext())
|
|
|
|
sharedPreferences.edit().remove("search_history").commit()
|
|
|
|
true
|
|
|
|
}
|
2022-06-07 16:12:59 +05:30
|
|
|
}
|
2022-06-07 16:14:22 +05:30
|
|
|
}
|