Currently the resources for layouts are overriden using a LayoutId enumeration which is looked up in a hard-coded lookup map - enumeration to the string name of an Android ResourceId
This system uses context.Resources.GetIdentifier() to find the actual resource.
In the new version, we would:
use a system of String LayoutId names
use reflection to get the resourceId integer from the string
This would have the key advantages:
it would allow people to register their own resourceids (this is currently "// TODO: figure out what context to use to get this right, currently doesn't inflate application resources")
it removes the deprecated GetIdentifier mechanism
Use of this system would mean that lines like:
new StringElement("DialogListView Activity", (int)DroidResources.ElementLayout.dialog_labelfieldright)
would become:
new StringElement("DialogListView Activity", "dialog_labelfieldright")
One negative impact on this would be the use of string matching for the layoutids - I'm open to ideas on how to improve this - but the current new design is no worse than the existing one (which also uses string resource names)
Currently the resources for layouts are overriden using a LayoutId enumeration which is looked up in a hard-coded lookup map - enumeration to the string name of an Android ResourceId
This system uses
context.Resources.GetIdentifier()
to find the actual resource.In the new version, we would:
This would have the key advantages:
GetIdentifier
mechanismUse of this system would mean that lines like:
would become:
One negative impact on this would be the use of string matching for the layoutids - I'm open to ideas on how to improve this - but the current new design is no worse than the existing one (which also uses string resource names)