* Handle preference fragments using the framework
The previous code started new preference "screens" as activities, even though
each one hosted a single fragment.
Modify this to use the framework's support for swapping in/out different
preference fragments.
PreferencesActivity:
- Remove the code for launching tab and proxy preferences
- Remove the code for setting titles, each fragment is responsible for that
- Implement OnPreferenceStartFragmentCallback to swap fragments in/out with
the correct animation
PreferencesFragment:
- Use `fragment` property instead of `setOnPreferenceClickListener`
- Set the activity title when resuming
Everything else:
- Set the activity title when resuming
* Implement HTTP proxy summary as a SummaryProvider
Uses the frameworks's support for setting summaries instead of rolling our
own.
Also fix a tiny bug -- the minimum port number to connect to should be 1,
not 0.
* Lint
* 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
Currently translated at 98.5% (538 of 546 strings)
Translated using Weblate (Belarusian)
Currently translated at 90.4% (494 of 546 strings)
Translated using Weblate (Belarusian)
Currently translated at 81.1% (438 of 540 strings)
Translated using Weblate (Belarusian)
Currently translated at 77.2% (417 of 540 strings)
Co-authored-by: xzFantom <xzfantom@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/be/
Translation: Tusky/Tusky
Currently translated at 100.0% (546 of 546 strings)
Translated using Weblate (Vietnamese)
Currently translated at 100.0% (540 of 540 strings)
Co-authored-by: Hồ Nhất Duy <mastoduy@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/vi/
Translation: Tusky/Tusky
Currently translated at 79.6% (435 of 546 strings)
Translated using Weblate (Latvian)
Currently translated at 75.0% (410 of 546 strings)
Translated using Weblate (Latvian)
Currently translated at 72.9% (394 of 540 strings)
Translated using Weblate (Latvian)
Currently translated at 62.4% (337 of 540 strings)
Co-authored-by: Mārtiņš Bruņenieks <martinsb@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/lv/
Translation: Tusky/Tusky
Currently translated at 100.0% (546 of 546 strings)
Translated using Weblate (Ukrainian)
Currently translated at 100.0% (540 of 540 strings)
Translated using Weblate (Ukrainian)
Currently translated at 100.0% (540 of 540 strings)
Co-authored-by: Ihor Hordiichuk <igor_ck@outlook.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/uk/
Translation: Tusky/Tusky
Currently translated at 100.0% (546 of 546 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (540 of 540 strings)
Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (540 of 540 strings)
Co-authored-by: Eric <alchemillatruth@purelymail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/zh_Hans/
Translation: Tusky/Tusky
Currently translated at 100.0% (546 of 546 strings)
Translated using Weblate (Welsh)
Currently translated at 100.0% (540 of 540 strings)
Co-authored-by: Rhoslyn Prys <post@meddal.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/cy/
Translation: Tusky/Tusky
Robolectric normally swallows output from `Log.*` calls in tests and
the code under test. This can make debugging failing tests more
difficult than it needs to be.
Set `robolectric.logging.enabled` to `true` to enable the logs.
* Remove rxjava from API calls used by AccountListFragment
* Remove rxjava from API calls used by AccountViewModel::changeRelationship()
The affected API functions are also called from
- ReportViewModel.kt
- SearchViewModel.kt
- AccountListFragment.kt
- SFragment.java
- TimelineCases.kt
so they have also been updated.
This change requires bridging from Java code to Kotlin `suspend` functions,
by creating wrappers for the `mute` and `block` functions that can be
called from Java and create a coroutine scope.
I've deliberately made this fairly ugly so that it sticks out and can be
removed later.
* Use "Throwable" type and name
* Delete 46.json
Not sure where this came from.
* Remove rxjava from the deleteStatus call path
* Emit log messages with the correct tag
* Add another log tag, and lint
* Use TAG in log messages now it's present
* Lint
* Move viewModelScope.launch in to changeRelationshop()
* Use onSuccess/onFailure pair instead of fold
* Return Deferred when deleting statuses
* Improve the actual and perceived speed of thread loading
To improve the actual speed, note that if the user has opened a thread from
their home timeline then the initial status is cached in the database. Other
statuses in the same thread may be cached as well.
So try and load the initial status from the database, falling back to the
network if it's not present (e.g., the user has opened a thread from the
local or federated timelines, or a search).
Introduce a new loading state to deal with this case.
In typical cases this allows the UI to display the initial status immediately
with no need to show a progress indicator.
To improve the perceived speed, delay showing the initial loading circular
progress indicators by 500ms. If loading the initial status completes within
that time no spinner is shown and the user will perceive the action as
close-to-immediate
(https://www.nngroup.com/articles/response-times-3-important-limits/).
Additionally, introduce an extra indeterminate progress indicator.
The new indicator is linear, anchored to the bottom of the screen, and shows
progress loading ancestor/descendant statuses. Like the other indicator is
also delayed 500ms from when ancestor/descendant status information is
fetched, and if the fetch completes in that time it will not be shown.
* Mark `getStatus` as suspend so it doesn't run on the main thread
* Save an allocation, use an isDetailed parameter to TimelineStatusWithAccount.toViewData
Rename Status.toViewData's "detailed" parameter to "isDetailed" for
consistency with other uses.
* Ensure suspend functions run to completion when testing
* Delay-load the status from the network even if it's cached
This speeds up the UI while ensuring it will eventually contain accurate data
from the remote.
* Load the network status before updating the list
Avoids excess animations if the network copy has changes
* Fix UI flicker when loading reblogged statuses
* Lint
* Fixup tests
The intent of the previous code seems to be to show an "X" icon on a hashtag
chip when two or more chips are present.
This didn't work because the icon was not set as visible.
Fix this. In addition, set this as a "cancel" icon, not the chip's regular
icon, so it appears on the right (in LTR locales), as is normal for the
close button on chips.
Tinting the icon did nothing, so remove that.
* Share and copy menu items for account page (first attempt)]
* Always include domain in username in 'handle' copy
* Remove profile copy options, rename 'handle' to 'username'
* Long press on username in profile to copy it to clipboard
* Changes for code review: localUsername not username, Snackbar not Toast
* Do not trust getDomain() when getting full username. This means full-username build has to happen in AccountActivity instead of Account
* Replace != null -> \!\! idiom with more kotlin-y (and more threadsafe) ?.let pattern
* Unnecessary import
* Comment clarifying safety of \!\!
Tusky mostly uses (correctly, per Android style guide) sentence case (i.e.,
a single initial capital letter) in strings like "Scheduled posts" or
"Muted users".
But there are a few instances of title case (i.e., each initial letter is
capitalised) that have crept in ("Account Preferences", "Log Out",
"Follow Requests", etc).
Convert them to sentence case.
Currently translated at 98.7% (533 of 540 strings)
Translated using Weblate (Welsh)
Currently translated at 99.4% (535 of 538 strings)
Co-authored-by: Newidyn <grugallt@protonmail.ch>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/cy/
Translation: Tusky/Tusky
* show status edits part 1
* show status edits part 2 - load status edits
* fix code formatting
* add dialog to show status edits
* small improvements
* use ALIGN_CENTER to position status visibility icon when possible
* rename status_timestamp_info view to status_meta_info
* make dateFormat static
* remove commented-out code
* move edits to dedicated fragment
* Fix saving changes to statuses when editing
With the previous code backing out of a status editing operation where changes
had been made (whether it was editing an existing status, a scheduled status,
or a draft) would prompt the user to save the changes as a new draft.
See https://github.com/tuskyapp/Tusky/issues/2704 and
https://github.com/tuskyapp/Tusky/issues/2705 for more detail.
The fix:
- Create an enum to represent the four different kinds of edits that can
happen
- Editing a new status (i.e., composing it for the first time)
- Editing a posted status
- Editing a draft
- Editing a scheduled status
- Store this in ComposeOptions, and set it appropriately everywhere
ComposeOptions is created.
- Check the edit kind when backing out of ComposeActivity, and use this to
show one of three different dialogs as appropriate so the user can:
- Save as new draft or discard changes
- Continue editing or discard changes
- Update existing draft or discard changes
Also fix ComposeViewModel.didChange(), which erroneously reported false if the
old text started with the new text (e.g., if the old text was "hello, world"
and it was edited to "hello", didChange() would not consider that to be a
change).
Fixes https://github.com/tuskyapp/Tusky/issues/2704,
https://github.com/tuskyapp/Tusky/issues/2705
* Use orEmpty extension function
* Handle preference fragments using the framework
The previous code started new preference "screens" as activities, even though
each one hosted a single fragment.
Modify this to use the framework's support for swapping in/out different
preference fragments.
PreferencesActivity:
- Remove the code for launching tab and proxy preferences
- Remove the code for setting titles, each fragment is responsible for that
- Implement OnPreferenceStartFragmentCallback to swap fragments in/out with
the correct animation
PreferencesFragment:
- Use `fragment` property instead of `setOnPreferenceClickListener`
- Set the activity title when resuming
Everything else:
- Set the activity title when resuming
* Lint
* Use the commit extension function
Currently translated at 49.9% (267 of 535 strings)
Translated using Weblate (Latvian)
Currently translated at 49.7% (266 of 535 strings)
Co-authored-by: Mārtiņš Bruņenieks <martinsb@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/lv/
Translation: Tusky/Tusky
Currently translated at 63.3% (339 of 535 strings)
Translated using Weblate (Belarusian)
Currently translated at 59.4% (318 of 535 strings)
Co-authored-by: xzFantom <xzfantom@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/be/
Translation: Tusky/Tusky