Java Code Examples for com.facebook.stetho.Stetho#initializeWithDefaults()

The following examples show how to use com.facebook.stetho.Stetho#initializeWithDefaults() . 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: 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 2
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 3
Source File: App.java    From android-job with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Stetho.initializeWithDefaults(this);

    if (BuildConfig.DEBUG) {
        StrictMode.setThreadPolicy(
                new StrictMode.ThreadPolicy.Builder()
                        .detectAll()
                        .penaltyLog()
                        .penaltyDeath()
                        .build());

        StrictMode.setVmPolicy(
                new StrictMode.VmPolicy.Builder()
                        .detectAll()
                        .penaltyLog()
                        .penaltyDeath()
                        .build());
    }

    JobManager.create(this).addJobCreator(new DemoJobCreator());
}
 
Example 4
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 5
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 6
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 7
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 8
Source File: App.java    From xifan with 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 9
Source File: ApplicationAndroidStarter.java    From AndroidStarterAlt with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    sSharedApplication = this;

    Logger.init(TAG)
            .logLevel(LogLevel.FULL);

    Hawk.init(this).build();

    Stetho.initializeWithDefaults(this);

    try {
        buildComponent();
    } catch (final GeneralSecurityException poException) {
        if (BuildConfig.DEBUG) {
            Logger.t(TAG).e(poException, null);
        }
    }

    mComponentApplication.inject(this);
    merlin.bind();

    final StrictMode.ThreadPolicy loStrictModeThreadPolicy = new StrictMode.ThreadPolicy.Builder()
            .detectAll()
            .penaltyDeath()
            .build();
    StrictMode.setThreadPolicy(loStrictModeThreadPolicy);
}
 
Example 10
Source File: MimiDebugApplication.java    From mimi-reader with 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 11
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 12
Source File: App.java    From ParallaxBackLayout with MIT License 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Stetho.initializeWithDefaults(this);
    registerActivityLifecycleCallbacks(ParallaxHelper.getInstance());
}
 
Example 13
Source File: MyApplication.java    From RxAndroidOrm with Apache License 2.0 4 votes vote down vote up
@Override public void onCreate() {
    super.onCreate();
    RxAndroidOrm.onCreate(this);

    Stetho.initializeWithDefaults(this);
}
 
Example 14
Source File: StethoWrapper.java    From droidkaigi2016 with Apache License 2.0 4 votes vote down vote up
public void setup() {
    Stetho.initializeWithDefaults(context);
}
 
Example 15
Source File: SampleApplication.java    From android-card-form with MIT License 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    LeakCanary.install(this);
    Stetho.initializeWithDefaults(this);
}
 
Example 16
Source File: TronWalletApplication.java    From tron-wallet-android with Apache License 2.0 4 votes vote down vote up
public void onCreate() {
    super.onCreate();
    Stetho.initializeWithDefaults(this);

    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);

    mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.APP_OPEN, new Bundle());

    mContext = getApplicationContext();
    mDatabase = Room.databaseBuilder(mContext, TronWalletDatabase.class, DATABASE_FILE_NAME)
            .addMigrations(TronWalletDatabase.MIGRATION_1_2)
            .build();
    mIsInForeground = false;
    ProcessLifecycleOwner.get().getLifecycle().addObserver(this);

    Map<BlockExplorerUpdater.UpdateTask, Long> updaterIntervals = new HashMap<>();
    updaterIntervals.put(BlockExplorerUpdater.UpdateTask.Blockchain, BLOCKCHAIN_UPDATE_INTERVAL);
    updaterIntervals.put(BlockExplorerUpdater.UpdateTask.Nodes, NETWORK_UPDATE_INTERVAL);
    updaterIntervals.put(BlockExplorerUpdater.UpdateTask.Witnesses, NETWORK_UPDATE_INTERVAL);
    updaterIntervals.put(BlockExplorerUpdater.UpdateTask.Tokens, TOKENS_UPDATE_INTERVAL);
    updaterIntervals.put(BlockExplorerUpdater.UpdateTask.Accounts, ACCOUNTS_UPDATE_INTERVAL);
    BlockExplorerUpdater.init(this, updaterIntervals);


    AccountUpdater.init(this, ACCOUNT_UPDATE_FOREGROUND_INTERVAL);
    PriceUpdater.init(this, PRICE_UPDATE_INTERVAL);

    SharedPreferences sharedPreferences = getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE);

    if(sharedPreferences.getBoolean("logged_previous_transactions", false))
    {
        SharedPreferences.Editor editor = sharedPreferences.edit();

        List<Transaction> dbTransactions = TronWalletApplication.getDatabase().transactionDao().getAllTransactions();

        for(Transaction dbTransaction : dbTransactions) {
            Bundle bundle = new Bundle();
            bundle.putString("sender_address", dbTransaction.senderAddress);
            bundle.putString("hash", Hex.toHexString(Hash.sha256(dbTransaction.transaction.getRawData().toByteArray())));
            bundle.putString("contract", Utils.getContractName(dbTransaction.transaction.getRawData().getContract(0)));

            mFirebaseAnalytics.logEvent("sent_transaction", bundle);
        }
        editor.putBoolean("logged_previous_transactions", true);
    }
}
 
Example 17
Source File: MainApplication.java    From PreferencesProvider with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Stetho.initializeWithDefaults(this);
}
 
Example 18
Source File: DeveloperTools.java    From braintree-android-drop-in with MIT License 4 votes vote down vote up
public static void setup(Application application) {
    LeakLoggerService.setupLeakCanary(application);
    Stetho.initializeWithDefaults(application);
}
 
Example 19
Source File: StethoWrapper.java    From droidkaigi2016 with Apache License 2.0 4 votes vote down vote up
public void setup() {
    Stetho.initializeWithDefaults(context);
}
 
Example 20
Source File: PerformanceApp.java    From android-performance with MIT License 4 votes vote down vote up
private void initStetho() {
    Handler handler = new Handler(Looper.getMainLooper());
    Stetho.initializeWithDefaults(this);
}