com.jakewharton.threetenabp.AndroidThreeTen Java Examples

The following examples show how to use com.jakewharton.threetenabp.AndroidThreeTen. 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: ReadhubApplicationLike.java    From JReadHub with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    sApp = getApplication();
    sInstance = this;
    appComponent = DaggerAppComponent.builder()
            .appModule(new AppModule(sApp))
            /*.databaseModule(new DatabaseModule())
            .networkModule(new NetworkModule())*/
            .build();
    appComponent.inject(this);
    if (LeakCanary.isInAnalyzerProcess(getApplication())) {
        // This process is dedicated to LeakCanary for heap analysis.
        // You should not init your app in this process.
        return;
    }
    initBugly();

    LeakCanary.install(getApplication());
    AppStatusTracker.init(getApplication());
    AndroidThreeTen.init(getApplication());
    //CrashHandler.getApp().init(getApplicationContext());
}
 
Example #2
Source File: U2020App.java    From u2020-mvp with Apache License 2.0 6 votes vote down vote up
@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());
    }

    buildComponentAndInject();

    registerActivityLifecycleCallbacks(activityHierarchyServer);
}
 
Example #3
Source File: U2020App.java    From u2020 with Apache License 2.0 6 votes vote down vote up
@Override public void onCreate() {
  super.onCreate();
  if (LeakCanary.isInAnalyzerProcess(this)) {
    return;
  }
  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());
}
 
Example #4
Source File: ElectricityApplication.java    From android-things-electricity-monitor with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    CalligraphyConfig.initDefault(
            new CalligraphyConfig.Builder().setDefaultFontPath("minyna.ttf").setFontAttrId(R.attr.fontPath)
                    .build());
    AndroidThreeTen.init(this);
    FirebaseApp.initializeApp(this);
    FirebaseMessaging.getInstance().subscribeToTopic("Power_Notifications");
}
 
Example #5
Source File: MyApplication.java    From ankihelper with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    context = getApplicationContext();
    application = this;
    LitePalApplication.initialize(context);
    CrashReport.initCrashReport(getApplicationContext(), "398dc6145b", false);
    AndroidThreeTen.init(this);

}
 
Example #6
Source File: HomeActivity.java    From openlauncher with Apache License 2.0 5 votes vote down vote up
protected void onCreate(@Nullable Bundle savedInstanceState) {
    Companion.setLauncher(this);
    AndroidThreeTen.init(this);

    AppSettings appSettings = AppSettings.get();

    ContextUtils contextUtils = new ContextUtils(getApplicationContext());
    contextUtils.setAppLanguage(appSettings.getLanguage());
    super.onCreate(savedInstanceState);
    if (!Setup.wasInitialised()) {
        Setup.init(new HpInitSetup(this));
    }

    Companion.setLauncher(this);
    _db = Setup.dataManager();

    setContentView(getLayoutInflater().inflate(R.layout.activity_home, null));

    // transparent status and navigation
    if (VERSION.SDK_INT >= 21) {
        Window window = getWindow();
        View decorView = window.getDecorView();
        decorView.setSystemUiVisibility(1536);
    }

    init();
}
 
Example #7
Source File: DroidconApp.java    From droidconat-2016 with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    AndroidThreeTen.init(this);
    initGraph();
    initLogger();
}
 
Example #8
Source File: MainApplication.java    From droidkaigi2016 with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

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

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

    new StethoWrapper(this).setup();

    AndroidThreeTen.init(this);

    LocaleUtil.initLocale(this);
}
 
Example #9
Source File: ExamplesApp.java    From ThreeTenABP with Apache License 2.0 4 votes vote down vote up
@Override public void onCreate() {
  super.onCreate();
  AndroidThreeTen.init(this);
}
 
Example #10
Source File: HentoidApp.java    From Hentoid with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    instance = this;

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

    // Fix the SSLHandshake error with okhttp on Android 4.1-4.4 when server only supports TLS1.2
    // see https://github.com/square/okhttp/issues/2372 for more information
    try {
        ProviderInstaller.installIfNeeded(getApplicationContext());
    } catch (Exception e) {
        Timber.e(e, "Google Play ProviderInstaller exception");
    }

    // Init datetime
    AndroidThreeTen.init(this);

    // Timber
    if (BuildConfig.DEBUG) Timber.plant(new Timber.DebugTree());
    Timber.plant(new CrashlyticsTree());

    // Prefs
    Preferences.init(this);
    Preferences.performHousekeeping();

    // Image viewer
    // Needs ARGB_8888 to be able to resize images using RenderScript
    // (defaults to Bitmap.Config.RGB_565 if not set)
    CustomSubsamplingScaleImageView.setPreferredBitmapConfig(Bitmap.Config.ARGB_8888);

    // Init version number on first run
    if (0 == Preferences.getLastKnownAppVersionCode())
        Preferences.setLastKnownAppVersionCode(BuildConfig.VERSION_CODE);

    // Firebase
    boolean isAnalyticsEnabled = Preferences.isAnalyticsEnabled();
    FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(isAnalyticsEnabled);

    // DB housekeeping
    performDatabaseHousekeeping();

    // Init notification channels
    UpdateNotificationChannel.init(this);
    DownloadNotificationChannel.init(this);
    MaintenanceNotificationChannel.init(this);

    // Clears all previous notifications
    NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    if (manager != null) manager.cancelAll();

    // Run app update checks
    if (Preferences.isAutomaticUpdateEnabled()) {
        Intent intent = UpdateCheckService.makeIntent(this, false);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            startForegroundService(intent);
        } else {
            startService(intent);
        }
    }

    // Build Android shortcuts
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        ShortcutHelper.buildShortcuts(this);
    }

    // Send stats to Firebase
    FirebaseAnalytics.getInstance(this).setUserProperty("color_theme", Integer.toString(Preferences.getColorTheme()));
    FirebaseAnalytics.getInstance(this).setUserProperty("endless", Boolean.toString(Preferences.getEndlessScroll()));

    // Plug the lifecycle listener to handle locking
    ProcessLifecycleOwner.get().getLifecycle().addObserver(new LifeCycleListener());

    // Set RxJava's default error handler for unprocessed network and IO errors
    RxJavaPlugins.setErrorHandler(e -> {
        if (e instanceof UndeliverableException) {
            e = e.getCause();
        }
        if (e instanceof IOException) {
            // fine, irrelevant network problem or API that throws on cancellation
            return;
        }
        if (e instanceof InterruptedException) {
            // fine, some blocking code was interrupted by a dispose call
            return;
        }
        Timber.w(e, "Undeliverable exception received, not sure what to do");
    });
}
 
Example #11
Source File: MainApplication.java    From droidkaigi2016 with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

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

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

    new StethoWrapper(this).setup();

    AndroidThreeTen.init(this);

    LocaleUtil.initLocale(this);
}
 
Example #12
Source File: MaterialCalendarViewInitProvider.java    From material-calendarview with MIT License 4 votes vote down vote up
@Override public boolean onCreate() {
  // The interesting piece here.
  AndroidThreeTen.init(getContext());
  return true;
}