Java Code Examples for net.danlew.android.joda.JodaTimeAndroid#init()

The following examples show how to use net.danlew.android.joda.JodaTimeAndroid#init() . 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: BaldPhone.java    From BaldPhone with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    S.logImportant("BaldPhone was started!");
    super.onCreate();
    JodaTimeAndroid.init(this);
    AlarmScheduler.reStartAlarms(this);
    ReminderScheduler.reStartReminders(this);
    if (BuildConfig.FLAVOR.equals("baldUpdates")) {
        UpdatesActivity.removeUpdatesInfo(this);
    }
    try {
        startService(new Intent(this, NotificationListenerService.class));
    } catch (Exception e) {
        Log.e(TAG, e.getMessage());
        e.printStackTrace();
    }
    S.sendVersionInfo(this);
}
 
Example 2
Source File: TwistyTimer.java    From TwistyTimer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    JodaTimeAndroid.init(this);
    //LeakCanary.install(this);

    sAppContext = getApplicationContext();

    // Create a singleton instance of the "DatabaseHandler" using the application context. This
    // avoids memory leaks elsewhere and is more convenient. There is ABSOLUTELY NO NEED to
    // close the database EVER. Closing it in an ad hoc fashion (as was done in fragments and
    // activities) leads to all sorts of concurrency problems, race conditions, etc. SQLite
    // handles all of the concurrency itself, so there is no problem there. Android/Linux will
    // ensure that the database is closed if the application process exits.
    //
    // Note that the database is not opened here; it will not be opened until the first call to
    // "getReadableDatabase" or "getWritableDatabase" and then the open database instance will
    // be cached (by "SQLiteOpenHelper", which is the base class of "DatabaseHandler"). Those
    // two methods should really only be called from a background task, though, as opening the
    // database (particularly for the first time) can take some time.
    sDBHandler = new DatabaseHandler();

    LocaleUtils.updateLocale(getAppContext());
}
 
Example 3
Source File: GithubApplication.java    From android-rxmvp-tutorial with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();

  if(BuildConfig.DEBUG) {
    Timber.plant(new Timber.DebugTree(){
      @Override
      protected void log(int priority, String tag, String message, Throwable t) {
        super.log(priority, Constants.LOGTAG, message, t);
      }
    });
  }

  JodaTimeAndroid.init(this);

  appComponent = DaggerAppComponent.builder()
      .appModule(new AppModule(this))
      .build();
}
 
Example 4
Source File: AppController.java    From pybbsMD with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    context = this;

    // 初始化JodaTimeAndroid
    JodaTimeAndroid.init(this);

    // 配置全局异常捕获
    if (!BuildConfig.DEBUG) {
        Thread.setDefaultUncaughtExceptionHandler(this);
    }

    // 友盟设置调试模式
    MobclickAgent.setDebugMode(BuildConfig.DEBUG);
}
 
Example 5
Source File: BrainPhaserApplication.java    From BrainPhaser with GNU General Public License v3.0 5 votes vote down vote up
/**
 * initializes the DaoManager with a writeable database
 */
@Override
public void onCreate() {
    super.onCreate();
    JodaTimeAndroid.init(this);
    component = createComponent();
    PACKAGE_NAME = getApplicationContext().getPackageName();
}
 
Example 6
Source File: ParserApplication.java    From android-gpx-parser with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    // init joda date time
    JodaTimeAndroid.init(this);
}
 
Example 7
Source File: App.java    From twittererer with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    JodaTimeAndroid.init(this);

    Fabric.with(this, new Crashlytics());
    Twitter.initialize(new TwitterConfig.Builder(this).twitterAuthConfig(new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET)).build());

    applicationComponent = DaggerApp_ApplicationComponent.builder()
            .applicationModule(new ApplicationModule(this))
            .build();
}
 
Example 8
Source File: SensorbergTestRunner.java    From android-sdk with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle arguments) {
    MultiDex.install(getTargetContext());

    super.onCreate(arguments);
    System.setProperty("dexmaker.dexcache", getContext().getCacheDir().getPath());

    if (com.sensorberg.sdk.BuildConfig.RESOLVER_URL != null) {
        RetrofitApiTransport.RESOLVER_BASE_URL = com.sensorberg.sdk.BuildConfig.RESOLVER_URL;
    }
    JodaTimeAndroid.init(getContext());

    DateTimeZone e = DateTimeZone.forTimeZone(TimeZone.getTimeZone("GMT+01:00"));
    DateTimeZone.setDefault(e);
}
 
Example 9
Source File: JodaApplication.java    From joda-time-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    // It's important to initialize the ResourceZoneInfoProvider; otherwise
    // joda-time-android will not work.
    JodaTimeAndroid.init(this);
}
 
Example 10
Source File: TestDateUtils.java    From joda-time-android with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    // Init zone info
    Context context = InstrumentationRegistry.getInstrumentation().getContext();
    JodaTimeAndroid.init(context);

    // Force the system into 24-hour time for tests
    ContentResolver cr = context.getContentResolver();
    mOldTime1224Setting = Settings.System.getString(cr, Settings.System.TIME_12_24);
    Settings.System.putString(cr, Settings.System.TIME_12_24, "24");

    // Force all tests to be in the US locale; that way we can test output in consistent manner
    Application app = (Application) ApplicationProvider.getApplicationContext();
    Resources res = app.getBaseContext().getResources();
    Configuration config = res.getConfiguration();
    Locale.setDefault(Locale.US);
    config.locale = Locale.US;
    res.updateConfiguration(config, res.getDisplayMetrics());

    // Force the default timezone
    mDefaultJodaTz = DateTimeZone.forID("America/New_York");
    mOldDefaultJodaTz = DateTimeZone.getDefault();
    DateTimeZone.setDefault(mDefaultJodaTz);

    // ...And for the system as well
    mDefaultSystemTz = TimeZone.getTimeZone("America/Chicago");
    mOldDefaultSystemTz = TimeZone.getDefault();
    TimeZone.setDefault(mDefaultSystemTz);

    // Force current "now" time, so all tests can be consistent
    mNow = new DateTime(YEAR, MONTH_OF_YEAR, DAY_OF_MONTH, HOUR_OF_DAY,
        MINUTE_OF_HOUR, SECOND_OF_MINUTE, MILLIS_OF_SECOND, mDefaultJodaTz);
    DateTimeUtils.setCurrentMillisFixed(mNow.getMillis());
}
 
Example 11
Source File: MyApp.java    From ClockDrawableAnimation with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    JodaTimeAndroid.init(this);
}
 
Example 12
Source File: RememBirthday.java    From RememBirthday with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    // Initialize Date library
    JodaTimeAndroid.init(this);
}
 
Example 13
Source File: GPXParserTest.java    From android-gpx-parser with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
    JodaTimeAndroid.init(InstrumentationRegistry.getTargetContext());
}
 
Example 14
Source File: TimelineConverterTest.java    From twittererer with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
    JodaTimeAndroid.init(RuntimeEnvironment.application);
}
 
Example 15
Source File: App.java    From example with Apache License 2.0 4 votes vote down vote up
@Override public void onCreate() {
  super.onCreate();
  JodaTimeAndroid.init(this);
  setupTimber();
}
 
Example 16
Source File: SensorbergSdk.java    From android-sdk with MIT License 4 votes vote down vote up
synchronized private static void initLibraries(Context ctx) {
    if (ctx != null) {
        JodaTimeAndroid.init(ctx);
    }
}