/stetho-util

Utils for the facebook stetho.

Primary LanguageJava

stetho-util

Build Status Download

Utils for the facebook stetho.

Download

This library already included in Jcenter & MavenCentral

Gradle:

Stetho Base Util

releaseCompile 'org.ligboy:stetho-no-op:0.3.0'
debugCompile 'org.ligboy:stetho:0.3.0'

Stetho OkHttp Util

releaseCompile 'org.ligboy:stetho-okhttp-no-op:0.3.0'
debugCompile 'org.ligboy:stetho-okhttp:0.3.0'

Stetho OkHttp3 Util

releaseCompile 'org.ligboy:stetho-okhttp3-no-op:0.3.0'
debugCompile 'org.ligboy:stetho-okhttp3:0.3.0'

Stetho Timber Util

releaseCompile 'org.ligboy:stetho-timber-no-op:0.3.0'
debugCompile 'org.ligboy:stetho-timber:0.3.0'

Via Maven

Stetho Base Util

<dependencies>
  <dependency>
    <groupId>org.ligboy</groupId>
    <artifactId>stetho-no-op</artifactId>
    <version>0.3.0</version>
    <scope>compile</scope>
  </dependency>
  <dependency>
    <groupId>org.ligboy</groupId>
    <artifactId>stetho</artifactId>
    <version>0.3.0</version>
    <scope>debug</scope>
  </dependency>
</dependencies>

Stetho OkHttp Util

<dependencies>
  <dependency>
    <groupId>org.ligboy</groupId>
    <artifactId>okhttp-no-op</artifactId>
    <version>0.3.0</version>
    <scope>compile</scope>
  </dependency>
  <dependency>
    <groupId>org.ligboy</groupId>
    <artifactId>okhttp</artifactId>
    <version>0.3.0</version>
    <scope>debug</scope>
  </dependency>
</dependencies>

Stetho OkHttp3 Util

<dependencies>
  <dependency>
    <groupId>org.ligboy</groupId>
    <artifactId>okhttp3-no-op</artifactId>
    <version>0.3.0</version>
    <scope>compile</scope>
  </dependency>
  <dependency>
    <groupId>org.ligboy</groupId>
    <artifactId>okhttp3</artifactId>
    <version>0.3.0</version>
    <scope>debug</scope>
  </dependency>
</dependencies>

Stetho Timber Util

<dependencies>
  <dependency>
    <groupId>org.ligboy</groupId>
    <artifactId>timber-no-op</artifactId>
    <version>0.3.0</version>
    <scope>compile</scope>
  </dependency>
  <dependency>
    <groupId>org.ligboy</groupId>
    <artifactId>timber</artifactId>
    <version>0.3.0</version>
    <scope>debug</scope>
  </dependency>
</dependencies>

Usage

/**
 * @author Ligboy.Liu ligboy@gmail.com.
 */
public class DemoApplication extends Application {

    /**
     * Don't do like this in product. You should use lazy initialization.
     */
    public static final OkHttpClient HTTP_CLIENT = new OkHttpClient();
    public static okhttp3.OkHttpClient httpClient3;

    @Override
    public void onCreate() {
        super.onCreate();
        StethoUtil.initialize(this);

        StethoOkHttpUtil.setup(HTTP_CLIENT);

        httpClient3 = new okhttp3.OkHttpClient.Builder()
                .addInterceptor(new StethoOkHttp3Interceptor())
                .build();

        Timber.plant(new StethoTree());
    }
}

Author

  • Ligboy Liu

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.