예제 #1
0
파일: App.java 프로젝트: freddieptf/MyManga
 @Override
 public void onCreate() {
   super.onCreate();
   JobManager.create(this).addJobCreator(new SyncJobCreator());
   if (LeakCanary.isInAnalyzerProcess(this)) {
     return;
   }
   LeakCanary.install(this);
 }
예제 #2
0
 @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;
   }
   refWatcher = LeakCanary.install(this);
   // sInstance = this;
 }
예제 #3
0
  @Override
  public void onCreate() {
    StrictModeUtil.init();
    super.onCreate();
    refWatcher = LeakCanary.install(this);
    mContext = this;
    ImageLoadProxy.initImageLoader(this);
    JUtils.initialize(this);

    new Thread(
            new Runnable() {
              @Override
              public void run() {
                mAllArea = AreaArrayDataHelper.getAll(mContext);
              }
            })
        .start();

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

    Stetho.initializeWithDefaults(this);

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

    // 全局捕获异常
    MyCrashHandler handler = MyCrashHandler.getInstance();
    Thread.currentThread().setUncaughtExceptionHandler(handler);
  }
예제 #4
0
  @Override
  public void onCreate() {
    super.onCreate();

    LeakCanary.install(this);

    String apiPrefKey = getString(R.string.pref_apiendpoint_key);
    String versionCodePrefKey = getString(R.string.pref_versioncode_key);
    String apiDefaultValue = getString(R.string.pref_apiendpoint_default);

    String server;
    try {
      PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
      int versionCode = packageInfo.versionCode;
      int lastVersionCode =
          PreferenceManager.getDefaultSharedPreferences(this).getInt(versionCodePrefKey, 0);
      if (lastVersionCode < versionCode) {
        // Update detected
        server = apiDefaultValue;
        SharedPreferences.Editor editor =
            PreferenceManager.getDefaultSharedPreferences(this).edit();
        editor.putInt(versionCodePrefKey, versionCode);
        editor.putString(apiPrefKey, apiDefaultValue);
        editor.apply();
      } else {
        server =
            PreferenceManager.getDefaultSharedPreferences(this)
                .getString(apiPrefKey, apiDefaultValue);
      }
    } catch (PackageManager.NameNotFoundException e) {
      server = apiDefaultValue;
    }

    DrinksProvider.updateServer(server);
  }
예제 #5
0
  @Override
  public void onCreate() {
    super.onCreate();
    //        if (isDexProcess()) {
    //            return;
    //        }

    if (BuildConfig.LOG_DEBUG) {
      LeakCanary.install(this);
      //            BlockCanary.install(this, new NoteBlockCanaryContext(this)).start();
      AndroidDevMetrics.initWith(this);
    }

    initComponent();
    Utils.init(this);
    initImageLoader();
    FilePathUtils.initEnvironment(this);

    // 打点
    MobclickAgent.setDebugMode(BuildConfig.LOG_DEBUG);
    MobclickAgent.openActivityDurationTrack(true);
    MobclickAgent.updateOnlineConfig(this);
    MobclickAgent.setCatchUncaughtExceptions(!BuildConfig.LOG_DEBUG);

    //        CrashHandler.getInstance().init(getApplicationContext());

    YLog.setDEBUG(BuildConfig.LOG_DEBUG);
  }
예제 #6
0
 @Override
 public void onCreate() {
   super.onCreate();
   LeakCanary.install(this);
   initRealm();
   initCalligraphy();
 }
예제 #7
0
파일: App.java 프로젝트: imesong/NBAPlus
 @Override
 public void onCreate() {
   super.onCreate();
   FIR.init(this);
   mRefWatcher = LeakCanary.install(this);
   sContext = getApplicationContext();
   AppService.getInstance().initService();
 }
예제 #8
0
  @Override
  public void onCreate() {
    super.onCreate();
    mInstance = this;
    lapList = new ArrayList<>();

    LeakCanary.install(this);
  }
 public static AndroidLeakcanary newInstance(Application application) {
   if (instance != null) {
     throw new IllegalArgumentException("already exist instance");
   }
   final RefWatcher watcher = LeakCanary.install(application);
   instance = new AndroidLeakcanary(watcher);
   return instance;
 }
예제 #10
0
  @Override
  public void onCreate() {
    super.onCreate();

    if (BuildConfig.DEBUG) {
      LeakCanary.install(this);
      Stetho.initializeWithDefaults(this);
    }
  }
예제 #11
0
 @Override
 public void init(Boolean debug) {
   super.init(debug);
   LeakCanary.install(this);
   initDataBase();
   ButterKnife.setDebug(BuildConfig.DEBUG_MODE);
   SharedPreHelper.init(AppConfig.SHARED_PRE_FILE_NAME);
   DiskLruCacheUtil.init(AppConfig.MAX_CACHE_VALUE, AppConfig.CACHE_FOLDER);
   AppConfig.MODE_CONNECTION =
       (boolean) SharedPreHelper.get(this, Constants.MODE_CONNECTION, true);
   registerActivityLifecycleCallbacks(new ActivityLifeRecycleHandler());
 }
예제 #12
0
 @Override
 public void onCreate() {
   if (BuildConfig.DEBUG) {
     StrictMode.setThreadPolicy(
         new StrictMode.ThreadPolicy.Builder()
             .detectAll()
             .penaltyLog()
             .penaltyFlashScreen()
             .build());
     StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
   } else ACRA.init(this);
   playStoreVariant = BuildConfig.FLAVOR.equals("play");
   super.onCreate();
   refWatcher = LeakCanary.install(this);
 }
예제 #13
0
  @Override
  public void onCreate() {
    super.onCreate();
    AndroidThreeTen.init(this);
    LeakCanary.install(this);

    if (BuildConfig.DEBUG) {
      Timber.plant(new DebugTree());
    } else {
      // TODO Crashlytics.start(this);
      // TODO Timber.plant(new CrashlyticsTree());
    }

    objectGraph = ObjectGraph.create(Modules.list(this));
    objectGraph.inject(this);

    lumberYard.cleanUp();
    Timber.plant(lumberYard.tree());

    registerActivityLifecycleCallbacks(activityHierarchyServer);
  }
  @Override
  public void onCreate() {
    super.onCreate();

    // Catch leaks, in debug builds (release builds use a no-op).
    LeakCanary.install(this);

    // Let us log errors from Picasso to give us some clues when things go wrong.
    // Unfortunately, we can't get these errors in the regular onError() callback:
    // https://github.com/square/picasso/issues/379
    final Picasso picasso =
        (new Picasso.Builder(this)).listener(GalaxyZooApplication.picassoListener).build();
    // This affects what, for instance, Picasso.with() will return:
    try {
      Picasso.setSingletonInstance(picasso);
    } catch (final IllegalStateException ex) {
      // Nevermind if this happens. It's not worth crashing the app because of this.
      // It would just mean that we don't log the errors.
      Log.error(
          "GalaxyZooApplication.onCreate(): It is too late to call Picasso.setSingletonInstance().",
          ex);
    }
  }
예제 #15
0
 @Override
 public void onCreate() {
   super.onCreate();
   instance = this;
   refWatcher = LeakCanary.install(this);
 }
  @Override
  public void onCreate() {
    super.onCreate();

    LeakCanary.install(this);
  }
 @Provides
 public RefWatcher provideRefWatcher(Application application) {
   return LeakCanary.install(application);
 }
예제 #18
0
 @Override
 public void onCreate() {
   super.onCreate();
   enabledStrictMode();
   LeakCanary.install(this);
 }
예제 #19
0
 protected RefWatcher installLeakCanary() {
   return LeakCanary.install(this);
 }
 private void enableMemoryLeakDetection() {
   refWatcher = LeakCanary.install(this);
 }
 @Override
 public void init() {
   refWatcher = LeakCanary.install(qualityMattersApp);
 }