Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mono.Android] Fix View.SystemUiVisibility enumification (dotnet#7730)
Fixes: dotnet#4290 The [`View.getSystemUiVisibility()` method][0], bound as the [`View.SystemUiVisibility` property][1], and the [`WindowManager.LayoutParams.systemUiVisibility` field][2], bound as the [`WindowManagerLayoutParams.SystemUiVisibility` property][3], were incorrectly enumified to use the `StatusBarVisibility` enum when they should have used the `SystemUiFlags` enum. We cannot change the existing members, as that would be an ABI and API break. Furthermore, as these are properties, we cannot overload them either. "Fix" this by: 1. Marking the existing properties as `[Obsolete]`, and 2. Introduce *new* `SystemUiFlags` properties. Additionally, these members were deprecated in API-30, so make sure we reflect that on the new method. It's still worth fixing this, as people will be using this for pre-API-30 device support for years to come. These changes will only be present in API-34+. The resulting API is: partial class View { // Original property [Obsolete ("This property has an incorrect enumeration type. Use the SystemUiFlags property instead.")] public StatusBarVisibility SystemUiVisibility {get; set;} // New hawtness [ObsoletedOSPlatform ("android30.0", "…")] public SystemUiFlags SystemUiFlags {get; set;} } partial class WindowManagerLayoutParams { // Original property [Obsolete ("This property has an incorrect enumeration type. Use the SystemUiFlags property instead.")] public StatusBarVisibility SystemUiVisibility {get; set;} // New hawtness [ObsoletedOSPlatform ("android30.0", "…")] public SystemUiFlags SystemUiFlags {get; set;} } [0]: https://developer.android.com/reference/android/view/View#getSystemUiVisibility() [1]: https://learn.microsoft.com/en-us/dotnet/api/android.views.view.systemuivisibility?view=xamarin-android-sdk-12 [2]: https://developer.android.com/reference/android/view/WindowManager.LayoutParams#systemUiVisibility [3]: https://learn.microsoft.com/en-us/dotnet/api/android.views
- Loading branch information