Hide folder poll class and folder notification class preferences for local folders

This commit is contained in:
plan3d 2021-04-17 10:11:57 +02:00
parent 27e6dc9d84
commit 9558dec197

View file

@ -6,6 +6,7 @@ import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.navigation.fragment.findNavController
import androidx.preference.ListPreference
import androidx.preference.Preference
import com.fsck.k9.fragment.ConfirmationDialogFragment
import com.fsck.k9.fragment.ConfirmationDialogFragment.ConfirmationDialogFragmentListener
@ -77,6 +78,7 @@ class FolderSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFra
setCategoryTitle(folderSettings)
updateMenu()
setPreferenceVisibility(folderSettings)
}
private fun updateMenu() {
@ -106,6 +108,13 @@ class FolderSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFra
dialogFragment.show(requireFragmentManager(), TAG_CLEAR_FOLDER_CONFIRMATION)
}
private fun setPreferenceVisibility(folderSettings: FolderSettingsData) {
val syncModePreference = findPreference<ListPreference>("folder_settings_folder_sync_mode")
syncModePreference?.setVisible(!folderSettings.folder.isLocalOnly)
val notifyModePreference = findPreference<ListPreference>("folder_settings_folder_notify_mode")
notifyModePreference?.setVisible(!folderSettings.folder.isLocalOnly)
}
override fun doPositiveClick(dialogId: Int) {
when (dialogId) {
DIALOG_CLEAR_FOLDER -> {