Skip to content
Werner Kunze edited this page Apr 11, 2022 · 36 revisions

Stand With Ukraine

Proteus is meant to be a drop-in replacement to Android’s XML LayoutInflater. Built in order to modify your apps user interface, without a release. You can host your layouts on a server and send them over the wire instead of bundling them in your APK.

Layout

A Layout describes the view hierarchy, think of it as being an XML layout file in Android. In Proteus it is currently represented in JSON. In JSON, the type attribute will contain the value equal to the nodes present in XML.

Head over to the Layouts page for more details.

Data

Data (optional) represents the dynamic parts of the Layout. It is similar to Android Data bindings. The only difference being that this is mostly runtime, whereas Android by default has compile time bindings.

Refer Data as well as Data Bindings for more details.

Layout Builder is the most important component of Proteus. It takes in a Layout, and Data (could be empty) to create a native Android View. This is done using the build method. Since this is just a regular view, you can add it to a View Group or set it as a content view to your activity. If you want to register custom view types or need custom handling of attributes, you can register them here.

Refer the ReadMe and videos for examples on how to use this class.

Layout Builder's build method returns a ProteusView. This is a regular Android View object and can be used just like one. Additionally it hosts the ProteusViewManager inside it which can be called using getViewManager() method on the view.

Note : Every view and child views returned by Proteus will implement the ProteusView Interface. If you create your own custom view parser, make sure that the view returned by createView() implements this interface.

Layout Builder Callbacks

Layout Builder callbacks are useful to receive callbacks during the LayoutBuilder's build() process. This will help you handle cases where the layout contains a type which is not registered into LayoutBuilder. Additionally if an attribute is not handled by a Parser you can get those too.

Head over to this page for details