com.facebook.stetho.Stetho Java Examples

The following examples show how to use com.facebook.stetho.Stetho. 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
Source File: MainApplication.java    From NewAndroidArchitecture-Component-Github with Apache License 2.0 6 votes vote down vote up
@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 #2
Source File: JDApplication.java    From JianDan with 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 #3
Source File: MockIntegrationTestObjects.java    From dhis2-android-sdk with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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 #4
Source File: ChatApp.java    From BLEMeshChat with 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 #5
Source File: ComparisonApp.java    From fresco with 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 #6
Source File: SampleApplication.java    From px-android with 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 File: JianShiApplication.java    From jianshi with 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 #8
Source File: App.java    From android-ponewheel with 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 #9
Source File: GlideModule.java    From glide-support with 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 #10
Source File: AnagoApplication.java    From Anago with 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 File: DebugSpectreApplication.java    From quill with 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 #12
Source File: PalmApp.java    From OmniList with 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 #13
Source File: ReductorApp.java    From reductor with 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 #14
Source File: App.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@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 #15
Source File: AndroidApplication.java    From mvp-android-arch-component with 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 #16
Source File: SampleDebugApplication.java    From stetho with MIT License 5 votes vote down vote up
private void initializeStetho(final Context context) {
  // See also: Stetho.initializeWithDefaults(Context)
  Stetho.initialize(Stetho.newInitializerBuilder(context)
      .enableDumpapp(new DumperPluginsProvider() {
        @Override
        public Iterable<DumperPlugin> get() {
          return new Stetho.DefaultDumperPluginsBuilder(context)
              .provide(new HelloWorldDumperPlugin())
              .provide(new APODDumperPlugin(context.getContentResolver()))
              .finish();
        }
      })
      .enableWebKitInspector(new ExtInspectorModulesProvider(context))
      .build());
}
 
Example #17
Source File: PretixDroid.java    From pretixdroid with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    if (BuildConfig.DEBUG) {
        Stetho.initializeWithDefaults(this);
    }
}
 
Example #18
Source File: App.java    From android-app with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    Security.insertProviderAt(Conscrypt.newProvider(), 1);

    if (BuildConfig.DEBUG) {
        Stetho.initializeWithDefaults(this);
        WebView.setWebContentsDebuggingEnabled(true);
    }

    EventBus.builder()
            .sendNoSubscriberEvent(false)
            .sendSubscriberExceptionEvent(false)
            .throwSubscriberException(BuildConfig.DEBUG)
            .addIndex(new EventBusIndex())
            .installDefaultEventBus();

    Settings.init(this);
    settings = new Settings(this);
    settings.initPreferences();

    NotificationsHelper.createNotificationChannels(this);

    new EventProcessor(this).start();

    DbConnection.setContext(this);

    instance = this;
}
 
Example #19
Source File: App.java    From zhizhihu with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    sContext = getApplicationContext();

    Realm.setDefaultConfiguration(new RealmConfiguration.Builder(getApplicationContext()).build());

    if (AppConfig.isDebug) {
        Stetho.initializeWithDefaults(this);  // 开启 Stetho 调试模式
        Logger.init("=LingKu=").logLevel(LogLevel.FULL);
    } else {
        Logger.init().logLevel(LogLevel.NONE);
    }

}
 
Example #20
Source File: MyApplication.java    From OkDownload with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Stetho.initializeWithDefaults(this);
    OkHttpClient client = new OkHttpClient();
    client.networkInterceptors().add(new StethoInterceptor());
}
 
Example #21
Source File: App.java    From android-notepad with MIT License 5 votes vote down vote up
@Override
public void onCreate()
{
    super.onCreate();
    CONTEXT = getApplicationContext();
    FlowManager.init(this);
    Stetho.initializeWithDefaults(this);
    configureJobManager();
}
 
Example #22
Source File: AndroidApplication.java    From android-clean-sample-app with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    // init database
    FlowManager.init(this);

    // enable logging
    Timber.plant(new DebugTree());

    // enable stetho
    Stetho.initializeWithDefaults(this);
}
 
Example #23
Source File: DebugAppLifecycleCallbacks.java    From photosearcher with Apache License 2.0 5 votes vote down vote up
protected void setupStetho() {
    Stetho.initialize(
            Stetho.newInitializerBuilder(mApp)
                    .enableDumpapp(Stetho.defaultDumperPluginsProvider(mApp))
                    .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(mApp))
                    .build());
}
 
Example #24
Source File: ChaoliApplication.java    From chaoli-forum-for-android-2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    // train classifier on app start
    CodeProcessor.init(this);
    ChaoliApplication.appContext = getApplicationContext();
    if (NightModeHelper.isDay()){
        AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
    }else {
        AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
    }
    Stetho.initializeWithDefaults(this);
}
 
Example #25
Source File: StockHawkApplication.java    From Stock-Hawk with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    if (BuildConfig.DEBUG) {
        Timber.plant(new Timber.DebugTree());
        Fabric.with(this, new Crashlytics());
    }

    FlowManager.init(new FlowConfig.Builder(this).build());
    Stetho.initializeWithDefaults(this);
}
 
Example #26
Source File: MaoniSampleApplication.java    From maoni with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    if (BuildConfig.DEBUG) {
        Stetho.initializeWithDefaults(this);
    }
}
 
Example #27
Source File: MptApplication.java    From android with Apache License 2.0 5 votes vote down vote up
@Override
public void onPreCreate() {
    super.onPreCreate();
    Timber.plant(new Timber.DebugTree());
    Timber.plant(new StethoTree());
    Stetho.initializeWithDefaults(this);
}
 
Example #28
Source File: RestApplication.java    From android-rest-client-template with MIT License 5 votes vote down vote up
@Override
  public void onCreate() {
      super.onCreate();
      // when upgrading versions, kill the original tables by using
// fallbackToDestructiveMigration()
      myDatabase = Room.databaseBuilder(this, MyDatabase.class,
              MyDatabase.NAME).fallbackToDestructiveMigration().build();

      // use chrome://inspect to inspect your SQL database
      Stetho.initializeWithDefaults(this);
  }
 
Example #29
Source File: StethoInitializer.java    From droidconat-2016 with Apache License 2.0 5 votes vote down vote up
private InspectorModulesProvider createWebkitModulesProvider() {
    return () -> new Stetho.DefaultInspectorModulesBuilder(context).runtimeRepl(
            new JsRuntimeReplFactoryBuilder(context)
                    .addFunction("activity", new BaseFunction() {
                        @Override
                        public Object call(org.mozilla.javascript.Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
                            return activityProvider.getCurrentActivity();
                        }
                    }).build()
    ).finish();
}
 
Example #30
Source File: StethoInitializer.java    From droidconat-2016 with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<DumperPlugin> get() {
    List<DumperPlugin> plugins = new ArrayList<>();
    for (DumperPlugin plugin : Stetho.defaultDumperPluginsProvider(context).get()) {
        plugins.add(plugin);
    }
    plugins.add(appDumper);
    return plugins;
}