slodge / Android.Dialog

Tools to simplify creating dialogs for Mono for Android
5 stars 3 forks source link

Make the ResourceId system extensible #1

Closed slodge closed 11 years ago

slodge commented 11 years ago

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:

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)

slodge commented 11 years ago

This required huge changes in the end - changing lots of parameters from int's to string's - but it is now done - so closing :)