`activity_account` sets the root text direction to `anyRtl`.
This is OK for UI elements, but can be a problem for user generated content
(UGC) that may contain bidirectional text.
Fix this by explicitly restoring the default behaviour, `firstStrong`, on
views in `activity_account` that can show UGC.
Fixes https://github.com/tuskyapp/Tusky/issues/3294
* Add "Refresh" accessibility menu to TimelineFragment
Per https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout
the layout does not provide accessibility events, and a menu item should be
provided as an alternative method for refreshing the content.
In `TimelineFragment`:
- Implement the `MenuProvider` interface so it can populate the action bar
menu in activities that host the fragment
- Create a "Refresh" menu item, and refresh the state when it is selected
`MainActivity` has to change how the menu is created, so that fragments
can add items to it.
In `MainActivity`:
- Call `setSupportActionBar` so `mainToolbar` participates in menus
- Implement the `MenuProvider` interface, and move menu creation there
- Set the title via supportActionBar
* Never show the refresh item as a menubar action
Per guidelines in https://developer.android.com/develop/ui/views/touch-and-input/swipe/add-swipe-interface#AddRefreshAction
* Add "Refresh" menu item for AccountMediaFragment
Also, fix the colour of the refresh progress indicator
* Implement "Refresh" for AnnouncementsActivity
* Add "Refresh" menu for ConversationsFragment
* Keep the tabs adapter over the life of the viewpager
Make `tabs` `var` instead of `val` in `MainPagerAdapter` so it can be updated
when tabs change.
Then detach the `tabLayoutMediator`, update the tabs, and call
`notifyItemRangeChanged` in `setupTabs()`.
This fixes a bug (not sure if it's this code, or in ViewPager2) where
assigning a new adapter to the view pager seemed to result in a leak of one
or more fragments. This wasn't user-visible, but it's a leak, and it becomes
user-visible when fragments want to display menus.
This also fixes two other bugs:
1. Be on the left-most tab. Scroll down a bit. Then modify the tabs at
"Account preferences > tabs", but keep the left-most tab as-is.
Then go back to MainActivity. Your reading position in the left-most
tab has been jumped to the top.
2. Be on any non-left-most tab. Then modify the tab list by reordering tabs
(adding/removing tabs is also OK).
Then go back to MainActivity. Your tab selection has been overridden,
and the left-most tab has been selected.
Because the fragments are not destroyed unnecessarily your reading position
is retained. And it remembers the tab you had selected, and as long as that
tab is still present you will be returned to it, even if it's changed
position in the list.
Fixes https://github.com/tuskyapp/Tusky/issues/3251
* Add "Refresh" menu for ScheduledStatusActivity
* Lint
* Add "Refresh" menu for SearchFragment / SearchActivity
* Explicitly set the searchview width
Using "collapseActionView" requires the user to press "Back" twice to exit
the activity, which is not acceptable.
* Move toolbar handling in to ViewThreadActivity
Previous code had the toolbar in the fragment's layout. Refactor to make
consistent with other activities, and move the toolbar in to the activity
layout.
Implement MenuProvider in ViewThreadFragment to adjust the menu in the
activity.
* Add "Refresh" menu to ViewThreadFragment
* Implement "Refresh" for ViewEditsFragment
* Lint
* Add "Refresh" menu to ReportStatusesFragment
* Add "Refresh" menu to NotificationsFragment
* Rename menu resource files
Be consistent with the layout resource files, which have an activity/fragment
prefix, then the lower_snake_case name of the activity or fragment it's for.
* Only enable refresh menu if swiptorefresh is enabled
Some timelines don't have swipetorefresh enabled (e.g., those shown on
AccountActivity). In those cases don't add the refresh menu, rely on the
hosting activity to provide it.
Update AccountActivity to provide the refresh menu item.
Not all Robolectric tests interact with activities, so lazy loading the activity can speed them up.
I benchmarked the impact with gradle-profiler. Each test run performed 6 warmup runs, and then 10 benchmarked runs with and without this change.
Without this change (all values rounded to nearest second):
Mean: 151
Median: 149
P75: 157
StdDev: 10
With this change:
Mean: 127
Median: 125
P75: 130
StdDev: 7
So a ~ 18% reduction in median and P75 times,
* 3204: Add an account based preference store
* 3204: (related) reformat a bit, add todo
* 3204: Use the preference data store for all three account settings
* 3204: Move event handling to account settings handler
* 3204: Correct includes
* 3204: Appease linter
* 3204: Appease linter again
* 3204: Add an account based preference store
* 3204: Use the preference data store for all three account settings
* 3204: Move event handling to account settings handler
* 3204: Correct includes
* 3204: Add general "preference upgrade loop stepper"; use it for removing obsolete account settings (in shared)
* 3204: Add missing spaces
* 3204: Key is non-nullable
* 3204: Upgrade to new settings migration code
* 3204: Remove (commented) DI code
* 3311: Add a zig-zag line to top and bottom of "load more"
* 3311: Remove unneeded extensions
* 3311: Use a simple gradient instead of zigzag line
* 3311: Use a simple gradient drawable (remove custom view)
* 3311: Remove gradient lines
* Ignore clicks outside the start/end of a line
`LinkMovementMethod` has a bug in its calculation of the clickable width of a span on a line. If the span is the last thing on the line the clickable area extends to the end of the view. So the user can tap what appears to be whitespace and open a link.
Previous code tried to fix this by adding a zero-width space after the link so that `LinkMovementMethod` wouldn't consider it empty. However the ZWS was selected by copy/paste operations, resulting in junk results if users tried to copy the link.
Fix this by subclassing `LinkMovementMethod` and fixing the click detection code to ignore clicks that are outside the bounds of the line that was clicked on.
Remove the code that adds the ZWS.
Fixes https://github.com/tuskyapp/Tusky/issues/1567
* Assume arguments are all non-null
* Use `object` for singleton
* getInstance as a one-liner
* Use an explicit SCHEMA_VERSION instead of BuildConfig.VERSION_CODE
Every nightly release has a new BuildConfig.VERSION_CODE, so the previous
code would not do the right thing.
Require the schema version to be explicitly set. While I'm here, provide
a clear set of guidelines as to what has to happen when the schema changes.
* Improve documentation links
* Update ViewVideoFragment.kt
Testing
- Open audio attachment: https://solarpunk.moe/@vv/109562659215759090
- Ensure media control UI and alt text is shown once playback starts
Fixes#3261
* Fix commit issue
* Fix spacing
* Make "Up" and "Overflow" menu icons more visible in AccountProfile
The toolbar in AccountProfile is transparent, so any profile image the user
has chosen is shown under it.
This makes the "Up" and "Overflow" menu icons also have transparent
backgrouns.
Consequently, they can be hard to spot, or possibly invisible, on backgrounds
that are very dark or very light.
Fix this by compositing the icons in a LayerDrawable, with a circular
background identical to the surface colour. This ensures they stand out
against the background image, and blend in when the user scrolls.
* Get and reuse the background drawable
* Apply a smidgen of transparency