Commit Graph

4214 Commits

Author SHA1 Message Date
GunChleoc e40ea2bef7 Translated using Weblate (Gaelic)
Currently translated at 92.0% (599 of 651 strings)

Co-authored-by: GunChleoc <fios@foramnagaidhlig.net>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/gd/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
Ümit Solmaz 6132108fd5 Translated using Weblate (Turkish)
Currently translated at 100.0% (651 of 651 strings)

Co-authored-by: Ümit Solmaz <usnotv@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/tr/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
Deleted User c06e2daf6b Translated using Weblate (German)
Currently translated at 100.0% (651 of 651 strings)

Co-authored-by: Deleted User <noreply+322@weblate.org>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/de/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
Deleted User 3c39c69642 Translated using Weblate (German)
Currently translated at 100.0% (651 of 651 strings)

Co-authored-by: Deleted User <noreply+321@weblate.org>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/de/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
Hồ Nhất Duy 2764b4519a Translated using Weblate (Vietnamese)
Currently translated at 100.0% (651 of 651 strings)

Co-authored-by: Hồ Nhất Duy <mastoduy@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/vi/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
Eric 80a66f7b2a Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (651 of 651 strings)

Co-authored-by: Eric <ekhfcxwuvxqfdb@hldrive.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/zh_Hans/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
Manuel 0a23fccd69 Translated using Weblate (Italian)
Currently translated at 100.0% (651 of 651 strings)

Co-authored-by: Manuel <mannivuwiki@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/it/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
Danial Behzadi 534e760843 Translated using Weblate (Persian)
Currently translated at 100.0% (651 of 651 strings)

Co-authored-by: Danial Behzadi <dani.behzi@ubuntu.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/fa/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
Connyduck 83a676bc21 Translated using Weblate (German)
Currently translated at 100.0% (651 of 651 strings)

Translated using Weblate (German)

Currently translated at 99.8% (650 of 651 strings)

Co-authored-by: Connyduck <weblate@connyduck.at>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/de/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
fin-w 0bfa7606d2 Translated using Weblate (Welsh)
Currently translated at 100.0% (651 of 651 strings)

Co-authored-by: fin-w <fin-w@tutanota.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/cy/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
XoseM 4d960a89ad Translated using Weblate (Galician)
Currently translated at 100.0% (648 of 648 strings)

Co-authored-by: XoseM <xosem@disroot.org>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/gl/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
Ihor Hordiichuk e34dceec48 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (648 of 648 strings)

Co-authored-by: Ihor Hordiichuk <igor_ck@outlook.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/uk/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
Deleted User 562f76f08a Translated using Weblate (German)
Currently translated at 100.0% (648 of 648 strings)

Co-authored-by: Deleted User <noreply+320@weblate.org>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/de/
Translation: Tusky/Tusky
2024-08-10 07:16:34 +00:00
Konrad Pozniak ce48caa818
remove "default" from posting defaults preference names (#4602)
This makes the interface less cluttered and matches Mastodon. The
"default" is already in the preference group title, I think this is
clear enough.

Before:

![Screenshot_20240807_172653](https://github.com/user-attachments/assets/c72dde12-91b9-4c0e-b2a4-6802dfcf1925)

After:

![Screenshot_20240807_172240](https://github.com/user-attachments/assets/538c89ec-648d-4ef1-8f78-5c2cf951a039)

Mastodon:
<img width="844" alt="Screenshot 2024-08-07 at 17 21 11"
src="https://github.com/user-attachments/assets/601b231e-1f94-4898-b8f3-7eaf7ebe640c">
2024-08-10 09:24:28 +02:00
Konrad Pozniak b68e9760fb
fix translating boosts in home timeline (#4590)
fixes https://github.com/tuskyapp/Tusky/issues/4589
2024-08-06 20:10:38 +02:00
Konrad Pozniak 892801b83a
add more options to default reply visibility setting (#4568)
This adds `direct` and `match_default_post_visibility` as options to the
default reply visibility setting. `match_default_post_visibility` will
be the default for new accounts.

closes https://github.com/tuskyapp/Tusky/issues/4555

<img
src="https://github.com/user-attachments/assets/b256ff32-cd49-4274-903b-96da96451e0e"
width="320"/>
2024-08-02 17:15:10 +02:00
Willow 18b943fef5
Bind account early in timeline & notification view models (#4577)
This will make it less likely that data from different accounts will get
mixed up.

I checked the codepaths and we shouldn't hit viewModel if account is not
there but this is still a bit of risk to assume that so I'll investigate
if we can pass in more things and use DI to make it more secure

---------

Co-authored-by: Conny Duck <git@connyduck.at>
2024-08-02 17:13:32 +02:00
andrewhamilton0 0f3dd64c79
Updates searchView in SearchActivity to clear focus after search (#4578)
Addresses issue #4573. Updates searchView in SearchActivity to clear
focus when a user makes a search. This allows the keyboard to not keep
popping up after a user goes back to search screen after clicking on a
searched item.
2024-07-20 10:29:44 +02:00
Christophe Beyls 12040b90fb
fix: RequestBuilder.submitAsync() throwing an Exception if the Glide request is restarted (#4569)
This is the third attempt to fix `RequestBuilder.submitAsync()`. For the
rationale, see the comments of #4436.

We now clear the continuation reference after resuming it, to make sure
that:
1) It will only be resumed once
2) It will not leak the coroutine when Glide keeps the `Request` around.
2024-07-14 09:01:01 +02:00
Eric 0acdcdd1a2 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (648 of 648 strings)

Co-authored-by: Eric <ekhfcxwuvxqfdb@hldrive.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/zh_Hans/
Translation: Tusky/Tusky
2024-07-12 09:01:12 +00:00
Konrad Pozniak a8202d8a41
fix default post privacy setting sometimes showing the value of the wrong account (#4564)
Without the `isPersistent = false` flag the preference is saved to
SharedPreferences in addition to the account and overrides the shown
value. So it would always show the value of the last account it was set
to. It was working fine though, only the shown value was wrong.

https://social.sitedethib.com/@Claire/112769984398891581
2024-07-12 11:06:53 +02:00
Konrad Pozniak 235b55d8d6
fix translations not working on instances where domain does not match instance name (#4560)
https://social.froonix.org/@cs/112767747835228296

We were caching the instance info with the instance name as the key and
then look it up with the actual domain and those do not always match so
the check if translation is supported fails. fnx.li vs
social.froonix.org in this case.
2024-07-12 11:06:39 +02:00
Connyduck b968396fa7 Translated using Weblate (German)
Currently translated at 100.0% (648 of 648 strings)

Co-authored-by: Connyduck <weblate@connyduck.at>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/de/
Translation: Tusky/Tusky
2024-07-12 07:46:12 +00:00
Konrad Pozniak fcd6e9c67b
fix updating boosts in network timeline (#4549)
re: https://infosec.exchange/@webhat/112745609655586468

Boost were not correctly handled here, probably because they are only on
profile timelines which I rarely check. This makes sure likes and boosts
get correctly set to posts even when they are boosts.
2024-07-12 08:59:43 +02:00
Conny Duck 000af7fb94
Release 123 2024-07-07 19:56:51 +02:00
Konrad Pozniak 9533b90bcd
fix crash on unknown notification (#4546)
```
Exception java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setClipToOutline(boolean)' on a null object reference
  at com.keylesspalace.tusky.adapter.StatusBaseViewHolder.<init> (StatusBaseViewHolder.java:150)
  at com.keylesspalace.tusky.adapter.StatusViewHolder.<init> (StatusViewHolder.java:55)
  at com.keylesspalace.tusky.components.notifications.UnknownNotificationViewHolder.<init> (UnknownNotificationViewHolder.java:27)
  at com.keylesspalace.tusky.components.notifications.NotificationsPagingAdapter.onCreateViewHolder (NotificationsPagingAdapter.kt:139)
  at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder (RecyclerView.java:7788)
  at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline (RecyclerView.java:6873)
  at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:6757)
  at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:6753)
  at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next (LinearLayoutManager.java:2362)
  at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk (LinearLayoutManager.java:1662)
  at androidx.recyclerview.widget.LinearLayoutManager.fill (LinearLayoutManager.java:1622)
  at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren (LinearLayoutManager.java:687)
  at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2 (RecyclerView.java:4645)
  at androidx.recyclerview.widget.RecyclerView.dispatchLayout (RecyclerView.java:4348)
  at androidx.recyclerview.widget.RecyclerView.onLayout (RecyclerView.java:4919)
  ...
```
2024-07-07 19:50:50 +02:00
Konrad Pozniak e53942e589
prepare release v26.0 beta 1 (#4542) 2024-07-06 19:35:02 +02:00
Weblate 0978e557b2
Translations update from Weblate (automated) (#4544)
Translations update from [Weblate](https://weblate.tusky.app) for
[Tusky/Tusky](https://weblate.tusky.app/projects/tusky/tusky/).



Current translation status:

![Weblate translation
status](https://weblate.tusky.app/widget/tusky/tusky/horizontal-auto.svg)

Co-authored-by: fin-w <fin-w@tutanota.com>
2024-07-06 19:32:08 +02:00
Konrad Pozniak a3bdd894f0
improve filters v1 loading (#4545)
A user still on Mastodon 3 complained that since my change in
https://github.com/tuskyapp/Tusky/pull/4539 the timeline reloads on
starting Tusky. Well, we need to do some reloading of the timeline after
loading the v1 filters or they won't work. Changing the `fullReload` to
`invalidate` improves the situation by not loading everything from the
network again (just the database) but there is still some noticeable
loading.
(I'm not willing to invest any more time to support these old instances)
2024-07-06 18:32:35 +02:00
Konrad Pozniak 326676a9c6
split out FilteredStatusViewHolder from StatusBaseViewHolder (#4543)
This is way more efficient than before as less views need to be inflated
and bound for a filtered status to be rendered. It also should fix the
bug where sometimes a `StatusViewHolder` that is set up for showing a
status gets bound to a status that is filtered, leading to a crash.
2024-07-05 10:13:37 +02:00
Konrad Pozniak 8a57bcc3f4
only check once for filters v2 availability (#4539)
Instead of calling the endpoint every time filters are needed, it will
be called only once and the result cached. This will result in quite
some requests less on instances supporting v2.

I also tested v1 filters and made some small improvements. We should
[remove filters v1
support](https://github.com/tuskyapp/Tusky/issues/4538) some time in the
future though.
2024-07-03 21:18:09 +02:00
Ihor Hordiichuk 0d6acfdc3f Translated using Weblate (Ukrainian)
Currently translated at 100.0% (648 of 648 strings)

Co-authored-by: Ihor Hordiichuk <igor_ck@outlook.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/uk/
Translation: Tusky/Tusky
2024-07-03 17:48:44 +00:00
Konrad Pozniak 81d1722731
correctly scale gifs in FocusDialog (#4537)
Found while testing #4528

The problem seems to be that Glide does not scale GIFs as it does static
images. This workaround makes sure they still show up correctly.

before / after

<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/92c5e423-fa69-4bd5-b353-d5fac46f3074"
width="260" />
<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/200f801b-0910-44dd-aa8b-39c383f07107"
width="260" />
2024-06-30 16:52:21 +02:00
Konrad Pozniak a371edbe87
show gifs in CaptionDialog (#4536)
closes #4528
2024-06-30 16:52:11 +02:00
Konrad Pozniak c0ad50b6e6
fix displaying filtered notifications (#4535)
```
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
       at com.keylesspalace.tusky.adapter.StatusBaseViewHolder.setupFilterPlaceholder(StatusBaseViewHolder.java:894)
       at com.keylesspalace.tusky.adapter.StatusBaseViewHolder.setupWithStatus(StatusBaseViewHolder.java:825)
       at com.keylesspalace.tusky.adapter.StatusViewHolder.setupWithStatus(StatusViewHolder.java:91)
       at com.keylesspalace.tusky.components.notifications.StatusViewHolder.bind(StatusViewHolder.kt:46)
       at com.keylesspalace.tusky.components.notifications.NotificationsPagingAdapter.bindViewHolder(NotificationsPagingAdapter.kt:150)
       at com.keylesspalace.tusky.components.notifications.NotificationsPagingAdapter.onBindViewHolder(NotificationsPagingAdapter.kt:143)
       at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7847)
       at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6646)
       at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6917)
       at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6757)
       at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6753)
       at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2362)
       at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1662)
       at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1622)
       at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:687)
       at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4645)
       at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4348)
       at androidx.recyclerview.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:2106)
       at androidx.recyclerview.widget.RecyclerView$1.run(RecyclerView.java:468)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1231)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239)
       at android.view.Choreographer.doCallbacks(Choreographer.java:899)
       at android.view.Choreographer.doFrame(Choreographer.java:827)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214)
       at android.os.Handler.handleCallback(Handler.java:942)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7872)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
```
2024-06-30 16:51:58 +02:00
XoseM 9e33297d07 Translated using Weblate (Galician)
Currently translated at 100.0% (648 of 648 strings)

Co-authored-by: XoseM <xosem@disroot.org>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/gl/
Translation: Tusky/Tusky
2024-06-29 17:33:45 +00:00
Ümit Solmaz 8df309553c Translated using Weblate (Turkish)
Currently translated at 100.0% (648 of 648 strings)

Co-authored-by: Ümit Solmaz <usnotv@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/tr/
Translation: Tusky/Tusky
2024-06-29 17:33:45 +00:00
Connyduck 867f68f007 Translated using Weblate (German)
Currently translated at 98.7% (640 of 648 strings)

Co-authored-by: Connyduck <weblate@connyduck.at>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/de/
Translation: Tusky/Tusky
2024-06-29 17:33:45 +00:00
Mārtiņš Bruņenieks 2bdf80a9a9 Translated using Weblate (Latvian)
Currently translated at 83.3% (540 of 648 strings)

Co-authored-by: Mārtiņš Bruņenieks <martinsb@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/lv/
Translation: Tusky/Tusky
2024-06-29 17:33:45 +00:00
Hồ Nhất Duy 33bfad38c9 Translated using Weblate (Vietnamese)
Currently translated at 100.0% (648 of 648 strings)

Co-authored-by: Hồ Nhất Duy <mastoduy@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/vi/
Translation: Tusky/Tusky
2024-06-29 17:33:45 +00:00
autay27 9268562860
Sort by category in emoji picker (#4533)
Emojis are sorted by category within the emoji picker. The original
alphabetical sorting is preserved within categories.

This partially addresses #1868 and is only a small part of what is done
in #3300, but I think it is still enough to improve quality of life for
users.
2024-06-29 19:38:27 +02:00
Konrad Pozniak b1f7e24a93
exclude compose activity from recents (#4521)
closes #4517
2024-06-29 06:36:12 +02:00
Konrad Pozniak f5ad39946e
override onNewIntent in MainActivity to improve sharing (#4527)
When investigating #4517, I found that sharing to Tusky sometimes just
does nothing.
This is because when `MainActivity` is already open, it isn't always
restarted (`onCreate` not called) but instead the Intent is delivered to
`onNewIntent` of the existing `MainActivity`. This fixes the issue by
overriding `onNewIntent`.

The problem does not always reproduce, it seems to depend on what is
shared from where and on the Android version. `MainActivity` must be
open for the problem to occur though.

This probably also fixes the issue that sometimes Tusky does not show
the right tab when clicking on a notification
(https://github.com/tuskyapp/Tusky/issues/2691)
2024-06-28 17:36:31 +02:00
Konrad Pozniak 1c1d39443b
fix (un)muting conversations (#4525)
closes #4523 
closes #4524
2024-06-22 11:02:51 +02:00
Manuel ac63848fd7 Translated using Weblate (Italian)
Currently translated at 100.0% (648 of 648 strings)

Co-authored-by: Manuel <mannivuwiki@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/it/
Translation: Tusky/Tusky
2024-06-20 18:07:10 +00:00
Danial Behzadi 08f73da668 Translated using Weblate (Persian)
Currently translated at 100.0% (648 of 648 strings)

Co-authored-by: Danial Behzadi <dani.behzi@ubuntu.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/fa/
Translation: Tusky/Tusky
2024-06-20 18:07:09 +00:00
fin-w 07b7e06d22 Translated using Weblate (Welsh)
Currently translated at 100.0% (648 of 648 strings)

Translated using Weblate (Welsh)

Currently translated at 100.0% (647 of 647 strings)

Co-authored-by: fin-w <fin-w@tutanota.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/cy/
Translation: Tusky/Tusky
2024-06-20 18:07:09 +00:00
Konrad Pozniak c55988a66b
add bottom padding to FiltersActivity RecyclerView (#4520)
Missed that in https://github.com/tuskyapp/Tusky/pull/4486
2024-06-19 16:51:34 +02:00
Konrad Pozniak 976fa284a7
hide content warning button when there is no content (#4518)
I encountered [this weird
post](https://akko.wtf/notice/Aiz78vrg9jBNHJrvIO) today that had a
content warning button but no content.

<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/975090e1-7552-4750-97b4-1917b06aeb60"
width="320"/>

This change will match Mastodon behavior and hide the button when there
is no content to reveal.

We probably did not encounter this bug earlier because Mastodon moves
the CW to the content when the content is empty, but apparently not for
federated posts.
2024-06-19 16:51:22 +02:00
Konrad Pozniak b895ce936e
improve MediaPreviewAdapter / fix IndexOutOfBoundsException (#4514)
Found this crash in the Google Play reports:

```
Exception java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 0
  at jdk.internal.util.Preconditions.outOfBounds (Preconditions.java:64)
  at jdk.internal.util.Preconditions.outOfBoundsCheckIndex (Preconditions.java:70)
  at jdk.internal.util.Preconditions.checkIndex (Preconditions.java:266)
  at java.util.Objects.checkIndex (Objects.java:359)
  at java.util.ArrayList.get (ArrayList.java:434)
  at java.util.Collections$UnmodifiableList.get (Collections.java:1394)
  at com.keylesspalace.tusky.components.compose.MediaPreviewAdapter.onMediaClick (MediaPreviewAdapter.java:45)
  at com.keylesspalace.tusky.components.compose.MediaPreviewAdapter.access$onMediaClick (MediaPreviewAdapter.java:32)
  at com.keylesspalace.tusky.components.compose.MediaPreviewAdapter$PreviewViewHolder._init_$lambda$0 (MediaPreviewAdapter.java:144)
  at android.view.View.performClick (View.java:7535)
  at android.view.View.performClickInternal (View.java:7512)
  at android.view.View.-$$Nest$mperformClickInternal
  at android.view.View$PerformClick.run (View.java:29488)
  at android.os.Handler.handleCallback (Handler.java:984)
  at android.os.Handler.dispatchMessage (Handler.java:104)
  at android.os.Looper.loopOnce (Looper.java:238)
  at android.os.Looper.loop (Looper.java:357)
  at android.app.ActivityThread.main (ActivityThread.java:8118)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:957)
```

Can't reproduce, but seems to be some kind of race condition where the
view is clicked at the same time as it is being removed from the
`RecyclerView`. Not using the index in the click listener should resolve
the problem. Also refactored to `ListAdapter` to not deal with the
`AsyncListDiffer` manually.
2024-06-19 16:51:12 +02:00
Konrad Pozniak 5251287b53
Translations update from Weblate (automated) (#4513)
Translations update from [Weblate](https://weblate.tusky.app) for
[Tusky/Tusky](https://weblate.tusky.app/projects/tusky/tusky/).



Current translation status:

![Weblate translation
status](https://weblate.tusky.app/widget/tusky/tusky/horizontal-auto.svg)
2024-06-19 16:50:54 +02:00
Konrad Pozniak dcbd6d558c
improved color scheme & theming (#4507)
Follow up to https://github.com/tuskyapp/Tusky/pull/3921

- no more hardcoded `tusky_blue`, instead the `colorPrimary` attribute
is used. This will help us when adding more themes, e.g a dynamic color
one.
- The `colorPrimary` of the dark theme is now lighter for more contrast
and subsequently the `colorOnPrimary` is now dark grey instead of white.
- `tusky_red_lighter` is now a bit more red than before
- Tweaked color usage in a few places for better contrast

I think this looks a bit unfamiliar but overall better and the higher
contrast makes things noticeably easier to read.

<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/4cbb92d8-b772-4e94-bc15-c4baf0e5473f"
width="260"/>
2024-06-19 16:50:35 +02:00
Christophe Beyls 125483db61
Improve BlurHashDecoder performance (#4515)
This pull request aims to dramatically improve the performance of
`BlurHashDecoder` while also reducing its memory allocations.

- Precompute cosines tables before composing the image so each cosine
value is only computed once.
- Compute cosines tables once if both are identical (for square images
with the same number of colors in both dimensions).
- Store colors in a one-dimension array instead of a two-dimension array
to reduce memory allocations.
- Use a simple `String.indexOf()` to find the index of a Base83 char,
which is both faster and needs less memory than a `HashMap` thanks to
better locality and no boxing of chars.
- No cache is used, so computations may be performed in parallel on
background threads without the need for synchronization which limits
throughput.

## Benchmarks

Simple: 4x4 colors, 32x32 pixels output. (This is what Mastodon and
Tusky currently use)
Complex: 9x9 colors, 256x256 pixels output.

**Pixel 7 (Android 14)**

```
      365 738   ns          23 allocs    Trace    BlurHashDecoderBenchmark.tuskySimple
      109 577   ns           8 allocs    Trace    BlurHashDecoderBenchmark.newSimple
  108 771 647   ns          88 allocs    Trace    BlurHashDecoderBenchmark.tuskyComplex
   12 932 076   ns           8 allocs    Trace    BlurHashDecoderBenchmark.newComplex
```

**Nexus 5 (Android 6)**

```
    4 600 937   ns          22 allocs    Trace    BlurHashDecoderBenchmark.tuskySimple
    1 391 487   ns           7 allocs    Trace    BlurHashDecoderBenchmark.newSimple
1 260 644 948   ns          87 allocs    Trace    BlurHashDecoderBenchmark.tuskyComplex
  125 274 063   ns           7 allocs    Trace    BlurHashDecoderBenchmark.newComplex
```

Conclusion: The new implementation is **3 times faster** than the old
one for the current usage and up to **9 times faster** if we decide to
increase the BlurHash quality in the future.

The source code of the benchmark comparing the original untouched Kotlin
implementation to the new one can be found
[here](https://github.com/cbeyls/BlurHashAndroidBenchmark).
2024-06-16 20:20:27 +02:00
Danial Behzadi 861a42db55 Translated using Weblate (Persian)
Currently translated at 100.0% (647 of 647 strings)

Co-authored-by: Danial Behzadi <dani.behzi@ubuntu.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/fa/
Translation: Tusky/Tusky
2024-06-16 04:07:09 +00:00
Hồ Nhất Duy 1a81aa6781 Translated using Weblate (Vietnamese)
Currently translated at 100.0% (647 of 647 strings)

Co-authored-by: Hồ Nhất Duy <mastoduy@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/vi/
Translation: Tusky/Tusky
2024-06-16 04:07:09 +00:00
Hồ Nhất Duy 66f3b6e4e8 Translated using Weblate (Vietnamese)
Currently translated at 100.0% (645 of 645 strings)

Co-authored-by: Hồ Nhất Duy <mastoduy@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/vi/
Translation: Tusky/Tusky
2024-06-13 16:39:24 +00:00
Ümit Solmaz 45f4e5637e Translated using Weblate (Turkish)
Currently translated at 100.0% (645 of 645 strings)

Co-authored-by: Ümit Solmaz <usnotv@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/tr/
Translation: Tusky/Tusky
2024-06-13 16:39:24 +00:00
Manuel 0f28811938 Translated using Weblate (Italian)
Currently translated at 100.0% (647 of 647 strings)

Translated using Weblate (Italian)

Currently translated at 100.0% (645 of 645 strings)

Co-authored-by: Manuel <mannivuwiki@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/it/
Translation: Tusky/Tusky
2024-06-13 16:39:24 +00:00
Danial Behzadi e28946af93 Translated using Weblate (Persian)
Currently translated at 100.0% (645 of 645 strings)

Co-authored-by: Danial Behzadi <dani.behzi@ubuntu.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/fa/
Translation: Tusky/Tusky
2024-06-13 16:39:24 +00:00
fin-w a46e6e0c27 Translated using Weblate (Welsh)
Currently translated at 100.0% (647 of 647 strings)

Translated using Weblate (Welsh)

Currently translated at 100.0% (645 of 645 strings)

Translated using Weblate (Welsh)

Currently translated at 100.0% (645 of 645 strings)

Co-authored-by: fin-w <fin-w@tutanota.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/cy/
Translation: Tusky/Tusky
2024-06-13 16:39:24 +00:00
Konrad Pozniak 9fff8d19a9
add database schema v62 (#4505)
should have been added in #4496
2024-06-12 17:17:44 +02:00
Konrad Pozniak 79c29caaf2
small code improvements / code cleanup (#4502)
just some smaller things I noticed recently, I hope it is ok if I bunch
them up like this
2024-06-12 17:17:21 +02:00
Konrad Pozniak 8d65feadd6
Fix some filter bugs (#4501)
closes #4499 

This restores support for v1 filters. The problem was that the state was
uncoditionally set to error instead of checking the v1 response.
While checking the code I found some other problems:
- Two error messages that were shown to users were not translatable
- When filters were updated sometimes `PreferenceChangedEvent` was sent
instead of `FilterUpdatedEvent`
- The notifications fragment was not listening to the
`FilterUpdatedEvent`
2024-06-12 17:17:08 +02:00
Anonymous e29d444355 Translated using Weblate (Frisian)
Currently translated at 34.1% (220 of 645 strings)

Translated using Weblate (Finnish)

Currently translated at 43.1% (278 of 645 strings)

Co-authored-by: Anonymous <noreply@weblate.org>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/fi/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/fy/
Translation: Tusky/Tusky
2024-06-09 20:32:19 +00:00
Quentí d34f9534ad Translated using Weblate (Occitan)
Currently translated at 99.5% (641 of 644 strings)

Co-authored-by: Quentí <quentinantonin@free.fr>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/oc/
Translation: Tusky/Tusky
2024-06-09 20:32:19 +00:00
Deleted User b0bf543c1c Translated using Weblate (German)
Currently translated at 100.0% (644 of 644 strings)

Co-authored-by: Deleted User <noreply+317@weblate.org>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/de/
Translation: Tusky/Tusky
2024-06-09 20:32:19 +00:00
Eliot Lash 9883bfa7c2
Add option for default reply privacy set to unlisted by default (#4496)
This PR fixes https://github.com/tuskyapp/Tusky/issues/2798 and is
mostly based on and supersedes
https://github.com/tuskyapp/Tusky/pull/2826 but I have fixed all merge
conflicts and unit tests.

I tested the changes locally and the setting takes effect immediately
for replies, and persists across killing the app.

---------

Co-authored-by: Eva Tatarka <eva@tatarka.me>
Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
2024-06-09 20:25:03 +02:00
Weblate 8584e72f48
Translations update from Weblate (automated) (#4495)
Translations update from [Weblate](https://weblate.tusky.app) for
[Tusky/Tusky](https://weblate.tusky.app/projects/tusky/tusky/).



Current translation status:

![Weblate translation
status](https://weblate.tusky.app/widget/tusky/tusky/horizontal-auto.svg)

Co-authored-by: Weblate <noreply@weblate.org>
2024-06-06 16:22:25 +02:00
Levi Bard c77a755ea0
Fix crash when loading notifications that have filter results (#4494) 2024-06-05 20:20:34 +02:00
Konrad Pozniak 6a37cd20b5
fix wrong content description of back button in ViewThreadActivity (#4491)
"Open Drawer" makes no sense here. Removing the attribute makes the
description fall back to the default "Navigate up" which is better.
2024-06-05 20:20:16 +02:00
Konrad Pozniak b205e53213
fix ViewEditsFragment having no background during transition (#4490)
closes #4489
2024-06-05 20:20:05 +02:00
Konrad Pozniak 34b53a3c59
Replace "Hide compose button while scrolling" setting with bottom padding (#4486)
As discussed in our contributors meeting.

Advantages:
- last element of list never obscured by action button
- less code that runs on every scroll
- less settings to worry about

Additionally: 
- Added a (smaller) padding to the bottom of lists without action
button, I think it looks nice if there is a bit of white space and the
nav bar divider and the last list divider don't touch.
- The list of filters had no dividers, I added them.
- Recyclerviews with fixed height (Drafts, Filters, edits) now have
scrollbars
- code formatted all touched xml files

closes https://github.com/tuskyapp/Tusky/issues/1563

<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/cd50199f-e84f-4402-93e4-a5a1beba2a08"
width="280"/>
2024-06-05 19:36:58 +02:00
Konrad Pozniak adbe694471
correctly set currentContent in ComposeViewModel.setup (#4484)
Without this, the check that decides if the dialog on close should be
shown operates on incorrect data.

closes #4434
2024-06-05 19:36:48 +02:00
Ihor Hordiichuk 33e3327366 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (645 of 645 strings)

Translated using Weblate (Ukrainian)

Currently translated at 100.0% (645 of 645 strings)

Co-authored-by: Ihor Hordiichuk <igor_ck@outlook.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/uk/
Translation: Tusky/Tusky
2024-06-05 13:07:10 +00:00
Ümit Solmaz 2702150867 Translated using Weblate (Turkish)
Currently translated at 100.0% (645 of 645 strings)

Co-authored-by: Ümit Solmaz <usnotv@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/tr/
Translation: Tusky/Tusky
2024-06-05 13:07:10 +00:00
fin-w b39f1c3807 Translated using Weblate (Welsh)
Currently translated at 100.0% (645 of 645 strings)

Co-authored-by: fin-w <fin-w@tutanota.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/cy/
Translation: Tusky/Tusky
2024-06-05 13:07:10 +00:00
Hồ Nhất Duy 091831dd41 Translated using Weblate (Vietnamese)
Currently translated at 100.0% (645 of 645 strings)

Co-authored-by: Hồ Nhất Duy <mastoduy@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/vi/
Translation: Tusky/Tusky
2024-06-05 13:07:09 +00:00
Danial Behzadi 35a869028b Translated using Weblate (Persian)
Currently translated at 100.0% (645 of 645 strings)

Co-authored-by: Danial Behzadi <dani.behzi@ubuntu.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/fa/
Translation: Tusky/Tusky
2024-06-05 13:07:09 +00:00
Manuel bf2788d80b Translated using Weblate (Italian)
Currently translated at 100.0% (645 of 645 strings)

Translated using Weblate (Italian)

Currently translated at 100.0% (643 of 643 strings)

Co-authored-by: Manuel <mannivuwiki@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/it/
Translation: Tusky/Tusky
2024-06-05 13:07:09 +00:00
Konrad Pozniak 8aaca3bb2c
improve span highlighting (#4480)
At first I thought simply changing the regex might help, but then I
found more and more differences between Mastodon and Tusky, so I decided
to reimplement the thing. I added 74 testcases that I all compared to
Mastodon to make sure they are correct.

On an Fairphone 4 the new implementation is faster, on an Samsung Galaxy
Tab S3 slower.

Testcases for the benchmark:
```
test of a status with #one hashtag http
```
```
test
http:// #hashtag https://connyduck.at/
http://example.org
this is a #test
and this is a @mention@test.com @test @test@test456@test.com
```
```
@mention@test.social Just your ordinary mention with a hashtag
#test
```
```
@mention@test.social Just your ordinary mention with a url
https://riot.im/app/#/room/#Tusky:matrix.org
```



FP4:
```
       11.159   ns          15 allocs    Benchmark.new_1
      119.701   ns          43 allocs    Benchmark.new_2
       21.895   ns          24 allocs    Benchmark.new_3
       87.512   ns          32 allocs    Benchmark.new_4

       16.592   ns          46 allocs    Benchmark.old_1
      134.381   ns         169 allocs    Benchmark.old_2
       28.355   ns          68 allocs    Benchmark.old_3
       45.221   ns          77 allocs    Benchmark.old_4
```

SGT3:
```
       43,785   ns          18 allocs    Benchmark.new_1
      446,074   ns          43 allocs    Benchmark.new_2
       78,802   ns          26 allocs    Benchmark.new_3
      315,478   ns          32 allocs    Benchmark.new_4

       42,186   ns          45 allocs    Benchmark.old_1
      353,570   ns         157 allocs    Benchmark.old_2
       72,376   ns          66 allocs    Benchmark.old_3
      122,985   ns          74 allocs    Benchmark.old_4
```


benchmark code is here: https://github.com/tuskyapp/tusky-span-benchmark

closes https://github.com/tuskyapp/Tusky/issues/4425
2024-06-02 16:32:58 +02:00
XoseM 1a01c9debd Translated using Weblate (Galician)
Currently translated at 100.0% (643 of 643 strings)

Co-authored-by: XoseM <xosem@disroot.org>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/gl/
Translation: Tusky/Tusky
2024-05-31 12:46:52 +00:00
Ümit Solmaz 2db0bbcc39 Translated using Weblate (Turkish)
Currently translated at 100.0% (643 of 643 strings)

Co-authored-by: Ümit Solmaz <usnotv@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/tr/
Translation: Tusky/Tusky
2024-05-31 12:46:52 +00:00
Manuel 6a4e2d52d0 Translated using Weblate (Italian)
Currently translated at 100.0% (643 of 643 strings)

Co-authored-by: Manuel <mannivuwiki@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/it/
Translation: Tusky/Tusky
2024-05-31 12:46:52 +00:00
Konrad Pozniak b262b6cb9b
remove unused import (#4482)
this slipped in somehow
2024-05-31 14:49:20 +02:00
Konrad Pozniak 16fbbc6bf6
remove duplicate SHOW_NOTIFICATIONS_FILTER option (#4481)
The option was removed in https://github.com/tuskyapp/Tusky/pull/3877,
then forgotten to be added again in
https://github.com/tuskyapp/Tusky/pull/4015.
https://github.com/tuskyapp/Tusky/pull/4026 added it again, but took to
long to merge, so we made https://github.com/tuskyapp/Tusky/pull/4225 as
well and that is how we ended up with the option twice.
2024-05-31 13:44:25 +02:00
Levi Bard f14a82325d
Followed hashtags view improvements (#4475)
Add click and longpress handler to the followed hashtags view

#4459
2024-05-31 13:43:41 +02:00
Levi Bard b2d4092124
Fix bot badge in accounts in list fragment (#4474)
Fixes #4455
2024-05-31 13:42:37 +02:00
Christophe Beyls d200d1e15e
Prevent parallel loading and fix duplicate ViewModel state collection in FiltersActivity (#4472)
This pull request fixes the following issues:

- `FiltersActivity` launches a new coroutine to collect the ViewModel
state every time the Activity is resumed, without cancelling the
previous coroutine.
- `FiltersActivity` reloads the filters in `onResume()`, even if loading
is already in progress (without cancelling the current loading). This
can lead to inconsistent state.

List of improvements:
- Implement `launchAndRepeatOnLifecycle()` to combine
`coroutineScope.launch()` with `repeatOnLifecycle()` for the same
`Lifecycle`. Use it in `FiltersActivity` to update the view only when
the Activity is visible.
- Optimize the filters loading: load them when `FiltersViewModel` is
created and when returning from `EditFilterActivity` (when receiving the
Activity result). Cancel the load already in progress, if any.
- use `MutableStateFlow.update()` to update the state in a thread-safe
way.
- Turn `FiltersViewModel.deleteFilter()` into a suspending function in
order to perform the update in the coroutinescope of the Activity
lifecycle, so the View passed as argument doesn't leak.
- Wait for an ongoing load operation to complete before performing a
delete filter operation, so the state stays consistent.
- Add `Intent.withSlideInAnimation()` as a simpler and more flexible
alternative to `Activity.startActivityWithSlideInAnimation(Intent)`.
2024-05-31 13:42:21 +02:00
Konrad Pozniak 0483440381
fix timeline jumping (#4471)
Two things changed here:

The check for `positionStart`only in `onItemRangeInserted` is not always
correct - we only want to jump up when something is inserted at the top,
if we already are at the top.

`enablePlaceholders = false` has unintended side effects - the
recyclerview adapter sometimes receives an "onItemRangeRemoved" followed
by an "onItemRangeInserted", instead of just "onItemRangeChanged".

Together they should make sure the timelines stay were they are.
2024-05-31 13:41:22 +02:00
Christophe Beyls 83403ebb58
Clear View-related references in Fragments and use viewLifecycleOwner when applicable (#4470)
This pull request has main 2 goals related to improving the handling of
View lifecycles in Fragments:

- **Use viewLifecycleOwner when applicable**: every coroutine touching
Views in Fragments must be launched in the `coroutinescope` of
`viewLifecycleOwner` to avoid the following issues:
1. The code will crash if it references a View binding that is no more
available and keeps running after the Fragment view hierarchy has been
destroyed.
2. The code will leak Views if it references Views from its parent scope
after the Fragment view hierarchy has been destroyed.
3. Multiple instances of the same coroutine will run at the same time,
if the coroutine is launched in `onViewCreated()` from the wrong scope
and the view hierarchy is destroyed then re-created in the same Fragment
instance.
- **Clear View-related references in Fragments**: it is an error to keep
a reference to Views or any other class containing View references in
Fragments after `onDestroyView()`. It creates a memory leak when the
Fragment is added to the back stack or is temporarily detached. A
typical object that leaks Views is a RecyclerView's Adapter: when the
adapter is set on the RecyclerView, the RecyclerView registers itself as
a listener to the Adapter and the Adapter now contains a reference to
the RecyclerView that is not automatically cleared. It is thus
recommended to clear all these view references one way or another, even
if the Fragment is currently not part of a scenario where it is detached
or added to a back stack.

In general, having a `lateinit var` not related to Dagger dependency
injection in a Fragment is a code smell and should be avoided:
- If that `lateinit var` is related to storing something View-related,
it must be removed if possible or made nullable and set to `null` in
`onDestroyView()`.
- If that `lateinit var` is meant to store fragment arguments, it can be
turned into a `val by lazy{}`.
- If that `lateinit var` is related to fetching some information from
the Activity, it can be turned into a `val` with no backing field that
will simply call the activity when accessed. There is no need to store
the value in the Fragment.

When possible, View-related values must not be stored as Fragment
fields: all views should be accessed only in `onViewCreated()` and
passed as arguments to various listeners down the chain.

However, it's still required to use nullable fields **when the Fragment
exposes public methods that are called directly by an external entity**,
and these methods use the View-related value. Since the Fragment has no
control over when the external entity will call these public methods,
the field must never assumed to be non-null and null checks must be
added for every call. Note that exposing public methods on a Fragment to
be called directly is an antipattern, but switching to a different
architecture is out of scope of this pull request.

- Use `viewLifecycleOwner` in Fragments where applicable.
- Remove view-related fields and instead declare them in
`onViewCreated()` when possible.
- When not possible, declare view-related fields as nullable and set
them to `null` in `onDestroyView()`.
- Pass non-null View-related fields as arguments when possible, to not
rely on the nullable Fragment field.
- Replace `lateinit var` containing an Activity-related value with `val`
accessing the Activity directly on demand.
- Remove some unused fragment fields.
- Replace `onCreateView()` with passing the layout id as Fragment
constructor argument when possible.
- Replace `isAdded` checks with `view != null`. A Fragment being added
to an Activity doesn't mean it has a View hierarchy (it may be detached
and invisible).
- Remove `mediaPlayerListener` field in `ViewVideoFragment` and turn it
into a local variable. It is then passed into a
`DefaultLifecycleObserver` that replaces the `onStart()`/`onStop()`
overrides and is unregistered automatically when the view hierarchy is
destroyed.
2024-05-31 13:28:01 +02:00
Christophe Beyls 59184f1717
Fix incorrect theme override outside of MainActivity (#4469)
The pull request to integrate the SplashScreen library (#4413) required
overriding the theme before setting the layout in
`MainActivity.onCreate()`, in order to switch from `SplashTheme` to
`TuskyTheme`. Since the parent `BaseActivity` already contained code to
override the theme in case the user selects the "black" theme, that
logic was added at the same spot in `BaseActivity`.

However, since other Activities inherit from `BaseActivity` and
sometimes declare a different default theme than `TuskyTheme` in the
Manifest, the wrong theme was set for those Activities when not in Black
theme mode.

This pull request ensures that the theme will only be overridden to
`TuskyTheme` in `MainActivity`, the only Activity that uses a splash
screen.
2024-05-31 13:23:06 +02:00
Christophe Beyls c668cdc633
Optimize Glide emoji targets (#4467)
The current code loads emojis using Glide into basic custom `Target`s
and doesn't keep a hard reference to the Target. This creates a few
problems:
- Unlike images loaded into `ImageViewTarget`s, Emoji animations are not
paused when the Activity/Fragment becomes invisible. GIF decoding use
resources in the background.
- When `TextView`s get recycled in a RecyclerView, the loading of emojis
for the previous bind are not canceled when binding the new text and
starting the load of the new emojis. This is also handled automatically
when using `ImageViewTarget` but not for custom targets. Also, when the
obsolete emojis complete loading, the `TextView` will be unnecessarily
invalidated and redrawn.
- Since Glide's `RequestManager` doesn't keep hard references to Targets
after they are loaded and the emoji Target is currently not stored in
any View, emojis don't get an opportunity to clean up (at least stop
their animation) when the Activity/Fragment is destroyed. Depending on
the Drawable implementation, animations may run forever in the
background and cause memory leaks.

This pull request aims to properly track the lifecycle of emoji Targets,
cancel their loading an stop animations when appropriate. It also
reimplements `emojify()` to be more efficient.

- Add extension functions `View.setEmojiTargets()` and
`View.clearEmojiTargets()` to store and clear lists of emoji targets in
View tags, keeping a hard reference to them as long as the View is used.
When clearing emoji targets, pending requests will be canceled and
animations will be stopped to free memory. This is similar to what
`ImageViewTarget` does, except here multiple Targets are stored for a
single View instead of one.
- Add helper extension function `View.updateEmojiTargets()` to
automatically clear the View emoji targets, then allowing to call
`emojify()` one or more times in the `EmojiTargetScope` of that View,
and finally store all the pending targets of the `EmojiTargetScope` in
the View.
- Reimplement `CharSequence.emojify()` using
`View.updateEmojiTargets()`. This is used in RecyclerViews as well and
will automatically cancel previous emoji loadings for the same View and
stop animations.
- The main logic of `emojify()` has been moved to `EmojiTargetScope`.
Replace usage of slow regex `Matcher` with faster
`CharSequence.indexOf()`. Use `SpannableString` (with `toSpannable()`)
instead of `SpannableStringBuilder` to store the `EmojiSpan`s.
- Rename `EmojiSpan.getTarget()` to `EmojiSpan.createGlideTarget()` and
improve the target to stop/resume the animation according to the parent
component lifecycle, and stop the animation when clearing the target.
Use a hard reference to the view instead of a weak reference, since the
lifecycle of the Target now matches the one of the View and the Target
will be cleared at the latest when the View is destroyed.
- Use `View.updateEmojiTargets()` in `ReportNotificationViewHolder` in
order to store the targets of 2 separate sets of emojis into the same
TextView.
- Fix: reimplement the code to merge the 2 emoji sets into a single
`CharSequence` in `ReportNotificationViewHolder` using
`TextUtils.expandTemplate()`. The current code uses `String.format()`
which returns a String instead of a Spannable so the computed emojis are
lost.
- Store the emoji targets in `AnnouncementAdapter` in the parent view
after clearing the previous ones. It is a better location than storing
one emoji target in each child `Tooltip` view because tooltips are not
recycled when refreshing the data and the previous targets would not be
canceled properly.
- Bonus: update `ViewVideoFragment` to use `CustomViewTarget` instead of
`CustomTarget` to load the default artwork into `PlayerView`. The
loading will also automatically be canceled when the fragment view is
detached.
2024-05-31 13:22:32 +02:00
Christophe Beyls 2cbd629150
Replace Either with Kotlin Result and optimize ListUtils (#4443)
Using `Either<Throwable, T>` is basically the same as `Result<T>` with a
less friendly API. Futhermore, `Either` is currently only used in a
single component.

- Replace `Either` with `Result` in `AccountsInListFragment` and
`AccountsInListViewModel`.
- Add a method to convert a `NetworkResult` to a `Result` in
`AccountsInListViewModel`. Alternatively, `NetworkResult` could be used
everywhere in the code but other classes are already using `Result`.
- Replace `updateState()` method with `MutableStateFlow.update()` in
`AccountsInListViewModel`.
- Store the current search query in a `MutableStateFlow` collected by a
coroutine. This allows automatically cancelling the previous search when
a new query arrives, instead of launching a new coroutine for each query
which may conflict with the previous ones.
- Optimize `ListUtils`.
2024-05-31 12:58:24 +02:00
Manuel e8a2c8ba47 Translated using Weblate (Italian)
Currently translated at 100.0% (643 of 643 strings)

Co-authored-by: Manuel <mannivuwiki@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/it/
Translation: Tusky/Tusky
2024-05-26 06:04:47 +00:00
Ümit Solmaz 85559456cd Translated using Weblate (Turkish)
Currently translated at 100.0% (643 of 643 strings)

Co-authored-by: Ümit Solmaz <usnotv@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/tr/
Translation: Tusky/Tusky
2024-05-26 06:04:47 +00:00
fin-w 62e33d56f3 Translated using Weblate (Welsh)
Currently translated at 100.0% (643 of 643 strings)

Co-authored-by: fin-w <fin-w@tutanota.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/cy/
Translation: Tusky/Tusky
2024-05-26 06:04:47 +00:00
Konrad Pozniak 32dea86502
Improve translating posts via Mastodon api (#4463)
This does 4 things:

- Alt text is now translated when opening media of translated posts.
Previously only the long-press alt text was translated.
- The translate button is now hidden on non-public posts. The Mastodon
api returns 403 there.
- Translated posts will only be collapsible when the original was
collapsible as well. It is just weird when an "show more" button
suddenly appears because the post got longer by translating it.
- The translation status and the untranslate button are now shown below
each other instead of next to each other. Looks way better on smaller
display or long texts.

Before / After
<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/2cadd15b-2e28-4989-9bd3-d3bdd4c75329"
width="320"/> <img
src="https://github.com/tuskyapp/Tusky/assets/10157047/0ecab094-6c96-49a5-bc99-aa56b7fe2ec2"
width="320"/>
2024-05-26 08:06:51 +02:00
Konrad Pozniak 9805bc2cce
fix deserializing null focus values (#4462)
Found a post with this weird media focus in the wild on chaos.social:

```
"focus": {
    "x": 0.0,
    "y": null
}
```

```
com.squareup.moshi.JsonDataException: Expected a double but was NULL at path $[0].media_attachments[0].meta.focus.y
         at com.squareup.moshi.JsonUtf8Reader.nextDouble(JsonUtf8Reader.java:787)
         at com.squareup.moshi.StandardJsonAdapters$6.fromJson(StandardJsonAdapters.java:167)
         at com.squareup.moshi.StandardJsonAdapters$6.fromJson(StandardJsonAdapters.java:164)
         at com.keylesspalace.tusky.entity.Attachment_FocusJsonAdapter.fromJson(Attachment_FocusJsonAdapter.kt:37)
         at com.keylesspalace.tusky.entity.Attachment_FocusJsonAdapter.fromJson(Attachment_FocusJsonAdapter.kt:20)
         at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:41)
         at com.keylesspalace.tusky.entity.Attachment_MetaDataJsonAdapter.fromJson(Attachment_MetaDataJsonAdapter.kt:54)
         at com.keylesspalace.tusky.entity.Attachment_MetaDataJsonAdapter.fromJson(Attachment_MetaDataJsonAdapter.kt:23)
         at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:41)
         at com.keylesspalace.tusky.entity.AttachmentJsonAdapter.fromJson(AttachmentJsonAdapter.kt:66)
         at com.keylesspalace.tusky.entity.AttachmentJsonAdapter.fromJson(AttachmentJsonAdapter.kt:22)
         at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:41)
         at com.squareup.moshi.CollectionJsonAdapter.fromJson(CollectionJsonAdapter.java:81)
         at com.squareup.moshi.CollectionJsonAdapter$2.fromJson(CollectionJsonAdapter.java:55)
         at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:41)
         at com.keylesspalace.tusky.entity.StatusJsonAdapter.fromJson(StatusJsonAdapter.kt:195)
         at com.keylesspalace.tusky.entity.StatusJsonAdapter.fromJson(StatusJsonAdapter.kt:26)
         at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:41)
         at com.squareup.moshi.CollectionJsonAdapter.fromJson(CollectionJsonAdapter.java:81)
         at com.squareup.moshi.CollectionJsonAdapter$2.fromJson(CollectionJsonAdapter.java:55)
         at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:41)
         at retrofit2.converter.moshi.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:46)
         at retrofit2.converter.moshi.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:27)
         at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:246)
         at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:156)
         at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
         at java.lang.Thread.run(Thread.java:919)
```
2024-05-26 08:06:38 +02:00
Konrad Pozniak d554d71958
inject SharedPreferences (#4441)
(this one is for @charlag)

Calling `PreferenceManager.getDefaultSharedPreferences()` will read the
preference file from disk every time. This PR makes `SharedPreferences`
a singleton so they will only be created once at appstart (with a few
exceptions where it is hard to inject, e.g. in the `openLink` helper)
which should help getting our ANRs down.

```
StrictMode policy violation; ~duration=285 ms: android.os.strictmode.DiskReadViolation
    at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1666)
    at libcore.io.BlockGuardOs.access(BlockGuardOs.java:74)
    at libcore.io.ForwardingOs.access(ForwardingOs.java:128)
    at android.app.ActivityThread$AndroidOs.access(ActivityThread.java:8054)
    at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:313)
    at java.io.File.exists(File.java:813)
    at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:790)
    at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:781)
    at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:737)
    at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:962)
    at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:583)
    at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:221)
    at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:221)
    at androidx.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:119)
    at com.keylesspalace.tusky.BaseActivity.onCreate(BaseActivity.java:96)
   ...
```
2024-05-24 08:05:09 +02:00
Konrad Pozniak 78b1fcb9c6
Upgrade kotlin to v2 (#4461) 2024-05-23 21:51:25 +02:00