Created
August 23, 2015 08:56
-
-
Save muratcanbur/faf3b810a29950bfafab to your computer and use it in GitHub Desktop.
Stetho Utility class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class StethoUtil { | |
private static boolean init = false; | |
private StethoUtil() { | |
} | |
public static void init(Context context) { | |
if (BuildConfig.DEBUG) { | |
Stetho.initialize( | |
Stetho.newInitializerBuilder(context) | |
.enableDumpapp(Stetho.defaultDumperPluginsProvider(context)) | |
.enableWebKitInspector(Stetho.defaultInspectorModulesProvider(context)) | |
.build()); | |
init = true; | |
} | |
} | |
public static void addNetworkInterceptor(OkHttpClient client) { | |
if (init) { | |
client.networkInterceptors().add(new StethoInterceptor()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment