Giter Site home page Giter Site logo

stetho-realm's Introduction

Stetho-Realm

Stetho-Realm is a Realm module for Stetho.

It displays Realm database content in Stetho instead of SQLite database content.

Set-up

Download

grab via Gradle:

repositories {
    maven { url 'https://github.com/linchaolong/stetho-realm/raw/master/maven-repo' } // realm-stetho
}

dependencies {
    compile 'com.facebook.stetho:stetho:1.4.2'
    compile 'com.uphyca:stetho_realm:2.0.1'
}

Stetho-Realm 2.0 supports Stetho 1.1 or newer and Realm 2.0.0 or newer. If you'd like to use Stetho-Realm with Realm 0.80.0 to Realm 1.2.0, please use the latest version of Realm 0.x.

Integration

In your Application class, please initialize Stetho with RealmInspectorModulesProvider.ProviderBuilder as follows.

RealmInspectorModulesProvider.ProviderBuilder replaces SQLite module with Realm module. You can use RealmInspectorModulesProvider.ProviderBuilder#baseProvider(InspectorModulesProvider) in order to customized InspectorModulesProvider instead of default provider.

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        Realm.init(this);

        Stetho.initialize(
                Stetho.newInitializerBuilder(this)
                        .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                        .enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
                        .build());
    }
}

By calling some methods in RealmInspectorModulesProvider.ProviderBuilder, you can include metadata table in table list, and can provide database file name pattern. And also you can specify base folder for database files, encryption keys, limit, sort order.

    RealmInspectorModulesProvider.builder(this)
            .withFolder(getCacheDir())
            .withEncryptionKey("encrypted.realm", key)
            .withMetaTables()
            .withDescendingOrder()
            .withLimit(1000)
            .databaseNamePattern(Pattern.compile(".+\\.realm"))
            .build()

use Stetho in debug build only

http://littlerobots.nl/blog/stetho-for-android-debug-builds-only/

License

Stetho-Realm is BSD-licensed.

TODO

  • coexistence with SQLite module.
  • implementation of update, delete, etc.

deployment memo

  1. update version information
  2. ./gradlew clean assemble :stetho_realm:publishMavenPublicationToMavenRepository
  3. git add, commit, push (on master branch)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.