<NME> README.md
<BEF> json2view  ![travis-ci](https://magnum.travis-ci.com/Avocarrot/json2view.svg?token=JZNsn6pty78ndT1Z2naj&branch=master)
======

## Introduction

**json2view** is a simple library that can convert a compatible JSON file to an Android view so you can load dynamically the view in your Android app without the need to update the APK.

This removes the hassle of updating, re-compiling and uploading the APK to Google Play everytime you want to make small or big changes in the UI.

<table>
<tr style="border: 0px;">
- [How it works](#how-it-works)
- [Examples](#examples)
- [Installation](#installation)
- [Contributing](#contributing)
- [License](#license)

<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
</ul>
</td>
<td style="width:60%; border: 0px; text-align:right;">

In the case of [Avocarrot](http://www.avocarrot.com), we are using json2view to run A/B test experiments and quickly deploy UI enhancements that improve revenue performance of native ads integrations in our network.

## How it works?

You can parse any xml through the json2view library to create a JSON that will be used at runtime to dynamically generate the Android UI using native code. This JSON can be hosted anywhere on the internet (your own server, Dropbox, Github Pages etc.) and can be fetched in your app at any point you decide.


Note: Runtime creation of a view without the precompiled version of xml in apk (res/layout), especially for highly complex layouts, can be a potential latency issue.

## Examples

Using json2view to change text color, background color and position of a view. [(more details)](https://github.com/Avocarrot/json2view/wiki/Changing-Properties)

![output](https://github.com/Avocarrot/json2view/blob/master/example_assets/test00.png)

Using json2view to reorganize the layout of a screen. [(more details)](https://github.com/Avocarrot/json2view/wiki/Changing-Layouts)

![output](https://github.com/Avocarrot/json2view/blob/master/example_assets/test01.png)
## Examples

### Changing text color

Using json2view to change text color, background color and position of a view. [(more details)](https://github.com/Avocarrot/json2view/wiki/Changing-Properties)

![output](https://github.com/Avocarrot/json2view/blob/master/example_assets/test00.png)

### Reorganizing the layout

Using json2view to reorganize the layout of a screen. [(more details)](https://github.com/Avocarrot/json2view/wiki/Changing-Layouts)

![output](https://github.com/Avocarrot/json2view/blob/master/example_assets/test01.png)

You can find more help and examples in the [wiki](https://github.com/Avocarrot/json2view/wiki).

Also, a sample project for quick use of the lib can be found in the [sample submodule](https://github.com/Avocarrot/json2view/tree/master/sample)

## Installation
- Download project
```
git clone https://github.com/Avocarrot/json2view.git
compile project(':json2view')
```


## Basic JSON Format
The input JSON has 3 fields for every view we want to create :

* `widget` : canonicalName of View (for views in package `android.widget` you can ommit `android.widget`)

- add in build.gradle of application module (not project build.gradle) in `dependencies` section

```
compile project(':json2view')
```

## Getting started

### Basic JSON format
The input JSON has 3 fields for every view we want to create :

* `widget` : canonicalName of View (for views in package `android.widget` you can ommit `android.widget`)
* `properties` : list of properties for the view. ([Available Properties](https://github.com/Avocarrot/json2view/wiki/Available-Properties)) By default we add `layout_width` & `layout_height` with value `wrap_content'
* `views` : children views for ViewGroup _(optional)_

eg. JSON to create a empty TextView
```javascript
{
    "widget": "android.widgetTextView",
	"properties": []
}
```

eg. JSON to create a TextView with textSize : 12sp and text : "Hello Avocarrot!"
```javascript
{
    "widget": "TextView",
	"properties": [
	    {"name":"textSize", "type": "dimen", "value":"13sp"},
	    {"name":"text", "type": "string", "value":"Hello Avocarrot!"}
from the root folder of the project


## Loading dynamic Layout
create and attach view in the specific Parent (created from xml) <br/>
```java
ViewParent viewParent = (ViewParent) findViewById(R.id.parent_view_id)
_(the script needs further development to create a valid JSON for <b>every</b> case)_ <br/>
try : <br/>

```
./gradlew runScript -Pxml=./pathToInputXmlFile.xml
```
from the root folder of the project


1. Fork the repo
2. Apply your changes
3. Write your tests
4. Create a new pull request

For feedback or suggestions you can drop us a line at support@avocarrot.com


You can check some example use cases in the wiki [here](https://github.com/Avocarrot/json2view/wiki/Creating-Dynamic-Layouts)


## Contributing

1. Fork the repo
2. Apply your changes
3. Write tests
4. Submit your pull request

For feedback or suggestions you can drop us a line at support@avocarrot.com

## License
[The MIT License (MIT)](https://github.com/Avocarrot/json2view/blob/master/LICENSE)


Also check out the project at [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-json2view-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1453)

<MSG> Update README.md
<DFF> @@ -1,8 +1,6 @@
 json2view  ![travis-ci](https://magnum.travis-ci.com/Avocarrot/json2view.svg?token=JZNsn6pty78ndT1Z2naj&branch=master)
 ======
 
-## Introduction
-
 **json2view** is a simple library that can convert a compatible JSON file to an Android view so you can load dynamically the view in your Android app without the need to update the APK.
 
 This removes the hassle of updating, re-compiling and uploading the APK to Google Play everytime you want to make small or big changes in the UI.
@@ -12,6 +10,7 @@ This removes the hassle of updating, re-compiling and uploading the APK to Googl
 - [How it works](#how-it-works)
 - [Examples](#examples)
 - [Installation](#installation)
+- [Getting started](#getting-started)
 - [Contributing](#contributing)
 - [License](#license)
 
@@ -23,19 +22,22 @@ This removes the hassle of updating, re-compiling and uploading the APK to Googl
 
 In the case of [Avocarrot](http://www.avocarrot.com), we are using json2view to run A/B test experiments and quickly deploy UI enhancements that improve revenue performance of native ads integrations in our network.
 
-## How it works?
+## How it works
 
 You can parse any xml through the json2view library to create a JSON that will be used at runtime to dynamically generate the Android UI using native code. This JSON can be hosted anywhere on the internet (your own server, Dropbox, Github Pages etc.) and can be fetched in your app at any point you decide.
 
-
 Note: Runtime creation of a view without the precompiled version of xml in apk (res/layout), especially for highly complex layouts, can be a potential latency issue.
 
 ## Examples
 
+### Changing text color
+
 Using json2view to change text color, background color and position of a view. [(more details)](https://github.com/Avocarrot/json2view/wiki/Changing-Properties)
 
 ![output](https://github.com/Avocarrot/json2view/blob/master/example_assets/test00.png)
 
+### Reorganizing the layout
+
 Using json2view to reorganize the layout of a screen. [(more details)](https://github.com/Avocarrot/json2view/wiki/Changing-Layouts)
 
 ![output](https://github.com/Avocarrot/json2view/blob/master/example_assets/test01.png)
@@ -64,8 +66,9 @@ project(':json2view'*).projectDir = new File(settingsDir, '$(json2viewPath)/json
 compile project(':json2view')
 ```
 
+## Getting started
 
-## Basic JSON Format
+### Basic JSON format
 The input JSON has 3 fields for every view we want to create :
 
 * `widget` : canonicalName of View (for views in package `android.widget` you can ommit `android.widget`)
@@ -103,7 +106,7 @@ try : <br/>
 from the root folder of the project
 
 
-## Loading dynamic Layout
+### Loading dynamic layout
 create and attach view in the specific Parent (created from xml) <br/>
 ```java
 ViewParent viewParent = (ViewParent) findViewById(R.id.parent_view_id)
@@ -118,8 +121,8 @@ You can check some example use cases in the wiki [here](https://github.com/Avoca
 
 1. Fork the repo
 2. Apply your changes
-3. Write your tests
-4. Create a new pull request
+3. Write tests
+4. Submit your pull request
 
 For feedback or suggestions you can drop us a line at support@avocarrot.com
 

Update README.md