You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.7 KiB
Kotlin
50 lines
1.7 KiB
Kotlin
4 years ago
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||
|
|
||
|
package org.mozilla.fenix.settings
|
||
|
|
||
|
import android.os.Bundle
|
||
|
import androidx.preference.PreferenceFragmentCompat
|
||
|
import org.mozilla.fenix.R
|
||
|
import org.mozilla.fenix.ext.showToolbar
|
||
|
import org.mozilla.fenix.utils.view.addToRadioGroup
|
||
|
|
||
|
/**
|
||
|
* Lets the user customize auto closing tabs.
|
||
|
*/
|
||
4 years ago
|
class TabsSettingsFragment : PreferenceFragmentCompat() {
|
||
4 years ago
|
private lateinit var radioManual: RadioButtonPreference
|
||
|
private lateinit var radioOneDay: RadioButtonPreference
|
||
|
private lateinit var radioOneWeek: RadioButtonPreference
|
||
|
private lateinit var radioOneMonth: RadioButtonPreference
|
||
|
|
||
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||
4 years ago
|
setPreferencesFromResource(R.xml.tabs_preferences, rootKey)
|
||
4 years ago
|
}
|
||
|
|
||
|
override fun onResume() {
|
||
|
super.onResume()
|
||
4 years ago
|
showToolbar(getString(R.string.preferences_tabs))
|
||
4 years ago
|
setupPreferences()
|
||
|
}
|
||
|
|
||
|
private fun setupPreferences() {
|
||
|
radioManual = requirePreference(R.string.pref_key_close_tabs_manually)
|
||
|
radioOneDay = requirePreference(R.string.pref_key_close_tabs_after_one_day)
|
||
|
radioOneWeek = requirePreference(R.string.pref_key_close_tabs_after_one_week)
|
||
|
radioOneMonth = requirePreference(R.string.pref_key_close_tabs_after_one_month)
|
||
4 years ago
|
|
||
4 years ago
|
setupRadioGroups()
|
||
|
}
|
||
|
|
||
|
private fun setupRadioGroups() {
|
||
|
addToRadioGroup(
|
||
|
radioManual,
|
||
|
radioOneDay,
|
||
|
radioOneMonth,
|
||
|
radioOneWeek
|
||
|
)
|
||
|
}
|
||
|
}
|