Skip to content

Rework Layout CustomView replacement. #2100

@dellis1972

Description

@dellis1972

Currently ConvertResourcesCases is called twice on ALL resources referenced by the project.
This is terribly inefficient. However it is required. The first pass is done before a Compile, this fixes up the casing for things like drawables etc ready to be processed by aapt. The second is done after GenerateJavaStubs which happens AFTER the Compile step. This is to replace any custom view references with the correct md5.View style references. This is because we replace the normal readable namespace with an md5 hash.

The problem is we use ConvertResourcesCases and it does all the processing it did in the first pass again (or tries too).

So here is an idea.

On the first pass, we create a map file which contains a list of ALL the views we find in a layout file and the file it was found in. For Example

MonoDroid.ApiDemo.Spinner1=res/layouts/custom_view.xml
android.support.v7.FancyLayout=lp/11/res/fancylayout.xml

We then write a new Task which will using this map file in conjunction with the act_map.txt (or better the typemap.jm/mj files).

Sample output of act_map.txt

MonoDroid.ApiDemo.LogTextBox;md5c5caeb16a99a36adf764572343f76a16.LogTextBox
MonoDroid.ApiDemo.Spinner1;md5c5caeb16a99a36adf764572343f76a16.Spinner1

This will allow us to speficially target the exact file(s) which contain the views we need to replace. It should save us having to parse every xml layout file and instead use dictionary lookups to quickly find the file we need to process and possibly just do a string replace..

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions