fennec/nightly
parent
f93437c509
commit
0777fb3bbe
@ -0,0 +1,43 @@
|
||||
/* 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.logins
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.showToolbar
|
||||
import org.mozilla.fenix.settings.RadioButtonPreference
|
||||
|
||||
class SaveLoginSettingFragment : PreferenceFragmentCompat() {
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.save_logins_preferences, rootKey)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
showToolbar(getString(R.string.preferences_passwords_save_logins))
|
||||
val save = bindSave()
|
||||
val neverSave = bindNeverSave()
|
||||
setupRadioGroups(save, neverSave)
|
||||
}
|
||||
|
||||
private fun bindSave(): RadioButtonPreference {
|
||||
val keyStrict = getString(R.string.pref_key_save_logins)
|
||||
return requireNotNull(findPreference(keyStrict))
|
||||
}
|
||||
|
||||
private fun bindNeverSave(): RadioButtonPreference {
|
||||
val keyStandard = getString(R.string.pref_key_never_save_logins)
|
||||
return requireNotNull(findPreference(keyStandard))
|
||||
}
|
||||
|
||||
private fun setupRadioGroups(
|
||||
radioNeverSave: RadioButtonPreference,
|
||||
radioSave: RadioButtonPreference
|
||||
) {
|
||||
radioNeverSave.addToRadioGroup(radioSave)
|
||||
radioSave.addToRadioGroup(radioNeverSave)
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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/. -->
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<org.mozilla.fenix.settings.RadioButtonPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/pref_key_save_logins"
|
||||
android:title="@string/preferences_passwords_save_logins_ask_to_save" />
|
||||
<org.mozilla.fenix.settings.RadioButtonPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_key_never_save_logins"
|
||||
android:title="@string/preferences_passwords_save_logins_never_save" />
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue