breezy-weather / breezy-weather

A Material Design Weather Application
GNU Lesser General Public License v3.0
5.73k stars 174 forks source link

Update SDK to 35 #837

Open papjul opened 8 months ago

papjul commented 8 months ago

Behavior changes when compileSdk = 35

https://developer.android.com/about/versions/15/behavior-changes-all

Behavior changes when targetSdk = 35

https://developer.android.com/about/versions/15/behavior-changes-15

New SDK 35 features

https://developer.android.com/about/versions/15/features?hl=en

Deprecated in API level 35

To be completed

Last year schedule (SDK 34)

Current schedule (SDK 35)

min7-i commented 2 months ago

Regarding the window inset changes, I tested it on Android 15 both with the target and compileSdk set to 34 and 35. In both cases, the insets were handled identically to previous Android versions. I didn't notice any new issues here.[1]

The only issue is that the color of the system bars cannot be customized anymore:

system bars on Android 15 (SDK 34 vs SDK 35) In both cases, the icon color of the navigation bar is dark. In previous versions it was light with a shaded dark background. | SDK 34 | SDK 35 | | --- | --- | | The shade is still applied properly to the status bar. | The shade is not applied anymore. | | ![A15_target34_Screenshot_20240922_201229](https://github.com/user-attachments/assets/fb05ccc6-d32e-4306-bb42-37c633facb48) | ![A15_target35_Screenshot_20240922_194638](https://github.com/user-attachments/assets/0e9ef8ca-d1bd-481f-91cd-ac3511c07c4d) |

There is an extensive article about insets handling which mentions this in 7. Background protect system bars only when necessary:

However, there are some cases where you wish to preserve the background color of the system bars, but the APIs to set the status and navigation bar colors are deprecated. We are planning to release an AndroidX library to support this use case.

The suggested workaround is to "place a composable or view behind the system bar". Although I'm still undecided if I like that approach.


[1]In landscape mode with three-button navigation some system bar insets are applied twice (by the root layout and by compose), but this is a different issue and not related to changing the SDK.

papjul commented 2 months ago

So it will be possible once the AndroidX library update is released?

I don't think SDK 35 is ready yet. It was just released on AOSP and it's not even there yet on Pixels. Let's just wait a bit more ;)

min7-i commented 1 week ago

With targetSDK = 35 the shade which is applied to the status bar when scrolling in the home fragment can no longer be applied on Android 15.

As far as I know, the AndroidX library which should support this hasn't been release yet. As mentioned in my previous comment, the workaround is to use a composable or view to draw a background behind the system bars. I could submit a PR for this.

papjul commented 1 week ago

Ah yes, you're right. I would prefer the library over a drawing. Can you open a separate issue with relevant links about the upstream known issue?

min7-i commented 6 days ago

I couldn't find any related issue in the Google issue tracker or any other details about it. It's only mentioned in the official Android blog post about insets handling on Android 15.

I would prefer the library over a drawing.

Agreed. After thinking about it again, I realized that we don't need the statusBarColor attribute. As we only want to set a white or black shade we can actually use enforceStatusBarContrast as a replacement in Window.setSystemBarStyle. That attribute is also deprecated in SDK 35, but unlike the color attribute it's still usable.

That should be a viable workaround until the promised library is released.

screenshots | 5.2.8 | SDK 35 fix| | --- | --- | | ![Screenshot_20241122-204136](https://github.com/user-attachments/assets/cb57985a-e8c3-48d2-89f0-90b0dea6fd10) | ![Screenshot_20241122-204439](https://github.com/user-attachments/assets/1269be5c-9a0a-4fc7-81bc-c4b0261e9bdd) |
papjul commented 6 days ago

It does look actually better than the current state! Thank you