Previous code assumed server responses would always be JSON, and had no
special handling for mis-configured servers that sometimes return HTML;
for example, if the server has a bug, or there's a reverse proxy in
front of the server issuing DoS-prevention challenges.
This could cause errors to show with no useful debugging information.
Update `ApiResult` to check the content-type in the response and return
one of two new errors if the content-type is missing or wrong. Also
include the HTTP code in `ApiResponse` for use elsewhere.
Update `ThrowableExtensions` to pull the `error` and optional
`description` out of the error body.
Update `PachliError` so `formatArgs` can be an array of arbitrary types,
not just strings.
Update `MediaUploader`; expose the different errors as new
`MediaUploaderError` types instead of `Exception` subclasses, and return
`Result<V, E>` where appropriate.
Update `ComposeViewModel` to use the new `MediaUploaderError` types and
create new `PickMediaError` to report issues there, replacing
`VideoOrImageException`.
Update `ComposeActivity` to use the new error types and show errors
until the user dismisses them, so they're better able to see and report
problems.
Fixes#704.
Previous code did not provide whitespace between different media labels
when media is not loaded.
In addition, the icon for the media was centre-aligned vertically with
the text, making it difficult to scan and determine when one media label
ends and another one starts.
Fix this by adding an 8dp margin between the media labels, and using a
TextView subclass that vertically aligns the media icon with the first
line of text.
Set the compound drawables with relative alignment, so they behave
appropriately in RTL layouts.
Fixes#751.
The user might have set a profile header image that is close to the
colour of the text in the account header in the left navigation menu.
This can make the text difficult or impossible to see.
Work around this by drawing a partially transparent scrim behind the
text so it's always displayed over a background that makes the text
legible.
Fixes#298
By Christophe Beyls in https://github.com/tuskyapp/Tusky/pull/4515.
Their commit notes:
Improve the performance of `BlurHashDecoder` while also reducing 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.
`ImageDownsizer.downsizeImage()`:
- Remove the return value, it was ignored
- Throw `FileNotFoundException` when `openInputStream` returns null
`ImageDownsizer.getImageOrientation()`:
- Throw `FileNotFoundException` when `openInputStream` returns null
`MediaUploader.prepareMedia()`:
- Copy URI contents using Okio buffers / source / sink
`UriExtensions`:
- Rename from `IOUtils`
- Implement `Uri.copyToFile()` using Okio buffers / source / sink
- Replace `ProgressRequestBody()` with `Uri.asRequestBody()` using Okio
buffers / source / sink
`DraftHelper.copyToFolder()`
- Use Okio buffers / source / sink
`CompositeWithOpaqueBackground`
- Use constants `SIZE_BYTES` and `CHARSET` instead of magic values
- Use `Objects.hash` when hashing multiple objects
Based on work by Christophe Beyls in
- https://github.com/tuskyapp/Tusky/pull/4366
- https://github.com/tuskyapp/Tusky/pull/4372
Previous code depended on, but did not initialise, the androidx
splashscreen library.
Fix that, using the library on API < 31, or the platform implementation
otherwise.
`SplashActivity` is no longer needed, launching goes straight in to
`MainActivity`.
Version 1.2.0-alpha01 is needed to fix some theme corruption bugs in
earlier versions of the library.
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[com.google.android.material:material](https://togithub.com/material-components/material-components-android)
| `1.11.0` -> `1.12.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.android.material:material/1.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.android.material:material/1.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.android.material:material/1.11.0/1.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.android.material:material/1.11.0/1.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
---
> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.
---
### Release Notes
<details>
<summary>material-components/material-components-android
(com.google.android.material:material)</summary>
###
[`v1.12.0`](https://togithub.com/material-components/material-components-android/releases/tag/1.12.0)
[Compare
Source](https://togithub.com/material-components/material-components-android/compare/1.11.0...1.12.0)
### What's new since 1.11.0
- `Slider` and `Progress Indicator` have been updated to better support
Non-Text Contrast Accessibility requirements.
- Predictive Back Fragment/View support added to Material motion
transitions (`MaterialSharedAxis`, `MaterialFadeThrough`,
`MaterialFade`, `MaterialElevationScale`).
#### Important
Required `minSdkVersion` is now 19 or higher, for Material and AndroidX
([blog
post](https://android-developers.googleblog.com/2023/10/androidx-minsdkversion-19.html)).
#### Dependency Updates
| Dependency | Previous version | New version |
| - | - | - |
| androidx.transition | 1.2.0 | 1.5.0 |
#### Library Updates
- `Gradle`
- Update library minSdkVersion to 19.
([`1bbb43d`](1bbb43d155))
- Upgrade to //third_party/gradle to 8.4
([`1756f23`](1756f233ec))
- `Carousel`
- Shifted keylines in contained strategies when there exists padding,
and clipToPadding=false
([`1ef42e2`](1ef42e2f23))
- Fixed Javadoc formatting error in `FullScreenCarouselStrategy` class
documentation.
([`a0a1c6e`](a0a1c6e044))
- Added support for cross axis wrap_content RecyclerViews
([`e88a1b9`](e88a1b98d2))
- Added documentation recommending snapping for multi-browse strategy
([`9e64a1f`](9e64a1f5f6))
- Add attributes to change small item size
([`92a5444`](92a5444de9))
- `CollapsingToolbarLayout`
- Fix text shadow fading when transitioning between expanded and
collapsed states
([`7674e12`](7674e12ea8))
- `Checkbox`
- Updated string translations
([`198e08c`](198e08cf5e))
- `Dialog`
- Unified scrim opacity in Material themes/theme overlays.
([`f3e4439`](f3e4439ca6))
- `Divider`
- Fixed divider instantly appearing or disappearing on insertion or
removal
([`ef4a0c5`](ef4a0c5e36))
- `i18n`
- Update translated strings
([`a8307ef`](a8307ef792))
- `MaterialDatePicker`
- Fix date validation on Samsung devices
([`5aa6edf`](5aa6edfaed))
- `MaterialAutoCompleteTextView`
- Enabled switch access in MaterialAutoCompleteTextView.
([`14a7b40`](14a7b40363))
- `NavigationDrawer`
- Fixed wrong item selected after click
([`a3af20a`](a3af20a869))
- `NavigationRail`
- Added label padding for when the label is long enough to reach the
sides of the nav rail
([`2439dc0`](2439dc0e81))
- Increased padding in between items as per design specs
([`16eca7e`](16eca7eef3))
- `Predictive Back`
- Animated corners during predictive back when no drawerLayoutCornerSize
is set
([`c8b9b1c`](c8b9b1c0bb))
- `ProgressIndicator`
- Updated inactive track color from primary container to secondary
container.
([`c8cb0c6`](c8cb0c6037))
- Updated the setter of track thickness to not update track corner
radius.
([`540f5ee`](540f5ee983))
- Added the limit to not have stop indicator size bigger than track
thickness.
([`689e04f`](689e04f9ed))
- Fixed the rounded ends overlapping bug with semi-transparent
track/indicator color in Circular default style.
([`8167c11`](8167c115e3))
- Removed the call to draw a transparent full track.
([`3f80fdb`](3f80fdb9e1))
- Flipped the canvas for different circular directions.
([`bcc27a3`](bcc27a3638))
- Split stop indicator drawing from indicator drawing.
([`76207cb`](76207cb270))
- Added ActiveIndicator to improve readability.
([`6fd920a`](6fd920a2c1))
- Fixed ESCAPE animation in linear and added ESCAPE animation in
circular.
([`98284e7`](98284e74ad))
- Updated to use the same drawing delegate object between determinate
drawable and indeterminate drawable to prevent inconsistent drawings
when specs update.
([`52b4845`](52b48450fc))
- Added missing graphics updates when spec changes.
([`93b3010`](93b30109b0))
- Update styles for new Accessibility updates
([`15b533f`](15b533fffb))
- Added static drawable for Circular type when system animator is
disabled.
([`22e054b`](22e054ba68))
- `Search`
- Excluded icons from search bar handwriting bounds
([`387f59b`](387f59b706))
- Made `searchbar_scrolling_view_behavior` string public
([`ce386e4`](ce386e4c20))
- Updated string translations
([`198e08c`](198e08cf5e))
- `SideSheet`
- Moved the modal side sheet default width/height into style so they can
be customized
- Updated string translations
([`198e08c`](198e08cf5e))
- `Slider`
- Made tick size defaults to the stop indicator size if set
([`92bc02c`](92bc02c37c))
- Fixed incorrect style of stop indicators near handles
([`d61cffd`](d61cffd7eb))
- Resolved issues that crash when assigning a large value to `valueTo`
([`4d1b9e5`](4d1b9e58a5))
- Updated the track drawing for some corner cases.
([`10484df`](10484df407))
- Fixed ripple not transparent on API 33
([`cd4f618`](cd4f618d38))
- Updated documentation
([`a641e18`](a641e18b6a))
- Updated styles
([`c218b3c`](3b278d7097))
- Fixed slider label not moving while scrolling
([`144b515`](144b5159ce))
- `Tabs`
- Fixed title being announced twice when there's a badge in TalkBack
mode.
([`aaa7034`](aaa7034cbf))
- `Theming`
- Add NoActionBar dynamic color themes
([`81d1b77`](81d1b772b9))
- Update Shape Theming bottom sheet text color
([`8ca016f`](8ca016fb01))
- `Tokens`
- Update tokens to v4.0.0.
([`88acfcd`](88acfcdb63))
- Added formatting to break long lines and differentiate different
comments.
([`857d6a2`](857d6a2fd9))
- `TopAppBar`
- Use an accessibility delegate to add and perform actions
([`929c80f`](929c80f753))
- Fixed compress effect clipping on API 21-24
([`2ac8c1c`](2ac8c1cbf6))
- `TextInputLayout`
- Limited the min height reset in text change listener only when line
count changes.
([`9b9449c`](9b9449cde1))
- Fixed unnecessary min height when losing focus with multiple lines.
([`4a2654a`](4a2654a3f3))
- `Transitions / Motion`
- Updated androidx transition dep to version 1.5.0-beta01
([`8c63848`](8c63848829))
- Added predictive fade through fragment transition demo to Catalog.
([`6092a7d`](6092a7dfe9))
- Added titles to fade through demo fragments in Catalog.
([`104043c`](104043caee))
- Added predictive transition support for fragments and views to the
Material motion library, and enabled it in shared axis fragment
transition demo.
([`8ccec33`](8ccec334bd))
#### Full list of release notes
-
[1.12.0-alpha01](https://togithub.com/material-components/material-components-android/releases/tag/1.12.0-alpha01)
-
[1.12.0-alpha02](https://togithub.com/material-components/material-components-android/releases/tag/1.12.0-alpha02)
-
[1.12.0-alpha03](https://togithub.com/material-components/material-components-android/releases/tag/1.12.0-alpha03)
-
[1.12.0-beta01](https://togithub.com/material-components/material-components-android/releases/tag/1.12.0-beta01)
-
[1.12.0-rc01](https://togithub.com/material-components/material-components-android/releases/tag/1.12.0-rc01)
#### Full list of changes
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/pachli/pachli-android).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNTEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjQxMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nik Clayton <nik@ngo.org.uk>
New lint checks mean:
- Some trivial uses of String.format() are replaced with templates
- Use a string resource for the scheduled date and time
Some reported SetTextI18n warnings have been ignored, as they relate to
e.g., clearing a view's text by setting it to "".
Implement suggestions as a new `feature:suggestions` module, with
associated activity, fragment, etc.
Suggested accounts are shown with their normal information, as well as
information about the number of follows / followers, and a guide to
posting frequency, so the user can make a more informed decision about
whether to follow or not.
In the previous code `PachliError` could correctly chain errors and
generate error messages, `ApiError` didn't, which is why there was the
temporary `ApiError.fmt()` extension function.
Rewrite `ApiError` to implement `PachliError` so it gets these benefits
and to reduce the number of different error-handling mechanisms in the
code.
Main changes:
- `PachliError` is now an interface so it can be extended by other
error interfaces.
- All the `ApiError` subclasses implement `PachliError`, and can
specify the error string and interpolated variables at the point of
declaration.
- Update `ListsRepository` and `ServerRepository` to return
`PachliError` subclasses.
Previous code was inconsistent about using getServerErrorMessage() and
whether or not the case where getServerErrorMessage() returns null was
handled.
Switch to using getErrorString() which does handle the null case and
always returns a usable string.
Some string resources are rendered temporarily unused by this change.
They will be used again soon, so configure lint to ignore them at the
moment.
Previous code always included the transitionKind enum as an extra, and
could cause a crash if the activity launched by the intent was not a
Pachli activity.
Fixes#700.
Edited polls only include the list of options with titles; no other
metadata (poll ID, single/multiple choice, vote counts, etc). Since the
data shape didn't match Moshi wasn't decoding the data.
Provide dedicated data classes to model the response, and add a fourth
poll display option to represent viewing an edit history snapshot.
Crash was occuring because the instance info hadn't been fetched, trying
to take the last item of an empty list.
To fix:
- Expose the instance info as a state flow, with a default. New instance
info is fetched whenever the active account changes.
- Do the same for the emojis supported by the server.
- Update call sites as appropriate.
- Mark `InstanceInfoRepository` as `@Singleton` so it isn't repeatedly
created causing fresh content fetches.
The tests needed updating to get this to work.
- Extract the network fake modules in to a network-test module so
multiple other modules can use them.
- Rewrite `InstanceInfoRepositoryTest` to use Hilt and use Turbine to
test the new flows.
Checking this showed cosmetic bugs in the About layout when instance
info is missing, clean those up.
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
The previous code didn't set a limit for the number of posts, links, and
hashtags to fetch on the trending pages, so used the conservative
defaults.
Increase these to the API maximums to show the user more information.
Abstract common CI setup tasks (setting up Java, Gradle, etc) in to a
single action that can be used by all CI workflows.
Run the lint, test, and assemble CI tasks in parallel for each variant
rather than in series, which cuts ~ 7 minutes (approx. 50%) off the CI
runtime.
Update code in checks and core/navigation to fix new tests.
Use `unicodeWrap` when inserting placeholders in error messages so they
set the correct text direction.
Update some strings with formatting directives to (a) include `_fmt`
in the name, and (b) use `%1$s` instead of `%s`.
Previously, modifying any tabs meant opening the left-side nav, opening
Account preferences > Tabs, and then adding / removing tabs. This is
time consuming, and difficult for new users to discover.
In addition, it was possible to remove the Home tab, and there was a
hardcoded minimum of at least two tabs.
Fix this.
When viewing a timeline that is not already in a tab an "Add to tab"
menu item is enabled, which appends the timeline to the list of existing
tabs.
When viewing a timeline in a tab (that is not the Home timeline) a
"Remove tab" menu item is enabled, which removes the tab from the list
of existing tabs.
If the user removes the active tab (either with this menu item, or
through preferences) the tab to the left of the active tab becomes the
new active tab.
A new "Manage tabs" menu item is also provided, as a shortcut to the
existing Account preferences > Tabs screen.
When managing tabs the Home timeline can not be removed; the button to
remove it is removed, and swiping is disabled on that list item. The
restriction of "at least two tabs" has also been removed.
`NotificationsActivity` has been removed, as `TimelineActivity` can
display `NotificationsFragment`.
To make the three "Trending" types (hashtags, links, and posts) more
visually distinct add two new icons for links (ic_newspaper) and posts
(ic_whatshot).
Fixes#572, #584, #585, #569