Attention. This project is not maintained any more !!! VirtualView Tools 中文文档 This project is a tool library as a part of VirtualView libra…
Attention. This project is not maintained any more !!! VirtualView Tools 中文文档 This project is a tool library as a part of VirtualView libra…
This project is a tool library as a part of VirtualView library, used to compile XML files:
Download the source code, the executable is located at folder TemplateWorkSpace. There are several files here:
| File | Introduction |
|---|---|
| config.properties | configs of widget's ID and attribute's value type |
| templatelist.properties | the file list of XML template |
| build | output folder after compiling XML files |
| template | the source code XML files |
| compiler.jar | executable jar file exported from the total source code |
| buildTemplate.sh | the command script to run compiler.jar |
sh buildTemplate.shbuildconfig.propertiesVIEW_ID_XXXXVIEW_ID_FrameLayout=1 means the tag `` in XML will be compiled to number 1;VIEW_ID_;
- Widget's Id value from 1 t0 1000 are reserved for system, so custom widget's id should be assigned start 1001;property=ValueTypeString(Default, no need configuration)、Float、Color、Expr、Number、Int、BoolFlag、Type、Align、LayoutWidthHeight、TextStyle、DataMode、VisibilityEnumflexDirection=Enumrow will be converted into number 0, and row-reverse into number 1templatelist.propertiesxmlFileName=outFileName,Version[,platform]xmlFileName; The file name need to be compiled under folder template, no need to add file extension here;outFileName: The output file name after compiling;Version: XML file's version;platform: Optional, valid value are android and iphone. Used to describe which platform current XML is target to, the output artifacts will be stored at a separate folder;out: the binary data serialized from template file, all the other three outputs are generated from this.java: the binary data in form of Java byte array. May be copied to Android project to run.sign: the md5 of binary data;txt: the binary data in form of HEX string.Except that use as a command tool to compile file, there is an another way to compile XML data from an IDE plugin, a client, a backend service or somewhere else. So it's possible to use JAVA API to compile data, the example code is as follow:
//Build a ViewCompilerApi instance
ViewCompilerApi viewCompiler = new ViewCompilerApi();
//init a ConfigLoader to load config.properties.
viewCompiler.setConfigLoader(new LocalConfigLoader());
//read XML data from file or somewhere else
FileInputStream fis = new FileInputStream(rootDir);
//Parameters are XML data's InputStream, template name, template version
byte[] result = viewCompiler.compile(fis, "icon", 13);
Before you open an issue or create a pull request, please read Contributing Guide first.
VirtualView tools is available under the MIT license.
No open issues yet, or sync has not completed.