Java Code Examples for com.facebook.stetho.Stetho

The following examples show how to use com.facebook.stetho.Stetho. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void onCreate() {
    super.onCreate();
    Timber.plant(BuildConfig.DEBUG ? new DebugTree() : new ReleaseTree());
    ProcessLifecycleOwner.get().getLifecycle().addObserver(this);

    if (BuildConfig.DEBUG)
        Stetho.initializeWithDefaults(this);

    Mapbox.getInstance(this, BuildConfig.MAPBOX_ACCESS_TOKEN);

    Fabric.with(this, new Crashlytics());

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
        upgradeSecurityProviderSync();

    setUpAppComponent();
    setUpServerComponent();
    setUpRxPlugin();
}
 
Example 2
Source Project: OmniList   Source File: PalmApp.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics());

    mInstance = this;

    MultiDex.install(this);

    Colorful.init(this);

    /*
     * Enable stetho only in debug mode. */
    if (BuildConfig.DEBUG) {
        Stetho.initializeWithDefaults(this);
    }

    AlarmsManager.init(getApplicationContext());

    WakeLockManager.init(getApplicationContext(), false);
}
 
Example 3
@Override
public void onCreate() {
    super.onCreate();

    Stetho.initializeWithDefaults(this);

    this.appComponent = DaggerAppComponent.builder()
            .appModule(new AppModule(this))
            .roomModule(new RoomModule(this))
            .build();

    appComponent.inject(this);

    new Thread(new Runnable() {
        @Override
        public void run() {
            //called first time created
            userDao.deleteAll();
            userDao.insert(new UserLocal("kevin", "kévin", ""));
            userDao.insert(new UserLocal("florent37", "flo", ""));
        }
    }).start();
}
 
Example 4
Source Project: android-ponewheel   Source File: App.java    License: MIT License 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    PACKAGE_NAME = getApplicationContext().getPackageName();

    if (BuildConfig.DEBUG || getSharedPreferences().isDebugging()) {
        Stetho.initializeWithDefaults(this);
        LumberYard lumberYard = LumberYard.getInstance(this);
        lumberYard.cleanUp();
        Timber.plant(lumberYard.tree());
        Timber.plant(new DebugTree());
        //Timber.plant(new Timber.DebugTree());
    }
    initWakeLock();
    initDatabase();
}
 
Example 5
Source Project: mvp-android-arch-component   Source File: AndroidApplication.java    License: MIT License 6 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();

  initializeDependencies();

  if (BuildConfig.DEBUG) {
    Timber.plant(new Timber.DebugTree());
    Stetho.initializeWithDefaults(this);
  }

  if (LeakCanary.isInAnalyzerProcess(this)) {
    return;
  }
  LeakCanary.install(this);
}
 
Example 6
Source Project: px-android   Source File: SampleApplication.java    License: MIT License 6 votes vote down vote up
private void initializeLeakCanary() {
    if (LeakCanary.isInAnalyzerProcess(this)) {
        return;
    }
    LeakCanary.install(this);
    Stetho.initializeWithDefaults(this);

    // Create client base, add interceptors
    OkHttpClient.Builder baseClient = HttpClientUtil.createBaseClient(this, 10, 10, 10)
        .addNetworkInterceptor(new StethoInterceptor());

    // customClient: client with TLS protocol setted
    final OkHttpClient customClient = HttpClientUtil.enableTLS12(baseClient)
        .build();

    HttpClientUtil.setCustomClient(customClient);

    Dependencies.getInstance().initialize(getApplicationContext());

    final ESCManagerBehaviour escManagerBehaviour = new FakeEscManagerBehaviourImpl();
    new PXBehaviourConfigurer()
        .with(new MockSecurityBehaviour(escManagerBehaviour))
        .with(escManagerBehaviour)
        .with(FakeLocaleBehaviourImpl.INSTANCE)
        .configure();
}
 
Example 7
Source Project: glide-support   Source File: GlideModule.java    License: The Unlicense 6 votes vote down vote up
@Override public void registerComponents(Context context, Glide glide) {
		Stetho.initializeWithDefaults(context);
		final Cache cache = new Cache(new File(context.getCacheDir(), "okhttp"), IMAGE_CACHE_SIZE);

		HttpLoggingInterceptor logger = new HttpLoggingInterceptor();
//		logger.setLevel(Level.BASIC);

		OkHttpClient client = new OkHttpClient()
				.newBuilder()
				.cache(cache)
				.addNetworkInterceptor(new StethoInterceptor())
				.addInterceptor(logger)
				.build();

		glide.register(CachedGlideUrl.class, InputStream.class,
				superFactory(new OkHttpUrlLoader.Factory(client), CachedGlideUrl.class));
		glide.register(ForceLoadGlideUrl.class, InputStream.class,
				superFactory(new OkHttpUrlLoader.Factory(client), ForceLoadGlideUrl.class));
	}
 
Example 8
Source Project: fresco   Source File: ComparisonApp.java    License: MIT License 6 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();
  final Context context = this;
  Stetho.initialize(
      Stetho.newInitializerBuilder(context)
          .enableDumpapp(
              new DumperPluginsProvider() {
                @Override
                public Iterable<DumperPlugin> get() {
                  return new Stetho.DefaultDumperPluginsBuilder(context)
                      .provide(new FrescoStethoPlugin())
                      .finish();
                }
              })
          .build());
}
 
Example 9
Source Project: jianshi   Source File: JianShiApplication.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();

  appComponent = DaggerAppComponent.builder()
      .appModule(new AppModule(JianShiApplication.this))
      .build();

  final Fabric fabric = new Fabric.Builder(this)
      .kits(new Crashlytics())
      .debuggable(true)
      .build();
  Fabric.with(fabric);
  Stetho.initializeWithDefaults(this);
  instance = this;
  FlowManager.init(new FlowConfig.Builder(this).openDatabasesOnInit(true).build());

  initLog();

  CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
      .setDefaultFontPath("fonts/jianshi_default.otf")
      .setFontAttrId(R.attr.fontPath)
      .build()
  );
}
 
Example 10
Source Project: Anago   Source File: AnagoApplication.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    if (!isUnitTest()) {
        if (LeakCanary.isInAnalyzerProcess(this)) {
            return;
        }
        LeakCanary.install(this);

        Stetho.initializeWithDefaults(this);

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

    injector = buildAppComponent();
}
 
Example 11
Source Project: reductor   Source File: ReductorApp.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    final AppStateReducer vanillaReducer = AppStateReducer.builder()
            .notesReducer(NotesListReducer.create())
            .filterReducer(NotesFilterReducer.create())
            .build();
    store = Store.create(
            new SetStateReducer<>(
                    new UndoableReducer<>(vanillaReducer)));

    Stetho.initialize(Stetho.newInitializerBuilder(this)
            .enableWebKitInspector(() -> new Stetho.DefaultInspectorModulesBuilder(ReductorApp.this)
                    .runtimeRepl(createRuntimeRepl())
                    .finish())
            .build());

}
 
Example 12
Source Project: quill   Source File: DebugSpectreApplication.java    License: MIT License 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    if (LeakCanary.isInAnalyzerProcess(this)) {
        // This process is dedicated to LeakCanary for heap analysis.
        // You should not init your app in this process.
        return;
    }

    // auto-detect Activity memory leaks!
    LeakCanary.install(this);

    Stetho.initialize(Stetho.newInitializerBuilder(this)
            .enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
            .build());
}
 
Example 13
Source Project: JianDan   Source File: JDApplication.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    StrictModeUtil.init();
    super.onCreate();
    refWatcher = LeakCanary.install(this);
    mContext = this;
    ImageLoadProxy.initImageLoader(this);

    if (BuildConfig.DEBUG) {
        Logger.init().hideThreadInfo().setMethodCount(1).setLogLevel(LogLevel.FULL);
    }

    Stetho.initialize(
            Stetho.newInitializerBuilder(this)
                    .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                    .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
                    .build());

}
 
Example 14
Source Project: BLEMeshChat   Source File: ChatApp.java    License: Mozilla Public License 2.0 6 votes vote down vote up
@Override public void onCreate() {
    super.onCreate();

    if (BuildConfig.DEBUG) {
        Timber.plant(new Timber.DebugTree());

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

    // If we abandon Timber logging in this app, enable below line
    // to enable Timber logging in sdk
    //Logging.forceLogging();
}
 
Example 15
public MockIntegrationTestObjects(MockIntegrationTestDatabaseContent content) throws Exception {
    this.content = content;

    Context context = InstrumentationRegistry.getTargetContext().getApplicationContext();
    Stetho.initializeWithDefaults(context);

    dhis2MockServer = new Dhis2MockServer(0);
    CalendarProviderFactory.setFixed();

    d2 = D2Factory.forNewDatabase();

    databaseAdapter = d2.databaseAdapter();
    d2DIComponent = d2.d2DIComponent;

    resourceHandler = ResourceHandler.create(databaseAdapter);
    resourceHandler.setServerDate(serverDate);
}
 
Example 16
Source Project: ml   Source File: ObjectDetectionApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    if (BuildConfig.USE_STETHO) {
        Stetho.initializeWithDefaults(this);
    }

    ImageLoaderConfiguration config =
            new ImageLoaderConfiguration.Builder(this).build();

    ImageLoader.getInstance().init(config);
}
 
Example 17
Source Project: ground-android   Source File: GndApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
  if (BuildConfig.DEBUG) {
    Timber.d("DEBUG build config active; enabling debug tooling");

    // Debug bridge for Android applications. Enables network and database debugging for the app
    // accessible under chrome://inspect in Chrome desktop browser. Must be done before calling
    // setStrictMode().
    Stetho.initializeWithDefaults(this);

    // Log failures when trying to do work in the UI thread.
    setStrictMode();
  }

  super.onCreate();

  // Enable RxJava assembly stack collection for more useful stack traces.
  RxJava2Debug.enableRxJava2AssemblyTracking(new String[] {getClass().getPackage().getName()});

  // Prevent RxJava from force-quitting on unhandled errors.
  RxJavaPlugins.setErrorHandler(RxDebug::logEnhancedStackTrace);

  // Set custom worker factory that allow Workers to use Dagger injection.
  // TODO(github.com/google/dagger/issues/1183): Remove once Workers support injection.
  WorkManager.initialize(
      this, new Configuration.Builder().setWorkerFactory(workerFactory).build());

  if (BuildConfig.DEBUG) {
    Timber.plant(new Timber.DebugTree());
  } else {
    Timber.plant(new CrashReportingTree());
  }
}
 
Example 18
Source Project: AndroidQuick   Source File: MyApplication.java    License: MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    if (LeakCanary.isInAnalyzerProcess(this)) {
        // This process is dedicated to LeakCanary for heap analysis.
        // You should not init your app in this process.
        return;
    }
    LeakCanary.install(this);
    //get application
    if (INSTANCE == null) {
        INSTANCE = this;
    }
    //log switcher
    LogUtil.setLogOn(true);
    //lifecyclecallback
    lifecycleCallback = new AQActivityLifecycleCallbacks();
    registerActivityLifecycleCallbacks(lifecycleCallback);
    //init ToastUtil
    ToastUtil.register(this);
    //init SpUtil
    SpUtil.init(this);
    //init greendao
    DBManager.getInstance().init(getApplicationContext());
    //init immersion

    //init stetho
    Stetho.initializeWithDefaults(this);
    //init crashhandler
    CrashHandler.getInstance().init(this);
    //init tinylog
    TinyLog.config().setEnable(true).apply();
    //init tag
    SearchManager.getInstance().init();
}
 
Example 19
Source Project: HeroVideo-master   Source File: HeroVideoApp.java    License: Apache License 2.0 5 votes vote down vote up
private void init() {
    // 初始化主题切换
    ThemeUtils.setSwitchColor(this);
    //初始化Leak内存泄露检测工具
    LeakCanary.install(this);
    //初始化Stetho调试工具
    Stetho.initialize(
            Stetho.newInitializerBuilder(this)
                    .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                    .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
                    .build());
}
 
Example 20
Source Project: hacker-news-android   Source File: HackerNewsApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    if (sInstance == null) {
        sInstance = this;
    }

    if("release".equals(BuildConfig.BUILD_TYPE)){
        Bugsnag.init(this);
    }

    mContext = getApplicationContext();
    Stetho.initialize(
            Stetho.newInitializerBuilder(this)
                  .enableDumpapp(
                          Stetho.defaultDumperPluginsProvider(this))
                  .enableWebKitInspector(
                          Stetho.defaultInspectorModulesProvider(this))
                  .build());

    sAppModule = new AppModule(this);
    sAppComponent = DaggerAppComponent.builder()
                                      .appModule(sAppModule)
                                      .build();
    sAppComponent.inject(this);

    LocalDataManager.initialize(mContext);
}
 
Example 21
Source Project: ExoPlayer-Offline   Source File: DemoApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();
  INSTANCE = this;
  userAgent = Util.getUserAgent(this, "ExoPlayerDemo");
  okHttpClient = new OkHttpClient.Builder().addNetworkInterceptor(new StethoInterceptor()).build();
  Stetho.initializeWithDefaults(this);
}
 
Example 22
Source Project: Protein   Source File: ProteinApp.java    License: Apache License 2.0 5 votes vote down vote up
@DebugLog
@Override
public void onCreate() {
    super.onCreate();
    ServiceGenerator.init(this);
    if (BuildConfig.DEBUG) {
        Stetho.initializeWithDefaults(this);
    }
    initAccessToken();
    ButterKnife.setDebug(BuildConfig.DEBUG);
    refWatcher = installLeakCanary();
}
 
Example 23
Source Project: xifan   Source File: App.java    License: Apache License 2.0 5 votes vote down vote up
private void init() {
    Router.initialize(this);

    Stetho.initializeWithDefaults(this);
    Logger.init(TAG)                 // default PRETTYLOGGER or use just init()
            .methodCount(1)                 // default 2
            .hideThreadInfo()               // default shown
            .logLevel(LogLevel.FULL)        // default LogLevel.FULL
            .methodOffset(2);            // default 0

    FIR.init(this);
    // 初始化参数依次为 this, AppId, AppKey
    AVOSCloud.initialize(this, Constants.AVOSCloud.APP_ID, Constants.AVOSCloud.APP_KEY);
    AVAnalytics.enableCrashReport(this, true);
}
 
Example 24
Source Project: OpenLibre   Source File: StethoUtils.java    License: GNU General Public License v3.0 5 votes vote down vote up
static void install(Application application, File dataPath){
     // debugging tool
     Stetho.initialize(
             Stetho.newInitializerBuilder(application)
                     .enableDumpapp(Stetho.defaultDumperPluginsProvider(application))
                     .enableWebKitInspector(RealmInspectorModulesProvider
                             .builder(application)
                             .withFolder(dataPath)
                             .withMetaTables()
                             .withLimit(1000000)
                             .databaseNamePattern(Pattern.compile(".+\\.realm"))
                             .build())
                     .build());
}
 
Example 25
Source Project: PreferenceRoom   Source File: MyApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();
  // initialize Stetho for debugging local data
  Stetho.initializeWithDefaults(this);

  /** initialize instances of preference component and entities. {@link AppComponent} */
  PreferenceComponent_AppComponent.init(this);
}
 
Example 26
Source Project: Android-OkGraphQl   Source File: MainApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    Stetho.initializeWithDefaults(getApplicationContext());
    okHttpClient = new OkHttpClient.Builder()
            .addInterceptor(new StethoInterceptor())
            .addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
            .build();
}
 
Example 27
Source Project: Open-Mam   Source File: MainApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    this.appComponent = DaggerAppComponent.builder()
            .appModule(new AppModule(this))
            .build();

    Stetho.initializeWithDefaults(this);
}
 
Example 28
Source Project: HeroVideo-master   Source File: HeroVideoApp.java    License: Apache License 2.0 5 votes vote down vote up
private void init() {
    // 初始化主题切换
    ThemeUtils.setSwitchColor(this);
    //初始化Leak内存泄露检测工具
    LeakCanary.install(this);
    //初始化Stetho调试工具
    Stetho.initialize(
            Stetho.newInitializerBuilder(this)
                    .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                    .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
                    .build());
}
 
Example 29
Source Project: mimi-reader   Source File: MimiDebugApplication.java    License: Apache License 2.0 5 votes vote down vote up
@Override
    public void onCreate() {
        super.onCreate();

//        if (!LeakCanary.isInAnalyzerProcess(this)) {
//            setRefWatcher(LeakCanary.install(this));
//        }
        Stetho.initializeWithDefaults(this);
    }
 
Example 30
Source Project: talk-android   Source File: DebugApp.java    License: MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    Stetho.initialize(Stetho.newInitializerBuilder(this)
            .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
            .build());
}