Commit graph

4310 commits

Author SHA1 Message Date
Goooler
ca29ee2b0b
Use more orEmpty extensions (#3399)
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/or-empty.html
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/or-empty.html
2023-03-01 21:06:55 +01:00
Konrad Pozniak
ed188783de
include card and collapsed state in instant expanded change (#3394) 2023-03-01 20:00:56 +01:00
Konrad Pozniak
816dc0cbbc
make sure all timeline database operations run on a background thread (#3391) 2023-03-01 20:00:19 +01:00
Konrad Pozniak
b8c77a795c
prevent adding multiple tabs of the same type (#3390)
* prevent adding multiple tabs of the same type

* use Objects.hash
2023-03-01 19:59:40 +01:00
Nik Clayton
1b6108ca94
Add "Refresh" accessibility menu (#3121)
* 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.
2023-03-01 19:58:18 +01:00
Konrad Pozniak
f9588b48e2
Merge pull request #3403 from nailyk-weblate/weblate-tusky-tusky
Translations update from Weblate
2023-03-01 19:45:18 +01:00
Mārtiņš Bruņenieks
29fc449f04 Translated using Weblate (Latvian)
Currently translated at 95.0% (538 of 566 strings)

Co-authored-by: Mārtiņš Bruņenieks <martinsb@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/lv/
Translation: Tusky/Tusky
2023-02-28 21:35:54 +00:00
renovate[bot]
e98925b426
chore(deps): update dependency com.android.application to v7.4.2 (#3395)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-28 22:05:32 +01:00
renovate[bot]
e46e2720a4
Update dependency androidx.arch.core:core-testing to v2.2.0 (#3378)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-28 21:35:31 +01:00
Nik Clayton
ddc4d76c41
Lazily load activities in Robolectric tests (#3397)
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,
2023-02-28 21:28:05 +01:00
UlrichKu
b4d10c9613
3204: Add an account based preference store (#3205)
* 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
2023-02-27 14:07:28 +01:00
Konrad Pozniak
daa67632df
Merge pull request #3381 from nailyk-weblate/weblate-tusky-tusky
Translations update from Weblate
2023-02-27 13:11:04 +01:00
Konrad Pozniak
49b253922a
Merge pull request #3369 from nailyk-weblate/weblate-tusky-tusky-app
Translations update from Weblate
2023-02-27 13:10:37 +01:00
Ricard Torres
7751b88a57 Translated using Weblate (Catalan)
Currently translated at 100.0% (566 of 566 strings)

Co-authored-by: Ricard Torres <ricard@ricard.dev>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/ca/
Translation: Tusky/Tusky
2023-02-27 12:03:21 +00:00
XoseM
46d00a3108 Translated using Weblate (Galician)
Currently translated at 100.0% (566 of 566 strings)

Co-authored-by: XoseM <xosem@disroot.org>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/gl/
Translation: Tusky/Tusky
2023-02-27 12:03:21 +00:00
Garutmaan Garuda
81f3474583 Translated using Weblate (Sanskrit)
Currently translated at 88.8% (503 of 566 strings)

Co-authored-by: Garutmaan Garuda <garutmaangaruda@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/sa/
Translation: Tusky/Tusky
2023-02-27 12:03:21 +00:00
Quentí
03640c8ce7 Translated using Weblate (Occitan)
Currently translated at 100.0% (566 of 566 strings)

Co-authored-by: Quentí <quentinantonin@free.fr>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/oc/
Translation: Tusky/Tusky
2023-02-27 12:03:21 +00:00
UlrichKu
6b9db02c08
3311 load more more prominent (#3376)
* 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
2023-02-27 11:33:11 +01:00
Danial Behzadi
efb2c031a3 Translated using Weblate (Persian)
Currently translated at 100.0% (20 of 20 strings)

Translation: Tusky/Tusky description
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky-app/fa/
2023-02-27 10:25:55 +00:00
Nik Clayton
10f983c953
Ignore clicks outside the start/end of a line (#3380)
* 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
2023-02-27 08:54:51 +01:00
Konrad Pozniak
9340e7a6f4
update Glide to 4.15.0 (#3384) 2023-02-27 08:54:26 +01:00
renovate[bot]
b3f173b2b0
fix(deps): update dependency org.mockito:mockito-inline to v5 (#3373)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-27 08:54:07 +01:00
Goooler
000681c702
Add extra proguard rules for OkHttp (#3350)
* Add extra proguard rules for OkHttp

339732e3a1/okhttp/src/jvmMain/resources/META-INF/proguard/okhttp3.pro (L11-L14)

* Update proguard-rules.pro
2023-02-25 21:40:13 +01:00
Goooler
2da7bc5bc8
Use TypedArray.use to obtain attrs (#3349)
17346638ff/core/core-ktx/src/main/java/androidx/core/content/res/TypedArray.kt (L227-L236)
2023-02-25 21:30:52 +01:00
renovate[bot]
92bd2153e9
Update dependency org.mockito:mockito-inline to v4.11.0 (#3365)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-25 21:28:09 +01:00
fruyek
d4eb744241
Perform unicode text isolation on user names in post edit history view (#3342) 2023-02-25 21:27:54 +01:00
Levi Bard
2e189a17dc
When looking up fediverse urls, verify that account results returned match the input query. (#3341)
Fixes #2804
2023-02-25 21:27:26 +01:00
Nik Clayton
fda8c80949
Use an explicit SCHEMA_VERSION instead of BuildConfig.VERSION_CODE (#3324)
* 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
2023-02-25 21:22:49 +01:00
UlrichKu
4ab305f3dc
2528: Do not remove notifications on general resume (#3312)
* 2528: Do not remove notifications on general resume

* 2528: Have notification removal in the right onResume
2023-02-25 21:18:03 +01:00
Levi Bard
f2b07196e6
Improve language list prioritization. (#3293)
Partially addresses #3277
2023-02-25 21:15:21 +01:00
Nik Clayton
4a0251800d
Fix lifecycle handling bug (#3319)
Fragments can go `onCreate` -> `onCreateView` -> `onViewCreated` -> `onDestroyView` without transitioning through `onStart`.

The previous code assumed `onStart` was always called. 

Se https://itnext.io/an-update-to-the-fragmentviewbindingdelegate-the-bug-weve-inherited-from-autoclearedvalue-7fc0a89fcae1
2023-02-25 21:06:22 +01:00
Goooler
c6f7ecdb5b
Gradle 8.0.1 (#3338)
https://docs.gradle.org/8.0/release-notes.html
2023-02-25 20:59:39 +01:00
renovate[bot]
9eec1ab5c0
Update emoji2 to v1.2.0 (#3368)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-25 20:38:14 +01:00
renovate[bot]
a0ee3072f0
Update dependency org.mockito.kotlin:mockito-kotlin to v4.1.0 (#3364)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-25 20:37:40 +01:00
renovate[bot]
77dbf3c1a9
Update dependency com.google.android.material:material to v1.8.0 (#3361)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-25 20:36:18 +01:00
Eric Frohnhoefer
9e0ff78fb4
Fix media controller UI not showing during audio playback (#3286)
* 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
2023-02-23 19:41:16 +01:00
Nik Clayton
70092c8de2
Make "Up" and "Overflow" menu icons more visible in AccountProfile (#3272)
* 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
2023-02-23 19:30:27 +01:00
renovate[bot]
60fd9cf0e7
Update dependency com.google.code.gson:gson to v2.10.1 (#3362)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-23 17:34:04 +01:00
renovate[bot]
142fe4b743
Update dependency io.reactivex.rxjava3:rxandroid to v3.0.2 (#3348)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-21 20:17:45 +01:00
Konrad Pozniak
d85704d60d
Merge pull request #3346 from nailyk-weblate/weblate-tusky-tusky
Translations update from Weblate
2023-02-21 20:14:19 +01:00
renovate[bot]
62c7d63131
Update dependency com.github.CanHub:Android-Image-Cropper to v4.3.2 (#3347)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-21 19:43:51 +01:00
renovate[bot]
b35cc1fd6b
Update dependency com.github.penfeizhou.android.animation:glide-plugin to v2.24.0 (#3358)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-21 19:41:53 +01:00
renovate[bot]
fc71e398d5
Update dependency com.github.UnifiedPush:android-connector to v2.1.1 (#3357)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-21 19:39:49 +01:00
renovate[bot]
01eefd94a0
Update dependency androidx.browser:browser to v1.5.0 (#3356)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-21 19:39:39 +01:00
renovate[bot]
b62fc9bf07
Update dagger to v2.45 (#3355)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-21 19:37:44 +01:00
renovate[bot]
53f7afd9ee
Update androidx-work to v2.8.0 (#3354)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-21 19:37:33 +01:00
renovate[bot]
aa14013adc
Update dependency io.reactivex.rxjava3:rxjava to v3.1.6 (#3353)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-21 19:37:07 +01:00
Danial Behzadi
837a91e12c Translated using Weblate (Persian)
Currently translated at 100.0% (566 of 566 strings)

Co-authored-by: Danial Behzadi <dani.behzi@ubuntu.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/fa/
Translation: Tusky/Tusky
2023-02-21 18:37:00 +00:00
Deleted User
766dab2173 Translated using Weblate (German)
Currently translated at 100.0% (566 of 566 strings)

Co-authored-by: Deleted User <noreply+263@weblate.org>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/de/
Translation: Tusky/Tusky
2023-02-21 18:37:00 +00:00
Mārtiņš Bruņenieks
5e3d6a8f97 Translated using Weblate (Latvian)
Currently translated at 95.0% (536 of 564 strings)

Co-authored-by: Mārtiņš Bruņenieks <martinsb@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/lv/
Translation: Tusky/Tusky
2023-02-21 18:37:00 +00:00