Commit 085db4a2 authored by Ignacio García's avatar Ignacio García Committed by Hussein

P4A-880 Impove UX of delete message behaviour.

On App settings -> Interaction the app behaviour after deleting a
message can be defined but it is contradictive, because of this we made
the two option mutually excluyent.

P4A-880 Add new preference category for After message delete behavior.

P4A-880 Add mutually excluyent setter in K9 class.

P4A-880 remove default values from xml in order to keep consistency.

P4A-880 change default value in K9.

P4A-880 cleanup.

P4A-880 Fix nullability of Preferences.

P4A-880 Reformat code.

P4A-880 Add preference category

Improve code in GeneralSettingsFragment
parent cc9d53a0
This diff is collapsed.
......@@ -5,6 +5,7 @@ import android.app.AlertDialog
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.preference.CheckBoxPreference
import androidx.preference.MultiSelectListPreference
import androidx.preference.Preference
import com.fsck.k9.BuildConfig
......@@ -43,6 +44,7 @@ class GeneralSettingsFragment : PreferenceFragmentCompat() {
initializeNotificationQuickDelete()
initializeExtraKeysManagement()
initializeGlobalpEpKeyReset()
initializeAfterMessageDeleteBehavior()
if (!BuildConfig.WITH_KEY_SYNC) {
hideKeySyncOptions()
......@@ -130,6 +132,22 @@ class GeneralSettingsFragment : PreferenceFragmentCompat() {
}
}
private fun initializeAfterMessageDeleteBehavior() {
val returnToList: CheckBoxPreference? = findPreference(MESSAGEVIEW_RETURN_TO_LIST) as? CheckBoxPreference
val showNextMsg: CheckBoxPreference? = findPreference(MESSAGEVIEW_SHOW_NEXT_MSG) as? CheckBoxPreference
returnToList?.setOnPreferenceChangeListener { _, check ->
showNextMsg?.isChecked = !(check as Boolean)
true
}
showNextMsg?.setOnPreferenceChangeListener { _, check ->
returnToList?.isChecked = !(check as Boolean)
true
}
}
private fun dopEpKeyReset() {
disableKeyResetClickListener()
loading?.visibility = View.VISIBLE
......@@ -194,6 +212,8 @@ class GeneralSettingsFragment : PreferenceFragmentCompat() {
private const val PREFERENCE_PEP_EXTRA_KEYS = "pep_extra_keys"
private const val PREFERENCE_PEP_OWN_IDS_KEY_RESET = "pep_key_reset"
private const val PREFERENCE_PEP_ENABLE_SYNC = "pep_enable_sync"
private const val MESSAGEVIEW_RETURN_TO_LIST = "messageview_return_to_list"
private const val MESSAGEVIEW_SHOW_NEXT_MSG = "messageview_show_next"
fun create(rootKey: String? = null) = GeneralSettingsFragment().withArguments(
......
......@@ -328,6 +328,7 @@
<string name="global_settings_messageview_return_to_list_summary">Return to message list after message deletion</string>
<string name="global_settings_messageview_show_next_label">Show next message after delete</string>
<string name="global_settings_messageview_show_next_summary">Show next message by default after message deletion</string>
<string name="global_settings_messageiew_after_delete_behavior_title">After message deleted behavior</string>
<string name="global_settings_confirm_actions_title">Confirm actions</string>
<string name="global_settings_confirm_actions_summary">Show a dialog whenever you perform selected actions</string>
......
<?xml version="1.0" encoding="utf-8"?>
<!--suppress AndroidElementNotAllowed -->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?><!--suppress AndroidElementNotAllowed -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/general_settings_title">
......@@ -198,8 +196,8 @@
android:title="@string/global_settings_messageview_autofit_width_label" />
<PreferenceCategory
android:key="message_view_advanced"
app:initialExpandedChildrenCount="0"
app:allowDividerAbove="false">
app:allowDividerAbove="false"
app:initialExpandedChildrenCount="0">
<CheckBoxPreference
android:key="messageview_fixedwidth_font"
android:summary="@string/global_settings_messageview_fixedwidth_summary"
......@@ -228,28 +226,32 @@
android:key="volume_navigation"
android:title="@string/volume_navigation_title" />
<CheckBoxPreference
android:key="messageview_return_to_list"
android:summary="@string/global_settings_messageview_return_to_list_summary"
android:title="@string/global_settings_messageview_return_to_list_label" />
<PreferenceCategory android:title="@string/global_settings_messageiew_after_delete_behavior_title">
<CheckBoxPreference
android:key="messageview_return_to_list"
android:summary="@string/global_settings_messageview_return_to_list_summary"
android:title="@string/global_settings_messageview_return_to_list_label" />
<CheckBoxPreference
android:key="messageview_show_next"
android:summary="@string/global_settings_messageview_show_next_summary"
android:title="@string/global_settings_messageview_show_next_label" />
<CheckBoxPreference
android:key="messageview_show_next"
android:summary="@string/global_settings_messageview_show_next_summary"
android:title="@string/global_settings_messageview_show_next_label" />
</PreferenceCategory>
<MultiSelectListPreference
android:dialogTitle="@string/global_settings_confirm_actions_title"
android:entries="@array/confirm_action_entries"
android:entryValues="@array/confirm_action_values"
android:key="confirm_actions"
android:summary="@string/global_settings_confirm_actions_summary"
android:title="@string/global_settings_confirm_actions_title" />
<PreferenceCategory>
<MultiSelectListPreference
android:dialogTitle="@string/global_settings_confirm_actions_title"
android:entries="@array/confirm_action_entries"
android:entryValues="@array/confirm_action_values"
android:key="confirm_actions"
android:summary="@string/global_settings_confirm_actions_summary"
android:title="@string/global_settings_confirm_actions_title" />
</PreferenceCategory>
<PreferenceCategory
android:key="advanced_interaction_preferences"
app:initialExpandedChildrenCount="0"
app:allowDividerAbove="false">
app:allowDividerAbove="false"
app:initialExpandedChildrenCount="0">
<CheckBoxPreference
android:key="start_integrated_inbox"
android:title="@string/start_integrated_inbox_title" />
......@@ -258,9 +260,9 @@
</PreferenceScreen>
<PreferenceScreen
android:title="@string/notifications_title"
android:icon="?attr/iconPreferencesNotifications"
android:key="notification_preferences">
android:key="notification_preferences"
android:title="@string/notifications_title">
<CheckBoxPreference
android:key="quiet_time_enabled"
......@@ -306,8 +308,8 @@
</PreferenceScreen>
<PreferenceScreen
android:key="pep_global"
android:icon="?attr/iconpEpShield"
android:key="pep_global"
android:title="@string/privacy_preferences">
<!--<EditTextPreference-->
......@@ -337,23 +339,22 @@
<Preference
android:key="pep_key_reset"
android:title="@string/reset"
android:summary="@string/pep_key_reset_all_own_ids_summary"/>
android:summary="@string/pep_key_reset_all_own_ids_summary"
android:title="@string/reset" />
<Preference
android:persistent="false"
android:key="pep_extra_keys"
android:persistent="false"
android:singleLine="true"
android:title="@string/master_key_management"
android:summary="Encrypt messages with additional keys.">
</Preference>
android:summary="Encrypt messages with additional keys."
android:title="@string/master_key_management"/>
<SwitchPreferenceCompat
android:key="pep_enable_sync"
android:title="@string/pep_sync"
android:summaryOff="@string/pep_sync_is_disabled_global"
android:summaryOn="@string/pep_sync_is_enabled_global"
android:summaryOff="@string/pep_sync_is_disabled_global" />
android:title="@string/pep_sync" />
<PreferenceCategory
android:key="pep_gpg_compatibility"
......@@ -367,7 +368,6 @@
android:title="@string/pep_subject_unprotected" />
<Preference
android:key="pep_gpg_blacklist"
android:title="Blacklist">
......@@ -417,8 +417,6 @@
<!--/>-->
<!--Preference
android:key="pep_manage_keysync"
android:persistent="false"
......@@ -441,12 +439,12 @@
</PreferenceScreen>
<PreferenceScreen
android:icon="@drawable/ic_advanced_light"
android:key="advanced_preferences"
android:title="@string/advanced"
android:icon="@drawable/ic_advanced_light">
android:title="@string/advanced">
<PreferenceCategory
android:title="@string/miscellaneous_preferences"
android:key="misc_preferences">
android:key="misc_preferences"
android:title="@string/miscellaneous_preferences">
<Preference
android:key="attachment_default_path"
......@@ -468,8 +466,8 @@
android:title="@string/debug_preferences">
<CheckBoxPreference
android:key="debug_logging"
android:icon="?attr/iconPreferencesDebug"
android:key="debug_logging"
android:summary="@string/debug_enable_debug_logging_summary"
android:title="@string/debug_enable_debug_logging_title" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment