rust-mobile/android-activity

Replace `WindowManagerFlags` with `ndk::WindowFlags`

MarijnS95 opened this issue · 3 comments

https://docs.rs/ndk/0.7.0/ndk/native_activity/struct.WindowFlags.html

The ndk crate provides the same bitflag enum based on generated rather than hardcoded constants, albeit without documentation. Should android-activity just use that (after helping the ndk take over the docs)?

rib commented

maybe. I'm a little bit in two minds about whether to go in the other direction though and generally keep the ndk crate as an implementation detail that's not exposed in the public API.

E.g. in the case of the input API I started out by exposing ndk crate types but that's been particularly problematic considering the differences between GameActivity and NativeActivity.

The overall surface area for the android-activity crate isn't that big, so I'm not massively concerned about some redundancy, when it also helps decouple the dependency so we e.g. don't have to worry about synchronizing semver changes.

That said though - On a case by case basis though if it's clear we can just have an enum / bitfield type in one place with docs, and it can be autogenerated and also account for maintaining backwards compatibility (e.g. with non_exhaustive where appropriate) then that should be OK. (In those cases then semver bumps for the ndk create don't actually affect the public API here anyway)

rib commented

the question of exposing the ndk crate API is also relevant here: #45

I feel like the ndk type is the way to go if that API is wrapped directly, which seems to be the case here?