0
0
mirror of https://github.com/thunderbird/thunderbird-android.git synced 2024-09-20 12:12:15 +02:00

Add setting for message list density

This commit is contained in:
cketti 2023-02-23 15:23:23 +01:00
parent 4988d3db61
commit 30c4f94b30
9 changed files with 46 additions and 1 deletions

View File

@ -152,6 +152,9 @@ object K9 : EarlyInit {
@JvmStatic
var lockScreenNotificationVisibility = LockScreenNotificationVisibility.MESSAGE_COUNT
@JvmStatic
var messageListDensity: UiDensity = UiDensity.Default
@JvmStatic
var isShowMessageListStars = true
@ -320,6 +323,7 @@ object K9 : EarlyInit {
quietTimeStarts = storage.getString("quietTimeStarts", "21:00")
quietTimeEnds = storage.getString("quietTimeEnds", "7:00")
messageListDensity = storage.getEnum("messageListDensity", UiDensity.Default)
isShowCorrespondentNames = storage.getBoolean("showCorrespondentNames", true)
isShowContactName = storage.getBoolean("showContactName", false)
isShowContactPicture = storage.getBoolean("showContactPicture", true)
@ -388,6 +392,7 @@ object K9 : EarlyInit {
editor.putString("quietTimeStarts", quietTimeStarts)
editor.putString("quietTimeEnds", quietTimeEnds)
editor.putEnum("messageListDensity", messageListDensity)
editor.putBoolean("messageListSenderAboveSubject", isMessageListSenderAboveSubject)
editor.putBoolean("showUnifiedInbox", isShowUnifiedInbox)
editor.putBoolean("showStarredCount", isShowStarredCount)

View File

@ -0,0 +1,7 @@
package com.fsck.k9
enum class UiDensity {
Compact,
Default,
Relaxed,
}

View File

@ -20,6 +20,7 @@ import com.fsck.k9.K9.BACKGROUND_OPS;
import com.fsck.k9.K9.NotificationQuickDelete;
import com.fsck.k9.K9.SplitViewMode;
import com.fsck.k9.SwipeAction;
import com.fsck.k9.UiDensity;
import com.fsck.k9.core.R;
import com.fsck.k9.preferences.Settings.BooleanSetting;
import com.fsck.k9.preferences.Settings.ColorSetting;
@ -274,6 +275,9 @@ public class GeneralSettingsDescriptions {
s.put("showComposeButtonOnMessageList", Settings.versions(
new V(85, new BooleanSetting(true))
));
s.put("messageListDensity", Settings.versions(
new V(86, new EnumSetting(UiDensity.class, UiDensity.Default))
));
SETTINGS = Collections.unmodifiableMap(s);

View File

@ -36,7 +36,7 @@ public class Settings {
*
* @see SettingsExporter
*/
public static final int VERSION = 85;
public static final int VERSION = 86;
static Map<String, Object> validate(int version, Map<String, TreeMap<Integer, SettingsDescription>> settings,
Map<String, String> importedSettings, boolean useDefaultValues) {

View File

@ -3,6 +3,7 @@ package com.fsck.k9.ui.settings.general
import androidx.preference.PreferenceDataStore
import com.fsck.k9.K9
import com.fsck.k9.SwipeAction
import com.fsck.k9.UiDensity
import com.fsck.k9.job.K9JobManager
import com.fsck.k9.preferences.AppTheme
import com.fsck.k9.preferences.GeneralSettingsManager
@ -123,6 +124,7 @@ class GeneralSettingsDataStore(
"message_compose_input_font" -> K9.fontSizes.messageComposeInput.toString()
"swipe_action_right" -> swipeActionToString(K9.swipeRightAction)
"swipe_action_left" -> swipeActionToString(K9.swipeLeftAction)
"message_list_density" -> K9.messageListDensity.toString()
else -> defValue
}
}
@ -157,6 +159,7 @@ class GeneralSettingsDataStore(
"message_compose_input_font" -> K9.fontSizes.messageComposeInput = value.toInt()
"swipe_action_right" -> K9.swipeRightAction = stringToSwipeAction(value)
"swipe_action_left" -> K9.swipeLeftAction = stringToSwipeAction(value)
"message_list_density" -> K9.messageListDensity = UiDensity.valueOf(value)
else -> return
}

View File

@ -92,4 +92,10 @@
<item>22</item>
</string-array>
<string-array name="message_list_density_values">
<item>Compact</item>
<item>Default</item>
<item>Relaxed</item>
</string-array>
</resources>

View File

@ -168,4 +168,10 @@
<item>@string/general_settings_swipe_action_move</item>
</string-array>
<string-array name="message_list_density_entries">
<item>@string/general_settings_ui_density_compact</item>
<item>@string/general_settings_ui_density_default</item>
<item>@string/general_settings_ui_density_relaxed</item>
</string-array>
</resources>

View File

@ -336,6 +336,12 @@ Please submit bug reports, contribute new features and ask questions at
<!-- Name of the swipe action to move a message to another folder -->
<string name="general_settings_swipe_action_move">Move</string>
<!-- Title of the setting to specify the density of the message list -->
<string name="general_settings_message_list_density_title">Density</string>
<string name="general_settings_ui_density_compact">Compact</string>
<string name="general_settings_ui_density_default">Default</string>
<string name="general_settings_ui_density_relaxed">Relaxed</string>
<string name="global_settings_privacy_hide_useragent">Hide mail client</string>
<string name="global_settings_privacy_hide_useragent_detail">Remove K-9 User-Agent from mail headers</string>
<string name="global_settings_privacy_hide_timezone">Hide timezone</string>

View File

@ -186,6 +186,14 @@
android:key="messagelist_preferences"
android:title="@string/messagelist_preferences">
<ListPreference
android:dialogTitle="@string/general_settings_message_list_density_title"
android:entries="@array/message_list_density_entries"
android:entryValues="@array/message_list_density_values"
android:key="message_list_density"
app:useSimpleSummaryProvider="true"
android:title="@string/general_settings_message_list_density_title" />
<ListPreference
android:dialogTitle="@string/global_settings_preview_lines_label"
android:entries="@array/preview_lines_entries"