Commit Graph

1758 Commits

Author SHA1 Message Date
mcclure 70f8e8ba93
Implement new policy: The database version number is always even (#4128)
Posted this as issue #3999 before. The reasoning is personal experiments
and forks may add database fields and must bump the database number to
do so, but this causes massive merge difficulties when Tusky then
inevitably itself bumps the number. To alleviate this, Tusky official
should use only even database numbers, so odd versions are available for
third party scribbling.

There was little discussion positive or negative in #3999 (one proposal
we switch to a date-based number system, which would work but also could
be unnecessarily complicated). With PR #4115 we now have to make a
decision because that's the first post-proposal PR to bump the database
number odd. So, since I see no outright objections, I'd like to
implement this.

@connyduck suggested the best way to implement the proposal would be to
add a comment to the version number's home in AppDatabase.java.

Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
2024-01-03 22:21:18 +01:00
Konrad Pozniak 1f698e0732
show post language in metadata (#4127)
closes https://github.com/tuskyapp/Tusky/issues/3096

<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/417c55a9-168b-4ada-9636-de6314698def"
width="320">
2024-01-03 21:17:28 +01:00
UlrichKu 0698333665
3488 improve profile list (#3507)
Fixes #3488 

Working with lists from a profile page and in the normal "lists view"
from the drawer now use the same fragment view code.

(also) RFC regarding joining different list lists


![grafik](https://user-images.githubusercontent.com/1618905/229463168-397bd943-82d8-4e05-a8bf-9fcf22f6c1f9.png)
2024-01-03 21:17:03 +01:00
sanao e8e7bad110
feat: Change name of Preferences > Filters > Tabs and move them to Account Preferences(#3536) (#4115)
# Overview
In the previous code, when you open preferences, there is a section
headed "Filters" with a section called "Tabs"

This is confusing.

# Changes
- Change the section title from "Filters" to "Per-timeline preferences."
- Change the current "Tabs" section to "Home timeline" since it is only
for home timelines

# Screenshots
account preference screen | detail screen
:--: | :--:
|<image
src="https://github.com/tuskyapp/Tusky/assets/62137820/12694f24-b7e3-4ba3-90f5-53740e9c4269"
width="250" />|<image
src="https://github.com/tuskyapp/Tusky/assets/62137820/796e9ac1-76d6-43ef-a087-a1cd2d899ef8"
width="250" />

# Note
- Maybe string resources should have a new property? (for translation)

# Related link
 Fixes #3536

---------

Co-authored-by: mcc <andi.m.mcclure@gmail.com>
2024-01-03 21:14:13 +01:00
Konrad Pozniak 004659a54d
fix Glide IllegalArgumentException in DrawerImageLoader (#4189)
Turns out that the crash I thought will not occur with #4153 did occur
again. 😒
But this time I managed to reproduce it (faking a slow network for that
one request only and then quickly switching activities to get it
destroyed) so I'm sure it is fixed, and I did a check for possible side
effects but it seems Glide is clever enough to cancel all requests by
itself.

<details>
<summary>stacktrace</summary>

```
Exception java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity
  at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed (RequestManagerRetriever.java:236)
  at com.bumptech.glide.manager.RequestManagerRetriever.get (RequestManagerRetriever.java:110)
  at com.bumptech.glide.manager.RequestManagerRetriever.get (RequestManagerRetriever.java:176)
  at com.bumptech.glide.Glide.with (Glide.java:634)
  at com.keylesspalace.tusky.MainActivity$setupDrawer$2.cancel (MainActivity.kt:573)
  at com.mikepenz.materialdrawer.util.DrawerImageLoader.cancelImage (DrawerImageLoader.java:56)
  at com.mikepenz.materialdrawer.model.BaseDescribeableDrawerItem.unbindView (BaseDescribeableDrawerItem.kt:95)
  at com.mikepenz.materialdrawer.model.BaseDescribeableDrawerItem.unbindView (BaseDescribeableDrawerItem.kt:20)
  at com.mikepenz.fastadapter.listeners.OnBindViewHolderListenerImpl.unBindViewHolder (OnBindViewHolderListenerImpl.java:36)
  at com.mikepenz.fastadapter.FastAdapter.onViewRecycled (FastAdapter.kt:410)
  at androidx.recyclerview.widget.RecyclerView$Recycler.dispatchViewRecycled (RecyclerView.java:7346)
  at androidx.recyclerview.widget.RecyclerView$Recycler.addViewHolderToRecycledViewPool (RecyclerView.java:7108)
  at androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal (RecyclerView.java:7059)
  at androidx.recyclerview.widget.RecyclerView.removeAnimatingView (RecyclerView.java:1556)
  at androidx.recyclerview.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished (RecyclerView.java:13564)
  at androidx.recyclerview.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished (RecyclerView.java:14066)
  at androidx.recyclerview.widget.SimpleItemAnimator.dispatchChangeFinished (SimpleItemAnimator.java:328)
  at androidx.recyclerview.widget.DefaultItemAnimator.endChangeAnimationIfNecessary (DefaultItemAnimator.java:437)
  at androidx.recyclerview.widget.DefaultItemAnimator.endChangeAnimationIfNecessary (DefaultItemAnimator.java:418)
  at androidx.recyclerview.widget.DefaultItemAnimator.endAnimations (DefaultItemAnimator.java:588)
  at androidx.recyclerview.widget.RecyclerView.onDetachedFromWindow (RecyclerView.java:3383)
  at android.view.View.dispatchDetachedFromWindow (View.java:20898)
  at android.view.ViewGroup.dispatchDetachedFromWindow (ViewGroup.java:3956)
  at android.view.ViewGroup.dispatchDetachedFromWindow (ViewGroup.java:3948)
  at android.view.ViewGroup.dispatchDetachedFromWindow (ViewGroup.java:3948)
  at android.view.ViewGroup.dispatchDetachedFromWindow (ViewGroup.java:3948)
  at android.view.ViewGroup.dispatchDetachedFromWindow (ViewGroup.java:3948)
  at android.view.ViewGroup.dispatchDetachedFromWindow (ViewGroup.java:3948)
  at android.view.ViewGroup.dispatchDetachedFromWindow (ViewGroup.java:3948)
  at android.view.ViewGroup.dispatchDetachedFromWindow (ViewGroup.java:3948)
  at android.view.ViewRootImpl.dispatchDetachedFromWindow (ViewRootImpl.java:5114)
  at android.view.ViewRootImpl.doDie (ViewRootImpl.java:8309)
  at android.view.ViewRootImpl.die (ViewRootImpl.java:8286)
  at android.view.WindowManagerGlobal.removeViewLocked (WindowManagerGlobal.java:538)
  at android.view.WindowManagerGlobal.removeView (WindowManagerGlobal.java:479)
  at android.view.WindowManagerImpl.removeViewImmediate (WindowManagerImpl.java:162)
  at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:5564)
  at android.app.ActivityThread.handleRelaunchActivityInner (ActivityThread.java:5842)
  at android.app.ActivityThread.handleRelaunchActivity (ActivityThread.java:5758)
  at android.app.servertransaction.ActivityRelaunchItem.execute (ActivityRelaunchItem.java:71)
  at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2293)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:329)
  at android.app.ActivityThread.main (ActivityThread.java:8058)
  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:1026)
```

</details>
2023-12-24 09:19:08 +01:00
Max Malekzadeh 5cce62bc6a
Add copyright notices in source file headers (Fixes issue #4188) (#4190) 2023-12-24 09:18:09 +01:00
Konrad Pozniak 0f3f2238e2
fix ClassCastException in ClickableSpanTextView (#4185)
<details>
  <summary>Stacktrace</summary>
  
  ```
java.lang.ClassCastException: java.lang.String cannot be cast to
android.text.Spannable
at
com.keylesspalace.tusky.view.ClickableSpanTextView.dispatchTouchEvent(ClickableSpanTextView.kt:208)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
				at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2600)
at
com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:448)
at
com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1829)
				at android.app.Activity.dispatchTouchEvent(Activity.java:3307)
at
androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:70)
at
com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:410)
				at android.view.View.dispatchPointerEvent(View.java:12015)
at
android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4795)
at
android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4609)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
at
android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166)
at
android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4293)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174)
at
android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4350)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
at
android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6661)
  ```
  
</details>

Could not reproduce with a regular build because I couldn't find the
place where we set a string into a ClickableSpanTextView, so I created
that scenario manually. It crashed instantly when trying to select text,
and with this fix it behaved as expected.
2023-12-23 15:23:16 +01:00
Konrad Pozniak 9781e43441
fix ANR caused by direct message badge (#4182)
Saw an ANR (app not responding) error being reported in the Play console
and then found this. Sorry but `runBlocking` in production code is an
absolute no go.
2023-12-21 19:02:28 +01:00
Konrad Pozniak cce811e0a5
fix icon alignment in help text of empty timelines (#4179)
@Lakoja do you remember why you added that version check? Removing it
fixes the bug.

Before / after
<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/b2c2f79e-7f30-47fb-89ef-b5e4c31b0d0e"
width="200"/> <img
src="https://github.com/tuskyapp/Tusky/assets/10157047/3bb746f8-97e7-4d60-a67e-175e02a6d929"
width="200"/>

closes #4175
2023-12-16 15:26:22 +01:00
Konrad Pozniak 6a98427fa5
fix crash when opening profile image (#4172)
```
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.keylesspalace.tusky.test/com.keylesspalace.tusky.ViewMediaActivity}: java.lang.NullPointerException
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
	at android.app.ActivityThread.-wrap11(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:164)
	at android.app.ActivityThread.main(ActivityThread.java:6494)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NullPointerException
	at com.keylesspalace.tusky.ViewMediaActivity.adjustScreenWakefulness(ViewMediaActivity.kt:351)
	at com.keylesspalace.tusky.ViewMediaActivity.onCreate(ViewMediaActivity.kt:161)
	at android.app.Activity.performCreate(Activity.java:7009)
	at android.app.Activity.performCreate(Activity.java:7000)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
	at android.app.ActivityThread.-wrap11(Unknown Source:0) 
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
	at android.os.Handler.dispatchMessage(Handler.java:106) 
	at android.os.Looper.loop(Looper.java:164) 
	at android.app.ActivityThread.main(ActivityThread.java:6494) 
	at java.lang.reflect.Method.invoke(Native Method) 
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
```
2023-12-15 07:41:38 +01:00
Konrad Pozniak 331b13621e
Prevent device from dimming or sleeping screen while video/audio playing (but really) (#4168)
For reasons not totally clear to me, Github marked #4160 as "merged" and
will not let me reopen it.

I believe this should be included for 24.1 because it fixes a 24.0
regression in the media player.

I have tested this newest commit in a number of ways, and in my testing
I find (1) when viewing an image, it sleeps after about a minute (2)
when viewing video, it stays awake indefinitely (3) this is true whether
the image/video was opened directly, or reached by swiping from another
attachment. I have not tested swiping to/from audio but I am confident
it will work the same.
2023-12-13 19:23:11 +01:00
Konrad Pozniak 0c900842ec
fix text selection crash on older Androids (#4166)
I hate these workarounds for Android bugs, I'm always afraid the will
introduce other problems. I tested this on multiple Android versions, it
definitely fixes the problem and otherwise seems fine though.

closes #4164
2023-12-13 19:22:54 +01:00
mcc 877e7c6ec1 Adjust ViewMediaActivity FLAG_KEEP_SCREEN_ON logic to support swipe gestures 2023-12-12 18:01:18 -05:00
mcc b9a593d6b0 ktLint fix 2023-12-10 18:13:46 -05:00
mcc 90f35ed009 Media3/exoplayer introduced a regression where the device can sleep while video/audio are playing. Patch restores v23 behavior 2023-12-10 13:56:02 -05:00
Konrad Pozniak 75c42cb5c1
prevent MainActivity from leaking through the DrawerImageLoader singleton (#4153)
Another fix for a memory leak. This one is not as big as #4150, but
still worth fixing for memory constrained devices imo.
The `DrawerImageLoader` implementation (a global singleton) references a
member of the `MainActivity`, causing the whole activity to leak.

This weird construct was introduced in #1989 to fix a crash, but I think
since we migrated to coroutines it is no longer necessary because all
calls get correctly cancelled. I tried reproducing the crash but could
not, so I'm pretty sure it is fine. I would appreciate it if someone
else could try it as well though.

(The crash could be reproduced on slow internet, when
`onFetchUserInfoSuccess` was called while the activity was being
destroyed, causing Glide to crash the app because it can't use destroyed
activities. `onFetchUserInfoSuccess` is now no longer called in this
case because it is inside a `lifecycleScope.launch` block.)
2023-12-10 09:44:53 +01:00
Konrad Pozniak ee3760fcc9
correctly count emojis when composing a post (#4152)
Thx to @evant for the help 

closes #4140
2023-12-10 07:38:25 +01:00
Konrad Pozniak db27186b5c
fix memory leak in CompositeWithOpaqueBackground (#4150)
Found with Leak canary: The transformation ends up in Glide's memory
cache and leaks whole Activities through the view -> context reference.

This fixes the problem by removing the background detection logic (so
the view reference is no longer needed) and setting the background
directly instead. Looks exactly as before.
2023-12-10 07:37:54 +01:00
Konrad Pozniak 6463e99c53
don't rehide filtered posts on interaction (#4130)
closes #4125
2023-12-05 19:29:01 +01:00
Konrad Pozniak e1f2d639aa
fix image scaling after swipe down gesture ended in ViewImageFragment (#4135)
closes #4132
2023-12-05 19:28:52 +01:00
Konrad Pozniak 5dbdce2e2f
fix images in ViewImageFragment disappearing when switching apps (#4126)
I tried to ind out why the imageview was cleared here but to no avail.
Removing it also doesn't seems to have unwanted sideeffects 🤷
2023-11-29 18:39:10 +01:00
Konrad Pozniak 6616df4a82
fix crash when rotating caption dialog (#4123)
Steps to reproduce: Open the dialog to set a catption on an image.
Rotate the screen.

<details>
  <summary>Stacktrace</summary>
  
```
Exception 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.components.compose.dialog.CaptionDialog.onCreateView (CaptionDialog.kt:61)
  at androidx.fragment.app.Fragment.performCreateView (Fragment.java:3114)
  at androidx.fragment.app.DialogFragment.performCreateView (DialogFragment.java:775)
  at androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:557)
  at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:272)
  at androidx.fragment.app.FragmentStore.moveToExpectedState (FragmentStore.java:114)
  at androidx.fragment.app.FragmentManager.moveToState (FragmentManager.java:1455)
  at androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:3034)
  at androidx.fragment.app.FragmentManager.dispatchActivityCreated (FragmentManager.java:2952)
  at androidx.fragment.app.FragmentController.dispatchActivityCreated (FragmentController.java:263)
  at androidx.fragment.app.FragmentActivity.onStart (FragmentActivity.java:350)
  at androidx.appcompat.app.AppCompatActivity.onStart (AppCompatActivity.java:251)
  at android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1543)
  at android.app.Activity.performStart (Activity.java:8682)
  at android.app.ActivityThread.handleStartActivity (ActivityThread.java:4219)
  at android.app.servertransaction.TransactionExecutor.performLifecycleSequence (TransactionExecutor.java:221)
  at android.app.servertransaction.TransactionExecutor.cycleToPath (TransactionExecutor.java:201)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:173)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2584)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8810)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:604)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)
```
  
</details>

Restoring the saved caption after the view was created fixes the
problem.
2023-11-29 18:38:55 +01:00
mcclure 70725fd75b
Regularize show/hide logic for video player scrub/play controls (fixes #4073) (#4117)
When viewing a video in Tusky, there is a top toolbar where the
description is shown and the bottom toolbar where play, forward,
backward, and scrub controls are found. In both Tusky 23 and the new
media3 video player code, the logic for showing these toolbars is
*unrelated*; Tusky catches tap events and shows and hides the
description, and the Android media library separately catches tap events
and shows and hides the bottom toolbar. Meanwhile, Tusky and the Android
media library each separately manage a set of logic for auto-hiding
their respective toolbars after a certain number of seconds has passed.
This all results in several problems:

- The top and bottom toolbars can desync, so that one is visible and the
other is not, and tapping to show/hide after this will only swap which
one is visible. This happens *every* time you switch to another
application then back to Tusky while the video player is up.
- You can also desync the top and bottom toolbars in this way by simply
tapping very rapidly.
- The autohide logic was difficult for us to control or customize,
because it was partially hidden inside the Android libraries (relevant
because under media3, the autohide delay increased from 3 to something
like 5 or 6 seconds).

In this patch, I disabled all auto- and tap-based show/hide logic in
media3 and set the Tusky-side show/hide to directly control the media3
toolbar. I then audited the code with printfs until I understood the
state machine of show/hide, and removed anything irrational (some code
was either unreachable, or redundant; either these lines were broken in
the media3 transition, or they never worked).¹

While doing this, I made two policy changes:

- As discussed on Matrix, the autohide delay is now 4 seconds. (In
discussions with users on Mastodon, some complained the previous 3
seconds was too short; but in my opinion and [I think?] charlag's, the
new 5 seconds is too long).
- In the pre-existing code, if the user has hidden the controls, and
they switch to another app and back, the controls display for 4 seconds
then re-hide themselves, just like if the video had been presented for
the first time. I think this is good and kept it— *however* I made a
decision if the user intentionally taps to display the controls, *then*
switches to another app and back, the controls should *not* auto-hide,
because the user most recently requested those controls be shown.

Tests I performed on the final PR (successfully):

- Start video. Expect: toolbar+description hides after 4 seconds.
- Start video. Pause. Resume. Expect: t+d hides after 4 seconds.
- Start video. Wait 4 seconds until t+d hide. Switch to other app.
Switch back. Expect: t+d reappears, then hides after 4 seconds.
- Start video. Wait 4 seconds until t+d hide. Tap to show t+d. Switch to
other app. Switch back. Expect: t+d appear, do NOT autohide.
- Start video. Before 4 seconds up, switch to other app. Switch back.
Expect: t+d reappears, then hides after 4 seconds.
- Start video. Pause. Resume. Before 4 seconds up, switch to other app.
Switch back. Expect: t+d reappears, then hides after 4 seconds.
- Start video. Wait 4 seconds until t+d hide. Tap rapidly over and over
for many seconds. Expect: Nothing weird
- Start *audio*. Expect: At no point does controller autohide, not even
if I switch to another app and back, but I can hide it by manually
tapping

These tests were performed on Android 13. There is an entirely separate
`Build.VERSION.SDK_INT <= 23` path I did not test, but Android Studio
says this is dead code (I think it thinks our minimum SDK is higher than
that?)

---

<small>¹ Incidentally, the underlying cause of #4073 (the show/resume
part of it anyway) turned out to be that the STATE_READY event was being
received not just on video load but also a second time on app resume,
causing certain parts of the initialization code to run a second time
although the fragment had already been fully initialized.</small>
2023-11-23 08:32:01 +01:00
UlrichKu 8efe3a96b7
3820: Group android notifications and properly use the "group summary alert" (#3821)
Fixes #3820 

This mainly corrects the "first of batch" logic.
(Each group/batch has a list so the question "only one per this group?"
can be answered.)
2023-11-23 08:25:00 +01:00
Levi Bard 21a4308fef
Fix deserialization of the response from friendica on api/v2/instance (#4103)
Fixes #4100

---------

Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
2023-11-13 10:05:28 +01:00
sanao ff39f9b3c2
feat: Hide self-boosts (#3534) (#4101)
# Overview
Some Mastodon posters have a annoying habit of boosting their own posts
some time after they've posted them.
 No need to see the same toot over and over again.

# Changes made
- Add an additional option to the "Filters > Tabs" preference to show
these self-boosts (default: on)
- If "Show boosts" is turned off, self-boosts are automatically hidden.
    
# Screenshot
***screen of "Filters > Tabs" preference***
before | after
:--: | :--:
| <image
src="https://github.com/tuskyapp/Tusky/assets/62137820/16ed2f4a-0776-4f60-afe6-29827acf5bbd"
width="300"> |<image
src="https://github.com/tuskyapp/Tusky/assets/62137820/9d4e1457-f71d-440c-959f-b91f7433b29a"
width="300" />

***screen of Home Timeline***
***switch-on(self-boosts are displayed)*** | ***swith-off(self-boosts
are not displayed)***
:--: | :--:
| <image
src="https://github.com/tuskyapp/Tusky/assets/62137820/3bb80791-a81f-4cbc-98ad-8a14602e53a4"
width="300" />|<image
src="https://github.com/tuskyapp/Tusky/assets/62137820/a7964da8-d106-4209-b911-460ef8988831"
width="300" />

# Related issue
 Fixes #3534
2023-11-13 10:04:39 +01:00
Konrad Pozniak de70f08066
make blockquotes pretty (#4091)
closes https://github.com/tuskyapp/Tusky/issues/1271

before:
<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/bfb4dcab-a6a7-4373-acf2-337363d63908"
width="380"/>

after:
<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/79d90c22-dfd6-44fa-a600-a0e13d992bfc"
width="380"/>
2023-11-01 09:22:48 +01:00
Konrad Pozniak 6773342b60
Support code blocks (#4090)
before
<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/452b959f-7f97-4d04-a464-0dcf0bf56f79"
width="380"/>

after
<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/0fb5b41c-dda3-4d46-878e-689d6ae51b0a"
width="380"/>
2023-11-01 09:22:23 +01:00
Levi Bard 0301bed0ac
Fix showing filtered (warn) boosts in timelines (#4079) 2023-10-30 08:42:16 +01:00
Levi Bard 55ed6841ff
Support "replies policy" for lists (#4072) 2023-10-26 11:21:04 +02:00
Levi Bard 131ebabe85
Add support for v2/instance (#4062)
…with fallback to v1
2023-10-25 12:53:10 +02:00
Markus Unterwaditzer 6e6cf05d11
Remove garbage alt text from images attached via Gboard (#4068)
Steps to reproduce:

1. install Gboard

(https://play.google.com/store/apps/details?id=com.google.android.inputmethod.latin)

2. open a direct link to any image in Firefox
3. long-press the image to get a "Copy Image" dialogue (and copy the
   image)
4. compose a new post in Tusky
5. Gboard will suggest to paste the image from clipboard
6. paste image, see that when opening alt text editor, it is filled out
   with this garbage string

Why is this bad? It's not when I just fix the alt text. But it breaks
every mechanism that is supposed to remind me of adding alt text.

It's hard to argue that this is within scope of Tusky but I also don't
see it getting fixed in Gboard, so here we go.
2023-10-25 12:52:42 +02:00
UlrichKu 73ce9ffda5
4063: Make dialog size more stable (#4066)
Fixes: #4063

Switching from an AlertDialog to only a DialogFragment.

I didn't get the AlertDialog to be sized correctly.
It also opens now directly with the right (full screen) size. When the
imageView fails to load (i.e. with an audio file) it will be hidden.

This changes the button layout somewhat.

One observation: The placeholder text "... visually impaired..." is not
quite right as a description for an audio file is not intended for the
visually impaired. But I couldn't think of a better text just yet.


![grafik](https://github.com/tuskyapp/Tusky/assets/1618905/fd49d5bd-b86c-4659-abb9-f1776cbb2a55)
2023-10-25 11:59:59 +02:00
UlrichKu b286255630
3532: Show badge on conversations tab on new conversations (#3890)
Fixes #3532

(Old PR, now closed: https://github.com/tuskyapp/Tusky/pull/3533)

Listens on new notifications and if a "direct mention" is detected a
badge (red dot) is shown on the conversations tab if present.

I am missing things like this a lot and also big accounts are unhappy
with the usability so far:
https://mastodon.social/@pallenberg/110129889996182814
2023-10-15 21:39:38 +02:00
Konrad Pozniak ff1c4a4b27
fix theme preference defaults (#4061)
closes #4060 

Also I noticed that we had the theme defaults twice in the code so I
refactored a bit so only one are still in there.
2023-10-14 14:20:20 +02:00
UlrichKu 81a04c8977
2512: Allow more than 5 tabs (#4051)
Fixes #2512 


![grafik](https://github.com/tuskyapp/Tusky/assets/1618905/f8199d10-e26a-4f14-93c3-95cb890ea663)

Can add an arbitrary number of tabs.
Graphical behavior is unchanged for small numbers: the whole space if
filled with the tabs - they are enlarged if needed.

If there are more the mode switches to "scrollable".
This does not, however, look very differently (see screenshot with the
current tab scrolled out).

---------

Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
2023-10-11 09:54:01 +02:00
sanao 3f7480fb73
Displayed the date of each announcement. (#4041)
## Issue
Close #3967 

# What I did
- Displayed the date of each announcement.
  - Date is placed in the lower left corner of the Announcement
- Supported date format internationalization using
getBestDateTimePattern

# Screenshot
<image
src="https://github.com/tuskyapp/Tusky/assets/62137820/7c124183-1a13-4cae-8667-ff82ca99b60c"
width="500"/>

## Note
I am not good at English so I use machine translation a bit. So, you may
find my writing style a little strange...
2023-10-10 19:17:06 +02:00
Konrad Pozniak 9412ffba0f
fix boost button not updating when boosting (#4048) 2023-10-07 08:59:36 +02:00
Levi Bard 1badf68531
Refresh timelines when filters are added/edited/removed (#3552)
Fixes #3546
2023-09-28 20:01:44 +02:00
UlrichKu 2dc27bca2a
use link icon instead of emoji when showing hidden urls (#4031)
Looks way better imho. Also closes #4028.

Before vs After:


![Screenshot_20230924_163714](https://github.com/tuskyapp/Tusky/assets/10157047/5b0b745a-4574-4e37-988e-b04997ac55f1)


![Screenshot_20230924_162657](https://github.com/tuskyapp/Tusky/assets/10157047/58a3482f-6afb-4b10-9891-f7a86af7f2bf)
2023-09-26 21:46:05 +02:00
Levi Bard 2dceecb591
Fix build after logical conflict (#4036)
Ugh, I didn't notice that #3480 was affected by the notification
fragment rollback
2023-09-26 20:04:06 +02:00
Konrad Pozniak 54e92b2156
improve local status updates (#3480)
The idea here is: Everytime we get hold of a new version of a post, we
update everything about that post everywhere.
This makes the distincion between different event types unnecessary, as
everythng is just a `StatusChangedEvent`.
The main benefit is that posts should be up-to-date more often, which is
important considering there is now editing and #3413
2023-09-26 09:08:58 +02:00
Konrad Pozniak 5764c903e1
add role badges (#4029)
This adds support for the new Mastodon 4.2 role badges. Admins can
define if a role should be visible in the interface and then we get it
delivered by the Api on the `Account` object like this:
```
"roles": [
        {
              "id": "4",
              "name": "TEST",
              "color": "#ffee00"
        }
  ]
```

- keeps compatibility with older Mastodon version and non Mastodon
servers
- Took me a while, but I figured out a way to use the color and have it
look ok on all backgrounds (Mastodon itself ignores the color and just
always uses its brand color)
- falls back to Tusky blue in case no color is configured
- I adjusted the "Follows you" and "Bot" badges so they match the new
badge style
- In case the "Follows you" and "Bot" badges are visible at the same
time, "Follows you" gets its own line and "Bot" goes into the same line
as the role badge.
- Will work even with a lot of role badges (right now users can only
have 1 role at once though)
- Will work even when the badges federate (right now they don't)

<img
src="https://github.com/tuskyapp/Tusky/assets/10157047/24cbe889-ae46-408e-bfa0-cf3fd3c24f74"
width="320" />
2023-09-25 09:47:27 +02:00
UlrichKu 82bc48c3ae
Avoid crash on notification worker (#4025)
Not quite sure why/when this happens - every stack trace is not our
code, but I do get an ClassNotFoundException for Notification$Type with
the new reverted code.

The notification fetching (worker) then stops/crashes so I never get an
Android notification.

It might have something to do with
https://github.com/tuskyapp/Tusky/pull/3732 ?
2023-09-25 09:44:01 +02:00
Conny Duck 31ad946e1a use link icon instead of emoji when showing hidden urls 2023-09-24 16:28:53 +02:00
Angelo Suzuki fa80a0123a
Add "Trending posts" (statuses) feed (#4007)
Add "Trending posts" (statuses) feed.

This feed is a good source of interesting accounts to follow and,
personally, a sort of "Front page of the Fediverse".

Since #3908 and #3910 (which would provide a more thorough, albeit
complex, access to trending things) won't get merged, I'd like to
address this missing feed by simply adding another tab/feed.

~~If desired, I can move the second commit (fixing lint) to another
PR.~~

## Screenshots
### Tab
<img
src="https://github.com/tuskyapp/Tusky/assets/1063155/6a71a97e-673e-44c7-b67d-9b1df0bed4f5"
width=320 /> <img
src="https://github.com/tuskyapp/Tusky/assets/1063155/9bf60b23-d2f3-4dd8-8af6-e96647b02121"
width=320 />

### Activity
<img
src="https://github.com/tuskyapp/Tusky/assets/1063155/4e07dea3-d97f-42c6-8551-492a3116fcfa"
width=320 /> <img
src="https://github.com/tuskyapp/Tusky/assets/1063155/ad00a134-d622-43f4-8305-84cfa7fed706"
width=320 />
2023-09-14 22:37:41 +02:00
Mylloon bb1868fd67
Add system black theme (#3957)
Close #1222
2023-09-13 11:14:20 +02:00
UlrichKu f63c662275
Add the special appbar for the notifications again (#4022) 2023-09-13 09:21:08 +02:00
Levi Bard f99cb6d1d5
Fix lint warnings (#4019)
Clears the baseline of issues in our code, and resolves most of the
straightforward warnings from the report
2023-09-13 09:20:53 +02:00
Konrad Pozniak 7dfc8790c7
update minSdk to 24, cleanup code (#4014)
closes https://github.com/tuskyapp/Tusky/issues/2607
redo of https://github.com/tuskyapp/Tusky/pull/3593
2023-09-12 19:25:45 +02:00