pachli-android/core
Nik Clayton 93e6b38d43
feat: Update activity transitions, prepare for predictive-back (#650)
Previous code used a single animation type (slide) when transitioning,
the transition was quite slow, and didn't behave appropriately if the
device was set to a RTL writing system.

In addition, handling the back affordance didn't work well with the new
"Predictive Back" feature in Android 14

(https://developer.android.com/guide/navigation/custom-back/predictive-back-gesture).

Fix this.

## Transitions

To update the transitions the `startActivityWithSlideInAnimation()`
implementation (and associated `finishWithoutSlideOutAnimation()`) have
been replaced.

There are three transitions; `default`, `slide`, and `explode`,
represented as an enum passed to the activity intent.

The `default` transition is the activity transition from Android 14,
from the Android open source project

(https://cs.android.com/android/platform/superproject/+/android-14.0.0_r18:frameworks/base/core/res/res/anim/;bpv=1).
This is used for most transitions.

The `slide` transition is the pre-existing slide transition, with a
shorter transition time so it feels more responsive, and an RTL
implementation. This is used when there is a strong spatial component to
the navigation, for example, when going from:

- a status to its thread
- a preference menu item to its subscreen
- a filter in a list to the "edit filter" screen
- viewing your profile to editing your profile

The `explode` transition is used when the state of the app changes
significantly, such as when switching accounts.

Activities are now started with `startActivityWithTransition()` which
sets the intent and prepares the transition. `BaseActivity` checks the
intent for the transition type and makes further changes to the
transition as necessary.

## Predictive back

"Predictive back" needs to know what the back button would do before the
user interacts with it with an `onBackPressedCallback` that is either
enabled or disabled. This required refactoring some code (particularly
in `ComposeActivity`) to gather data ahead of time and enable/disable
the callback appropriately.

## Fixed bugs

- Back button wasn't stepping back through the tabs in AccountActivity
- Modifying a filter and pressing back without saving wasn't prompting
the user to save the changes
- Writing a content warning and then hiding it would still count the
text of the content warning toward's the post's length

## Other cleanups

- Use `ViewCompat.setTransitionName()` instead of setting the
`transitionName` property
- Delete the unused `fade_in` and `fade_out` animations.
- Use androidx-activity 1.9.0 to get the latest predictive back support
library code
- Show validation errors when creating / editing filters
2024-04-26 23:18:30 +02:00
..
accounts fix: Ensure logging out accounts completes (#515) 2024-03-10 12:25:12 +01:00
activity feat: Update activity transitions, prepare for predictive-back (#650) 2024-04-26 23:18:30 +02:00
common refactor: Simplify and optimize viewBinding delegate (#544) 2024-03-19 16:42:08 +01:00
data refactor: Remove `TabData` type (#576) 2024-03-30 23:27:25 +01:00
database refactor: Remove `TabData` type (#576) 2024-03-30 23:27:25 +01:00
designsystem feat: Update activity transitions, prepare for predictive-back (#650) 2024-04-26 23:18:30 +02:00
model refactor: Remove `TabData` type (#576) 2024-03-30 23:27:25 +01:00
navigation ci: Simplify and improve CI speed (#615) 2024-04-15 15:24:07 +02:00
network feat: Update activity transitions, prepare for predictive-back (#650) 2024-04-26 23:18:30 +02:00
preferences feat: Allow the user to trigger update checks (#458) 2024-02-20 14:50:59 +01:00
testing ci: Simplify and improve CI speed (#615) 2024-04-15 15:24:07 +02:00
ui fix(l10n): Update Spanish translations 2024-04-23 22:25:56 +02:00
AndroidManifest.xml refactor: Start creating core modules (#286) 2023-12-04 16:58:36 +01:00