Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set singleLineTitle=false for all preferences via theme #4852

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ class AccountPreferencesFragment : PreferenceFragmentCompat() {
setEntries(R.array.post_privacy_names)
setEntryValues(R.array.post_privacy_values)
key = PrefKeys.DEFAULT_POST_PRIVACY
isSingleLineTitle = false
setSummaryProvider { entry }
val visibility = accountManager.activeAccount?.defaultPostPrivacy ?: Status.Visibility.PUBLIC
value = visibility.stringValue
Expand All @@ -196,7 +195,6 @@ class AccountPreferencesFragment : PreferenceFragmentCompat() {
setEntries(R.array.reply_privacy_names)
setEntryValues(R.array.reply_privacy_values)
key = PrefKeys.DEFAULT_REPLY_PRIVACY
isSingleLineTitle = false
setSummaryProvider { entry }
val visibility = activeAccount.defaultReplyPrivacy
value = visibility.stringValue
Expand Down Expand Up @@ -232,7 +230,6 @@ class AccountPreferencesFragment : PreferenceFragmentCompat() {
).toTypedArray()
entryValues = (listOf("") + locales.map { it.language }).toTypedArray()
key = PrefKeys.DEFAULT_POST_LANGUAGE
isSingleLineTitle = false
icon = icon(GoogleMaterial.Icon.gmd_translate)
value = accountManager.activeAccount?.defaultPostLanguage.orEmpty()
isPersistent = false // This will be entirely server-driven
Expand All @@ -248,7 +245,6 @@ class AccountPreferencesFragment : PreferenceFragmentCompat() {
setTitle(R.string.pref_default_media_sensitivity)
icon = icon(R.drawable.ic_eye_24dp)
key = PrefKeys.DEFAULT_MEDIA_SENSITIVITY
isSingleLineTitle = false
val sensitivity = accountManager.activeAccount?.defaultMediaSensitivity == true
setDefaultValue(sensitivity)
icon = getIconForSensitivity(sensitivity)
Expand All @@ -267,21 +263,18 @@ class AccountPreferencesFragment : PreferenceFragmentCompat() {
switchPreference {
key = PrefKeys.MEDIA_PREVIEW_ENABLED
setTitle(R.string.pref_title_show_media_preview)
isSingleLineTitle = false
preferenceDataStore = accountPreferenceDataStore
}

switchPreference {
key = PrefKeys.ALWAYS_SHOW_SENSITIVE_MEDIA
setTitle(R.string.pref_title_alway_show_sensitive_media)
isSingleLineTitle = false
preferenceDataStore = accountPreferenceDataStore
}

switchPreference {
key = PrefKeys.ALWAYS_OPEN_SPOILER
setTitle(R.string.pref_title_alway_open_spoiler)
isSingleLineTitle = false
preferenceDataStore = accountPreferenceDataStore
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ class PreferencesFragment : PreferenceFragmentCompat() {
key = PrefKeys.SHOW_SELF_USERNAME
setSummaryProvider { entry }
setTitle(R.string.pref_title_show_self_username)
isSingleLineTitle = false
}

switchPreference {
Expand All @@ -159,85 +158,73 @@ class PreferencesFragment : PreferenceFragmentCompat() {
setDefaultValue(true)
key = PrefKeys.SHOW_NOTIFICATIONS_FILTER
setTitle(R.string.pref_title_show_notifications_filter)
isSingleLineTitle = false
}

switchPreference {
setDefaultValue(false)
key = PrefKeys.ABSOLUTE_TIME_VIEW
setTitle(R.string.pref_title_absolute_time)
isSingleLineTitle = false
}

switchPreference {
setDefaultValue(true)
key = PrefKeys.SHOW_BOT_OVERLAY
setTitle(R.string.pref_title_bot_overlay)
isSingleLineTitle = false
icon = icon(R.drawable.ic_bot_24dp)
}

switchPreference {
setDefaultValue(false)
key = PrefKeys.ANIMATE_GIF_AVATARS
setTitle(R.string.pref_title_animate_gif_avatars)
isSingleLineTitle = false
}

switchPreference {
setDefaultValue(false)
key = PrefKeys.ANIMATE_CUSTOM_EMOJIS
setTitle(R.string.pref_title_animate_custom_emojis)
isSingleLineTitle = false
}

switchPreference {
setDefaultValue(true)
key = PrefKeys.USE_BLURHASH
setTitle(R.string.pref_title_gradient_for_media)
isSingleLineTitle = false
}

switchPreference {
setDefaultValue(false)
key = PrefKeys.SHOW_CARDS_IN_TIMELINES
setTitle(R.string.pref_title_show_cards_in_timelines)
isSingleLineTitle = false
}

switchPreference {
setDefaultValue(true)
key = PrefKeys.CONFIRM_REBLOGS
setTitle(R.string.pref_title_confirm_reblogs)
isSingleLineTitle = false
}

switchPreference {
setDefaultValue(false)
key = PrefKeys.CONFIRM_FAVOURITES
setTitle(R.string.pref_title_confirm_favourites)
isSingleLineTitle = false
}

switchPreference {
setDefaultValue(false)
key = PrefKeys.CONFIRM_FOLLOWS
setTitle(R.string.pref_title_confirm_follows)
isSingleLineTitle = false
}

switchPreference {
setDefaultValue(true)
key = PrefKeys.ENABLE_SWIPE_FOR_TABS
setTitle(R.string.pref_title_enable_swipe_for_tabs)
isSingleLineTitle = false
}

switchPreference {
setDefaultValue(false)
key = PrefKeys.SHOW_STATS_INLINE
setTitle(R.string.pref_title_show_stat_inline)
isSingleLineTitle = false
}
}

Expand All @@ -246,7 +233,6 @@ class PreferencesFragment : PreferenceFragmentCompat() {
setDefaultValue(false)
key = PrefKeys.CUSTOM_TABS
setTitle(R.string.pref_title_custom_tabs)
isSingleLineTitle = false
}
}

Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,16 @@

<style name="TuskyPreferenceTheme" parent="@style/PreferenceThemeOverlay">
<item name="switchPreferenceCompatStyle">@style/TuskySwitchPreference</item>
<item name="dialogPreferenceStyle">@style/TuskyDialogPreference</item>
</style>

<style name="TuskyDialogPreference" parent="@style/Preference.DialogPreference.Material">
<item name="singleLineTitle">false</item>
</style>

<style name="TuskySwitchPreference" parent="@style/Preference.SwitchPreferenceCompat.Material">
<item name="widgetLayout">@layout/preference_material_switch</item>
<item name="singleLineTitle">false</item>
</style>

<style name="TuskyImageButton" parent="@style/Widget.MaterialComponents.Button.UnelevatedButton">
Expand Down
Loading