All Projects → flipkart-incubator → Proteus

flipkart-incubator / Proteus

Licence: apache-2.0
Proteus : A JSON based LayoutInflater for Android

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Proteus

Tabulator
Interactive Tables and Data Grids for JavaScript
Stars: ✭ 4,329 (+267.18%)
Mutual labels:  json, data
Sheetjs
📗 SheetJS Community Edition -- Spreadsheet Data Toolkit
Stars: ✭ 28,479 (+2315.52%)
Mutual labels:  json, data
Data
This repository contains general data for Web technologies
Stars: ✭ 418 (-64.55%)
Mutual labels:  json, data
Quranjson
Quran JSON ~ 6236 verses, 114 surah, 30 Juz
Stars: ✭ 278 (-76.42%)
Mutual labels:  json, data
Chinese Xinhua
📙 中华新华字典数据库。包括歇后语,成语,词语,汉字。
Stars: ✭ 8,705 (+638.34%)
Mutual labels:  json, data
Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (+191.69%)
Mutual labels:  json, data
Fsharp.data
F# Data: Library for Data Access
Stars: ✭ 631 (-46.48%)
Mutual labels:  json, data
Awesome Json Datasets
A curated list of awesome JSON datasets that don't require authentication.
Stars: ✭ 2,421 (+105.34%)
Mutual labels:  json, data
Data Forge Ts
The JavaScript data transformation and analysis toolkit inspired by Pandas and LINQ.
Stars: ✭ 967 (-17.98%)
Mutual labels:  json, data
Jaymock
Minimal fake JSON test data generator.
Stars: ✭ 28 (-97.63%)
Mutual labels:  json, data
Wires
Light binding library for Xamarin
Stars: ✭ 34 (-97.12%)
Mutual labels:  binding, data-binding
Top Pypi Packages
A regular dump of the most-downloaded packages from PyPI
Stars: ✭ 53 (-95.5%)
Mutual labels:  json, data
Http Fake Backend
Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 253 (-78.54%)
Mutual labels:  json, data
Browser Compat Data
This repository contains compatibility data for Web technologies as displayed on MDN
Stars: ✭ 3,710 (+214.67%)
Mutual labels:  json, data
Vscode Data Preview
Data Preview 🈸 extension for importing 📤 viewing 🔎 slicing 🔪 dicing 🎲 charting 📊 & exporting 📥 large JSON array/config, YAML, Apache Arrow, Avro, Parquet & Excel data files
Stars: ✭ 245 (-79.22%)
Mutual labels:  json, data
Panini
A super simple flat file generator.
Stars: ✭ 562 (-52.33%)
Mutual labels:  json, data
Dop
JavaScript implementation for Distributed Object Protocol
Stars: ✭ 163 (-86.17%)
Mutual labels:  json, data
Exportsheetdata
Add-on for Google Sheets that allows sheets to be exported as JSON or XML.
Stars: ✭ 170 (-85.58%)
Mutual labels:  json, data
Kakajson
Fast conversion between JSON and model in Swift.
Stars: ✭ 867 (-26.46%)
Mutual labels:  json, data
Generator Http Fake Backend
Yeoman generator for building a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 49 (-95.84%)
Mutual labels:  json, data

: Android Layout Engine

Build Status Build Status Android Arsenal

Proteus is meant to be a drop-in replacement for Android’s LayoutInflater; but unlike the compiled XML layouts bundled in the APK, Proteus inflates layouts at runtime. With Proteus, you can control your Apps layout from the backend (no WebViews). Forget the boilerplate code to findViewById, cast it to a TextView, and then setText(). Proteus has runtime data bindings and formatters. Plugin in your own custom views and attributes and functions to flavour proteus to your requirements.

Getting Started

gradle (gradle 4.10.*)

// Add it in your root build.gradle at the end of repositories:
allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}
// Add in your app level dependency
dependencies {
    implementation 'com.github.flipkart-incubator.proteus:proteus-core:5.0.1'
    implementation 'com.github.flipkart-incubator.proteus:gson-adapter:5.0.1'
    implementation 'com.github.flipkart-incubator.proteus:cardview-v7:5.0.1'
    implementation 'com.github.flipkart-incubator.proteus:design:5.0.1'
    implementation 'com.github.flipkart-incubator.proteus:recyclerview-v7:5.0.1'
    implementation 'com.github.flipkart-incubator.proteus:support-v4:5.0.1'
}

How it works

Instead of writing layouts in XML, in proteus layouts are described in JSON, which can be used to inflate native Android UI at runtime. The JSON layouts can be hosted anywhere (on the device, on servers, etc.).

The Layout defines the the view heirarchy, just like XML.

The Data (optional) defines data bindings. These data bindings are similar to Android's Data Binding library.

Give the layout and data to ProteusLayoutInflater and get back a native view hierarchy.

Watch this video to see it in action.

Sample layout

{
  "type": "LinearLayout",
  "orientation": "vertical",
  "padding": "16dp",
  "children": [{
    "layout_width": "200dp",
    "gravity": "center",
    "type": "TextView",
    "text": "@{user.profile.name}"
  }, {
    "type": "HorizontalProgressBar",
    "layout_width": "200dp",
    "layout_marginTop": "8dp",
    "max": 6000,
    "progress": "@{user.profile.experience}"
  }]
}

Sample data

{
  "user": {
    "profile": {
      "name": "John Doe",
      "experience": 4192
    }
  }
}

Sample Java code

ProteusView view = proteusLayoutInflater.inflate(<layout>, <data>);
container.addView(view.getAsView());

Output

Setting up the Demo App

The demo app will let you play around with proteus as well as help you understand the internals better.

  • Install NodeJS here
  • open a terminal
  • cd into the project directory
  • run npm start
  • Start an AVD emulator
  • Install the Demo App

Ready to tinker

  • Tinker around with the layout and data
  • Hit the FAB to refresh the app.

Resources

Supported Modules

  • Native Android Widgets
  • CardView v7
  • Android Design Library
  • RecyclerView v7
  • Android Support v4

Contributing

How?

The easiest way to contribute is by forking the repo, making your changes and creating a pull request.

What?

  • Adding new Views and Attribute Proccessors.
  • Adding new Functions.
  • Adding JavaDoc and Wiki.
  • Completing TODOs
  • Writing unit tests.
  • Finding bugs and issues. (submit here)
  • Fixing bugs and issues.
  • Implement performance/benchmarking tools.

License

Apache v2.0

If you are using proteus check out the can, cannot and must

Contributors

You can check out the contributors here, but if you wish to contact us; just drop in a mail.

StackOverflow

Find us on StackOverflow at proteus.

Plugins

One click XML to JSON conversion plugin

Download this plugin (in beta) for Android Studio. Once enabled, you can select any android XML resource file and go to Tools > Proteus > Convert XML to JSON

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].