2020-06-08 09:21:12 +02:00
|
|
|
package com.keylesspalace.tusky.settings
|
|
|
|
|
|
|
|
enum class AppTheme(val value: String) {
|
|
|
|
NIGHT("night"),
|
|
|
|
DAY("day"),
|
|
|
|
BLACK("black"),
|
|
|
|
AUTO("auto"),
|
|
|
|
AUTO_SYSTEM("auto_system");
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
fun stringValues() = values().map { it.value }.toTypedArray()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-25 21:22:49 +01:00
|
|
|
/**
|
|
|
|
* Current preferences schema version. Format is 4-digit year + 2 digit month (zero padded) + 2
|
|
|
|
* digit day (zero padded) + 2 digit counter (zero padded).
|
|
|
|
*
|
|
|
|
* If you make an incompatible change to the preferences schema you must:
|
|
|
|
*
|
|
|
|
* - Update this value
|
|
|
|
* - Update the code in
|
|
|
|
* [TuskyApplication.upgradeSharedPreferences][com.keylesspalace.tusky.TuskyApplication.upgradeSharedPreferences]
|
|
|
|
* to migrate from the old schema version to the new schema version.
|
|
|
|
*
|
|
|
|
* An incompatible change is:
|
|
|
|
*
|
|
|
|
* - Deleting a preference. The migration should delete the old preference.
|
|
|
|
* - Changing a preference's default value (e.g., from true to false, or from one enum value to
|
|
|
|
* another). The migration should check to see if the user had set an explicit value for
|
|
|
|
* that preference ([SharedPreferences.contains][android.content.SharedPreferences.contains]);
|
|
|
|
* if they hadn't then the migration should set the *old* default value as the preference's
|
|
|
|
* value, so the app behaviour does not unexpectedly change.
|
|
|
|
* - Changing a preference's type (e.g,. from a boolean to an enum). If you do this you may want
|
|
|
|
* to give the preference a different name, but you still need to migrate the user's previous
|
|
|
|
* preference value to the new preference.
|
|
|
|
* - Renaming a preference key. The migration should copy the user's previous value for the
|
|
|
|
* preference under the old key to the value for the new, and delete the old preference.
|
|
|
|
*
|
|
|
|
* A compatible change is:
|
|
|
|
*
|
|
|
|
* - Adding a new preference that does not change the interpretation of an existing preference
|
|
|
|
*/
|
2023-02-27 14:07:28 +01:00
|
|
|
const val SCHEMA_VERSION = 2023022701
|
2023-02-25 21:22:49 +01:00
|
|
|
|
2020-06-08 09:21:12 +02:00
|
|
|
object PrefKeys {
|
|
|
|
// Note: not all of these keys are actually used as SharedPreferences keys but we must give
|
|
|
|
// each preference a key for it to work.
|
|
|
|
|
2023-02-04 20:19:01 +01:00
|
|
|
const val SCHEMA_VERSION: String = "schema_version"
|
2020-06-08 09:21:12 +02:00
|
|
|
const val APP_THEME = "appTheme"
|
2020-09-02 12:27:51 +02:00
|
|
|
const val EMOJI = "selected_emoji_font"
|
2020-06-08 09:21:12 +02:00
|
|
|
const val FAB_HIDE = "fabHide"
|
|
|
|
const val LANGUAGE = "language"
|
|
|
|
const val STATUS_TEXT_SIZE = "statusTextSize"
|
Keep scroll position when loading missing statuses (#3000)
* Change "Load more" to load oldest statuses first in home timeline
Previous behaviour loaded missing statuses by using "since_id" and "max_id".
This loads the most recent N statuses, looking backwards from "max_id".
Change to load the oldest statuses first, assuming the user is scrolling
up through the timeline and will want to load statuses in reverse
chronological order.
* Scroll to the bottom of new entries added by "Load more"
- Remember the position of the "Load more" placeholder
- Check the position of inserted entries
- If they match, scroll to the bottom
* Change "Load more" to load oldest statuses first in home timeline
Previous behaviour loaded missing statuses by using "since_id" and "max_id".
This loads the most recent N statuses, looking backwards from "max_id".
Change to load the oldest statuses first, assuming the user is scrolling
up through the timeline and will want to load statuses in reverse
chronological order.
* Scroll to the bottom of new entries added by "Load more"
- Remember the position of the "Load more" placeholder
- Check the position of inserted entries
- If they match, scroll to the bottom
* Ensure the user can't have two simultaneous "Load more" coroutines
Having two simultanous coroutines would break the calculation used to figure
out which item in the list to scroll to after a "Load more" in the timeline.
Do this by:
- Creating a TimelineUiState and associated flow that tracks the "Load more"
state
- Updating this in the (Cached|Network)TimelineViewModel
- Listening for changes to it in TimelineFragment, and notifying the adapter
- The adapter will disable any placeholder views while "Load more" is active
* Revert changes that loaded the oldest statuses instead of the newest
* Be more robust about locating the status to scroll to
Weirdness with the PagingData library meant that positionStart could still be
wrong after "Load more" was clicked.
Instead, remember the position of the "Load more" item and the ID of the
status immediately after it.
When new items are added, search for the remembered status at the position of
the "Load more" item. This is quick, testing at most LOAD_AT_ONCE items in
the adapter.
If the remembered status is not visible on screen then scroll to it.
* Lint
* Add a preference to specify the reading order
Default behaviour (oldest first) is for "load more" to load statuses and
stay at the oldest of the new statuses.
Alternative behaviour (if the user is reading from top to bottom) is to
stay at the newest of the new statuses.
* Move ReadingOrder enum construction logic in to the enum
* Jump to top if swipe/refresh while preferring newest-first order
* Show a circular progress spinner during "Load more" operations
Remove a dedicated view, and use an icon on the button instead.
Adjust the placeholder attributes and styles accordingly.
* Remove the "loadMoreActive" property
Complicates the code and doesn't really achieve the desired effect. If the
user wants to tap multiple "Load more" buttons they can.
* Update comments in TimelineFragment
* Respect the user's reading order preference if it changes
* Add developer tools
This is for functionality that makes it easier for developers to interact
with the app, or get it in to a known-state.
These features are for use by users, so are only visible in debug builds.
* Adjust how content is loaded based on preferred reading order
- Add the readingOrder to TimelineViewModel so derived classes can use it.
- Update the homeTimeline API to support the `minId` parameter and update
calls in NetworkTimelineViewModel
In CachedTimelineViewModel:
- Set the bounds of the load to be the status IDs on either side of the
placeholder ID (update TimelineDao with a new query for this)
- Load statuses using either minId or sinceId depending on the reading order
- Is there was no overlap then insert the new placeholder at the start/end
of the list depending on reading order
* Lint
* Rename unused dialog parameter to _
* Update API arguments in tests
* Simplify ReadingOrder preference handling
* Fix bug with Placeholder and the "expanded" property
If a status is a Placeholder the "expanded" propery is used to indicate
whether or not it is loading.
replaceStatusRange() set this property based on the old value, and the user's
alwaysOpenSpoiler preference setting.
This shouldn't have been used if the status is a Placeholder, as it can lead
to incorrect loading states.
Fix this.
While I'm here, introduce an explicit computed property for whether a
TimelineStatusEntity is a placeholder, and use that for code clarity.
* Set the "Load more" button background to transparent
* Fix typo.
* Inline spec, update comment
* Revert 1480c6aa3ac5c0c2d362fb271f47ea2259ab14e2
Turns out the behaviour is not desired.
* Remove unnecessary Log call
* Extract function
* Change default to newest first
2023-01-13 19:26:24 +01:00
|
|
|
const val READING_ORDER = "readingOrder"
|
2020-06-18 11:04:53 +02:00
|
|
|
const val MAIN_NAV_POSITION = "mainNavPosition"
|
2020-08-16 10:01:51 +02:00
|
|
|
const val HIDE_TOP_TOOLBAR = "hideTopToolbar"
|
2020-06-08 09:21:12 +02:00
|
|
|
const val ABSOLUTE_TIME_VIEW = "absoluteTimeView"
|
|
|
|
const val SHOW_BOT_OVERLAY = "showBotOverlay"
|
|
|
|
const val ANIMATE_GIF_AVATARS = "animateGifAvatars"
|
|
|
|
const val USE_BLURHASH = "useBlurhash"
|
2022-10-18 19:38:17 +02:00
|
|
|
const val SHOW_SELF_USERNAME = "showSelfUsername"
|
2020-06-08 09:21:12 +02:00
|
|
|
const val SHOW_NOTIFICATIONS_FILTER = "showNotificationsFilter"
|
|
|
|
const val SHOW_CARDS_IN_TIMELINES = "showCardsInTimelines"
|
2020-08-08 10:03:07 +02:00
|
|
|
const val CONFIRM_REBLOGS = "confirmReblogs"
|
2021-10-04 07:48:44 +02:00
|
|
|
const val CONFIRM_FAVOURITES = "confirmFavourites"
|
2020-06-08 09:21:12 +02:00
|
|
|
const val ENABLE_SWIPE_FOR_TABS = "enableSwipeForTabs"
|
2021-02-06 08:14:51 +01:00
|
|
|
const val ANIMATE_CUSTOM_EMOJIS = "animateCustomEmojis"
|
2023-03-18 08:57:26 +01:00
|
|
|
const val SHOW_STATS_INLINE = "showStatsInline"
|
2021-08-03 17:16:40 +02:00
|
|
|
const val USE_QUICK_TOOT = "useQuickToot"
|
2020-06-08 09:21:12 +02:00
|
|
|
|
2020-06-19 07:40:57 +02:00
|
|
|
const val LIMITED_BANDWIDTH_ACTIVE = "limitedBandwidthActive"
|
|
|
|
const val LIMITED_BANDWIDTH_ONLY_MOBILE_NETWORK = "limitedBandwidthOnlyMobileNetwork"
|
|
|
|
const val LIMITED_BANDWIDTH_TIMELINE_LOADING = "limitedBandwidthTimelineLoading"
|
|
|
|
|
2020-06-08 09:21:12 +02:00
|
|
|
const val CUSTOM_TABS = "customTabs"
|
2020-12-23 19:13:37 +01:00
|
|
|
const val WELLBEING_LIMITED_NOTIFICATIONS = "wellbeingModeLimitedNotifications"
|
|
|
|
const val WELLBEING_HIDE_STATS_POSTS = "wellbeingHideStatsPosts"
|
|
|
|
const val WELLBEING_HIDE_STATS_PROFILE = "wellbeingHideStatsProfile"
|
2020-06-08 09:21:12 +02:00
|
|
|
|
|
|
|
const val HTTP_PROXY_ENABLED = "httpProxyEnabled"
|
|
|
|
const val HTTP_PROXY_SERVER = "httpProxyServer"
|
|
|
|
const val HTTP_PROXY_PORT = "httpProxyPort"
|
|
|
|
|
2020-06-19 07:40:57 +02:00
|
|
|
const val VIEW_PAGER_OFF_SCREEN_LIMIT = "viewPagerOffScreenLimit"
|
|
|
|
|
|
|
|
const val SEND_CRASH_REPORT = "sendCrashReport"
|
|
|
|
const val STACK_TRACE = "stackTrace"
|
|
|
|
|
2020-06-08 09:21:12 +02:00
|
|
|
const val DEFAULT_POST_PRIVACY = "defaultPostPrivacy"
|
2022-12-02 19:19:17 +01:00
|
|
|
const val DEFAULT_POST_LANGUAGE = "defaultPostLanguage"
|
2020-06-08 09:21:12 +02:00
|
|
|
const val DEFAULT_MEDIA_SENSITIVITY = "defaultMediaSensitivity"
|
|
|
|
const val MEDIA_PREVIEW_ENABLED = "mediaPreviewEnabled"
|
|
|
|
const val ALWAYS_SHOW_SENSITIVE_MEDIA = "alwaysShowSensitiveMedia"
|
|
|
|
const val ALWAYS_OPEN_SPOILER = "alwaysOpenSpoiler"
|
|
|
|
|
|
|
|
const val NOTIFICATIONS_ENABLED = "notificationsEnabled"
|
|
|
|
const val NOTIFICATION_ALERT_LIGHT = "notificationAlertLight"
|
|
|
|
const val NOTIFICATION_ALERT_VIBRATE = "notificationAlertVibrate"
|
|
|
|
const val NOTIFICATION_ALERT_SOUND = "notificationAlertSound"
|
|
|
|
const val NOTIFICATION_FILTER_POLLS = "notificationFilterPolls"
|
|
|
|
const val NOTIFICATION_FILTER_FAVS = "notificationFilterFavourites"
|
|
|
|
const val NOTIFICATION_FILTER_REBLOGS = "notificationFilterReblogs"
|
|
|
|
const val NOTIFICATION_FILTER_FOLLOW_REQUESTS = "notificationFilterFollowRequests"
|
|
|
|
const val NOTIFICATIONS_FILTER_FOLLOWS = "notificationFilterFollows"
|
2020-12-23 12:52:39 +01:00
|
|
|
const val NOTIFICATION_FILTER_SUBSCRIPTIONS = "notificationFilterSubscriptions"
|
2022-04-14 19:39:30 +02:00
|
|
|
const val NOTIFICATION_FILTER_SIGN_UPS = "notificationFilterSignUps"
|
2022-04-19 11:10:13 +02:00
|
|
|
const val NOTIFICATION_FILTER_UPDATES = "notificationFilterUpdates"
|
2022-12-01 20:11:55 +01:00
|
|
|
const val NOTIFICATION_FILTER_REPORTS = "notificationFilterReports"
|
2020-06-08 09:21:12 +02:00
|
|
|
|
2022-05-29 19:21:33 +02:00
|
|
|
const val TAB_FILTER_HOME_REPLIES = "tabFilterHomeReplies_v2" // This was changed once to reset an unintentionally set default.
|
2020-08-21 09:15:53 +02:00
|
|
|
const val TAB_FILTER_HOME_BOOSTS = "tabFilterHomeBoosts"
|
2023-06-29 18:34:56 +02:00
|
|
|
|
|
|
|
/** UI text scaling factor, stored as float, 100 = 100% = no scaling */
|
|
|
|
const val UI_TEXT_SCALE_RATIO = "uiTextScaleRatio"
|
2020-06-08 09:21:12 +02:00
|
|
|
}
|