Repository navigation
Description
Background
#1438 un-stripped ui-graphics-android so Color/Brush/Shape/Path/ImageBitmap/etc. became real C# bindings instead of Java-library-only stubs. To complete the Compose styling surface for managed callers, two more recipes need the same treatment.
Today (1.11.1) these packages all ship with zero exported public types (verified by loading the DLLs with Assembly.GetExportedTypes()):
Xamarin.AndroidX.Compose.UI.Text/.AndroidXamarin.AndroidX.Compose.UI.Unit/.Android
Without these, managed callers must hand-roll JNI static-field lookups for FontWeight.Bold, TextDecoration.Underline, Dp.Hairline, TextUnit.Unspecified, etc., and authoring of any C# Compose facade has to invent its own value-type mirrors.
Asks
1. ui-text-android
Mirror the #1438 recipe applied to ui-graphics-android:
- Drop
<remove-node path="/api/package" />insource/androidx.compose.ui/ui-text-android/Transforms/Metadata.xml. - Add
managedNameoverrides forcingUIcasing on the package map:androidx.compose.ui.text→AndroidX.Compose.UI.Textandroidx.compose.ui.text.font→AndroidX.Compose.UI.Text.Fontandroidx.compose.ui.text.style→AndroidX.Compose.UI.Text.Style- …and the rest of the
androidx.compose.ui.text.*subtree.
- Add
Xamarin.AndroidX.Compose.UI.Text/.AndroidtoComposePackagesWithBindingsinAndroidXProject.cshtml. - Update
published-namespaces.txtfor the newly-exposed namespaces. - Bump
nugetVersionfor both packages.
This unlocks (in particular):
AndroidX.Compose.UI.Text.Font.FontWeight— regularclass FontWeight(val weight: Int) : Comparable<FontWeight>with a companion that exposesThin/Light/Normal/Medium/Bold/Black/etc. as staticFontWeightinstances. Surfaces as a real C# class.AndroidX.Compose.UI.Text.Style.TextDecoration— regular class withUnderline/LineThrough/Nonestatic instances on the companion. Real C# class.AndroidX.Compose.UI.Text.TextStyle— regular class.AndroidX.Compose.UI.Text.Style.TextAlign.Companion—@JvmInline value class TextAlign(val value: Int)itself surfaces as rawint(consistent with Color/Dp lowering in Ship real bindings for Xamarin.AndroidX.Compose.UI.Graphics #1438), but the companion's named constants become accessible.
2. ui-unit-android
Same treatment:
- Drop the
remove-nodeinsource/androidx.compose.ui/ui-unit-android/Transforms/Metadata.xml. managedNameoverrides forandroidx.compose.ui.unit→AndroidX.Compose.UI.Unit.- Add to
ComposePackagesWithBindings, updatepublished-namespaces.txt, bumpnugetVersion.
This unlocks:
AndroidX.Compose.UI.Unit.Dp.Companion—Hairline,Infinity,Unspecifiedconstants (Dp itself stays a rawfloatat JNI per the inline-class lowering policy).AndroidX.Compose.UI.Unit.TextUnit.Companion—Unspecifiedconstant;TextUnitTypeenum.AndroidX.Compose.UI.Unit.IntSize/IntOffset/DpSize/DpOffset— these are inline classes too but their companions are bindable.
Notes
- Both recipes are expected to be cookie-cutter relative to Ship real bindings for Xamarin.AndroidX.Compose.UI.Graphics #1438, with the same "inline value class types surface as raw primitives" caveat.
- If either package surfaces KMP
-jvm/-androidduplicates, mirror the<AndroidIgnoredJavaDependency>pattern from Ship real bindings for Xamarin.AndroidX.Compose.UI.Graphics #1438. - Foundation likely surfaces additional types once these dependencies become resolvable, similar to how Ship real bindings for Xamarin.AndroidX.Compose.UI.Graphics #1438 unlocked
RoundedCornerShape/CornerBasedShapeinfoundation-android. A follow-upMetadata.xmlpass onfoundation-androidmay be needed.
Why
Closing these is the prerequisite for the compose-net facade (and any future C# Compose author) to expose fontWeight/fontSize/lineHeight/textAlign/textDecoration/color parameters on Text/Button/Surface/Card/Icon/etc. without inventing parallel C# value types or hand-rolling JNI static-field lookups for every Compose constant. It's the natural next-cut after #1438.
Activity
Implement #65: C# value types for Compose inline-class params
Implement #65: C# value types for Compose inline-class params