Skip to content

Un-strip ui-text-android and ui-unit-android (mirror #1438) #1439

Closed

Description

@jonathanpeppers

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 / .Android
  • Xamarin.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" /> in source/androidx.compose.ui/ui-text-android/Transforms/Metadata.xml.
  • Add managedName overrides forcing UI casing on the package map:
    • androidx.compose.ui.text → AndroidX.Compose.UI.Text
    • androidx.compose.ui.text.font → AndroidX.Compose.UI.Text.Font
    • androidx.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 / .Android to ComposePackagesWithBindings in AndroidXProject.cshtml.
  • Update published-namespaces.txt for the newly-exposed namespaces.
  • Bump nugetVersion for both packages.

This unlocks (in particular):

  • AndroidX.Compose.UI.Text.Font.FontWeight — regular class FontWeight(val weight: Int) : Comparable<FontWeight> with a companion that exposes Thin/Light/Normal/Medium/Bold/Black/etc. as static FontWeight instances. Surfaces as a real C# class.
  • AndroidX.Compose.UI.Text.Style.TextDecoration — regular class with Underline/LineThrough/None static 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 raw int (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-node in source/androidx.compose.ui/ui-unit-android/Transforms/Metadata.xml.
  • managedName overrides for androidx.compose.ui.unit → AndroidX.Compose.UI.Unit.
  • Add to ComposePackagesWithBindings, update published-namespaces.txt, bump nugetVersion.

This unlocks:

  • AndroidX.Compose.UI.Unit.Dp.Companion — Hairline, Infinity, Unspecified constants (Dp itself stays a raw float at JNI per the inline-class lowering policy).
  • AndroidX.Compose.UI.Unit.TextUnit.Companion — Unspecified constant; TextUnitType enum.
  • AndroidX.Compose.UI.Unit.IntSize / IntOffset / DpSize / DpOffset — these are inline classes too but their companions are bindable.

Notes

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

  1. added 2 commits that reference this issue on Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions