Repository navigation
Description
Background
Xamarin.AndroidX.Compose.Material.Icons.Core (and its .Android
sibling) ships an essentially empty managed assembly. Verified
against 1.7.8.3:
D:\.nuget\packages\xamarin.androidx.compose.material.icons.core\1.7.8.3\
lib\net10.0-android36.0\Xamarin.AndroidX.Compose.Material.Icons.Core.dll (16 432 bytes)
var asm = AssemblyDefinition.ReadAssembly(dll);
asm.MainModule.Types.Count // => 1
asm.MainModule.Types[0].FullName // => "<Module>"The underlying AAR contains the androidx.compose.material.icons.Icons
class (with nested Filled / Outlined / Rounded / Sharp /
TwoTone / AutoMirrored companion objects) plus the baseline icon
set (~36 ImageVector extension properties — Icons.Default.Search,
Menu, Add, Delete, Edit, Settings, MoreVert, ArrowBack,
Close, Check, Star, Favorite, Share, Home, Person,
Notifications, Refresh, Info, Warning, …), but none of it
surfaces to managed callers. Today there is no way to write
Icons.Default.Search from C# without hand-rolling a JNI
GetStaticFieldID lookup per icon.
This blocks any managed Compose effort from using the official
Material icon set — the same baseline icons every Jetpack Compose
sample uses for app-bar navigation, list-item actions, and FAB
contents. (We have an open tracking issue for this on the C# side:
jonathanpeppers/compose-net#61.)
Ask
Mirror the #1438
/ #1439
recipe applied to ui-graphics-android / ui-text-android /
ui-unit-android:
- Drop the
<remove-node path="/api/package" />(or equivalent
<remove-node>rules) in
source/androidx.compose.material.icons/material-icons-core-android/Transforms/Metadata.xml
(and the JVM-onlymaterial-icons-coresource if applicable). - Add
managedNameoverrides forcingMaterial.Iconscasing on the
package map:androidx.compose.material.icons→AndroidX.Compose.Material.Iconsandroidx.compose.material.icons.filled→AndroidX.Compose.Material.Icons.Filledandroidx.compose.material.icons.outlined→AndroidX.Compose.Material.Icons.Outlinedandroidx.compose.material.icons.rounded→AndroidX.Compose.Material.Icons.Roundedandroidx.compose.material.icons.sharp→AndroidX.Compose.Material.Icons.Sharpandroidx.compose.material.icons.twotone→AndroidX.Compose.Material.Icons.TwoToneandroidx.compose.material.icons.automirrored.*→
AndroidX.Compose.Material.Icons.AutoMirrored.*
- Add
Xamarin.AndroidX.Compose.Material.Icons.Core/
.AndroidtoComposePackagesWithBindingsin
AndroidXProject.cshtml. - Update
published-namespaces.txtfor the newly-exposed namespaces. - Bump
nugetVersionon both packages.
After the fix, Icons.Default.Search-style baseline icons should be
callable directly. The 1500+ icon material-icons-extended artifact
has been deprecated upstream by Google, so this issue is intentionally
scoped to material-icons-core only.
Verification
// Should resolve at compile time after the fix:
var v = AndroidX.Compose.Material.Icons.Icons.Filled.Search;
// expected: AndroidX.Compose.UI.Graphics.Vector.ImageVector
Activity
Add Color struct and parameterise MaterialTheme (refs #61) (#133)
Add Material Icons facade (refs #61)
Add Material Icons facade (refs #61)
Add Material Icons facade (refs #61)
Add Material Icons facade (refs #61)
Add Material Icons facade (refs #61)
Add Material Icons facade (refs #61) (#177)