当前位置: 首页>>代码示例>>Java>>正文


Java JodaTimeAndroid.init方法代码示例

本文整理汇总了Java中net.danlew.android.joda.JodaTimeAndroid.init方法的典型用法代码示例。如果您正苦于以下问题:Java JodaTimeAndroid.init方法的具体用法?Java JodaTimeAndroid.init怎么用?Java JodaTimeAndroid.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.danlew.android.joda.JodaTimeAndroid的用法示例。


在下文中一共展示了JodaTimeAndroid.init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAverageGlucoseReadingsByWeek

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
public List<Integer> getAverageGlucoseReadingsByWeek() {
    JodaTimeAndroid.init(mContext);

    DateTime maxDateTime = new DateTime(realm.where(GlucoseReading.class).maximumDate("created").getTime());
    DateTime minDateTime = new DateTime(realm.where(GlucoseReading.class).minimumDate("created").getTime());

    DateTime currentDateTime = minDateTime;
    DateTime newDateTime = minDateTime;

    ArrayList<Integer> averageReadings = new ArrayList<Integer>();

    // The number of weeks is at least 1 since we do have average for the current week even if incomplete
    int weeksNumber = Weeks.weeksBetween(minDateTime, maxDateTime).getWeeks() + 1;

    for (int i = 0; i < weeksNumber; i++) {
        newDateTime = currentDateTime.plusWeeks(1);
        RealmResults<GlucoseReading> readings = realm.where(GlucoseReading.class)
                .between("created", currentDateTime.toDate(), newDateTime.toDate())
                .findAll();
        averageReadings.add(((int) readings.average("reading")));
        currentDateTime = newDateTime;
    }
    return averageReadings;
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:25,代码来源:DatabaseHandler.java

示例2: getGlucoseDatetimesByWeek

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
public List<String> getGlucoseDatetimesByWeek() {
    JodaTimeAndroid.init(mContext);

    DateTime maxDateTime = new DateTime(realm.where(GlucoseReading.class).maximumDate("created").getTime());
    DateTime minDateTime = new DateTime(realm.where(GlucoseReading.class).minimumDate("created").getTime());

    DateTime currentDateTime = minDateTime;
    DateTime newDateTime = minDateTime;

    ArrayList<String> finalWeeks = new ArrayList<String>();

    // The number of weeks is at least 1 since we do have average for the current week even if incomplete
    int weeksNumber = Weeks.weeksBetween(minDateTime, maxDateTime).getWeeks() + 1;

    DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    for (int i = 0; i < weeksNumber; i++) {
        newDateTime = currentDateTime.plusWeeks(1);
        finalWeeks.add(inputFormat.format(newDateTime.toDate()));
        currentDateTime = newDateTime;
    }
    return finalWeeks;
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:23,代码来源:DatabaseHandler.java

示例3: getAverageGlucoseReadingsByMonth

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
public List<Integer> getAverageGlucoseReadingsByMonth() {
    JodaTimeAndroid.init(mContext);

    DateTime maxDateTime = new DateTime(realm.where(GlucoseReading.class).maximumDate("created").getTime());
    DateTime minDateTime = new DateTime(realm.where(GlucoseReading.class).minimumDate("created").getTime());

    DateTime currentDateTime = minDateTime;
    DateTime newDateTime = minDateTime;

    ArrayList<Integer> averageReadings = new ArrayList<Integer>();

    // The number of months is at least 1 since we do have average for the current week even if incomplete
    int monthsNumber = Months.monthsBetween(minDateTime, maxDateTime).getMonths() + 1;

    for (int i = 0; i < monthsNumber; i++) {
        newDateTime = currentDateTime.plusMonths(1);
        RealmResults<GlucoseReading> readings = realm.where(GlucoseReading.class)
                .between("created", currentDateTime.toDate(), newDateTime.toDate())
                .findAll();
        averageReadings.add(((int) readings.average("reading")));
        currentDateTime = newDateTime;
    }
    return averageReadings;
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:25,代码来源:DatabaseHandler.java

示例4: getGlucoseDatetimesByMonth

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
public List<String> getGlucoseDatetimesByMonth() {
    JodaTimeAndroid.init(mContext);

    DateTime maxDateTime = new DateTime(realm.where(GlucoseReading.class).maximumDate("created").getTime());
    DateTime minDateTime = new DateTime(realm.where(GlucoseReading.class).minimumDate("created").getTime());

    DateTime currentDateTime = minDateTime;
    DateTime newDateTime = minDateTime;

    ArrayList<String> finalMonths = new ArrayList<String>();

    // The number of months is at least 1 because current month is incomplete
    int monthsNumber = Months.monthsBetween(minDateTime, maxDateTime).getMonths() + 1;

    DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    for (int i = 0; i < monthsNumber; i++) {
        newDateTime = currentDateTime.plusMonths(1);
        finalMonths.add(inputFormat.format(newDateTime.toDate()));
        currentDateTime = newDateTime;
    }
    return finalMonths;
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:23,代码来源:DatabaseHandler.java

示例5: onCreate

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    TallyStackerApplication.instance = this;
    JodaTimeAndroid.init(this);
    Fabric.with(this, new Crashlytics());
    Fabric.with(this, new Answers());
    Stetho.initializeWithDefaults(this);
    // Setup handler for uncaught exceptions.
    Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread thread, Throwable e) {
            if (!(e instanceof ExpectedElementNotFound))
                handleUncaughtException(e);
        }
    });
}
 
开发者ID:riteshakya037,项目名称:Android-Scrapper,代码行数:18,代码来源:TallyStackerApplication.java

示例6: onCreate

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    instance = this;

    applicationComponent = DaggerApplicationComponent.builder()
            .networkModule(new NetworkModule())
            .presentersModule(new PresentersModule())
            .sourceModule(new SourceModule(this))
            .gatewaysModule(new GatewaysModule())
            .managerModule(new ManagerModule(this))
            .utilsModule(new UtilsModule(this))
            .build();

    JodaTimeAndroid.init(this);
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath(getString(R.string.font_ubuntu))
            .setFontAttrId(R.attr.fontPath)
            .build()
    );
}
 
开发者ID:ehsunshine,项目名称:memory-game,代码行数:22,代码来源:MatchMatchApplication.java

示例7: onCreate

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics());

    JodaTimeAndroid.init(this);

    Settings.initialize(this);

    if (BuildConfig.DEBUG) {
        StrictMode.enableDefaults();
        ButterKnife.setDebug(true);

    }

    Dagger.initEagerSingletons(this);

    // get the correct theme for the app!
    ThemeHelperService.updateTheme(this);
}
 
开发者ID:M4lik,项目名称:burning-series,代码行数:21,代码来源:ApplicationClass.java

示例8: onCreate

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
@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.onCreate();
}
 
开发者ID:aricneto,项目名称:TwistyTimer,代码行数:25,代码来源:TwistyTimer.java

示例9: onCreate

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    context = this;

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

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

    // 友盟设置调试模式
    MobclickAgent.setDebugMode(BuildConfig.DEBUG);
}
 
开发者ID:tomoya92,项目名称:pybbsMD,代码行数:17,代码来源:AppController.java

示例10: onCreate

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    if (BuildConfig.CRASHLYTICS_ENABLED) {
        Fabric.with(this, new Crashlytics());
    }

    JodaTimeAndroid.init(this);

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    if (null == preferences.getString(PreferenceKeys.KEY_APP_ID, null)) {
        String id = Base62.encode(TimeBasedRandomGenerator.generate());

        SharedPreferences.Editor editor = preferences.edit();
        editor.putString(PreferenceKeys.KEY_APP_ID, id);
        editor.apply();
    }

    DailyReminderServiceHelper.setup(this, preferences);
    DriveBackupServiceHelper.setup(this);
}
 
开发者ID:canyapan,项目名称:DietDiaryApp,代码行数:23,代码来源:Application.java

示例11: onCreate

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    JodaTimeAndroid.init(this);

    Funs.getInstance().setContext(getApplicationContext());
    
    setContentView(R.layout.activity_main);

    FunsPageAdapter adapter = new FunsPageAdapter();

    ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
    viewPager.setAdapter(adapter);
    viewPager.setCurrentItem(Funs.getInstance().getViewPagerCurrentItem());

    RecyclerTabLayout recyclerTabLayout = (RecyclerTabLayout)
            findViewById(R.id.recycler_tab_layout);
    recyclerTabLayout.setUpWithViewPager(viewPager);
}
 
开发者ID:sib-401-o-2,项目名称:FUNS_old,代码行数:20,代码来源:MainActivity.java

示例12: initResources

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
/**
 * Initializes all the resources for the application with Application Context.
 */
public void initResources() {

    // initialize the ApiRequestHandler to get access token.
    mApiRequestHandler = new ApiRequestHandler(mBus, this);

    mUserRequestHandler = new UserRequestHandler(mBus, this);
    mBus.register(mUserRequestHandler);

    mActivityRequestHandler = new ActivityRequestHandler(mBus, this);
    mBus.register(mActivityRequestHandler);

    mObservationRequestHandler = new ObservationRequestHandler(mBus, this);
    mBus.register(mObservationRequestHandler);

    mLocationRequestHandler = new LocationRequestHandler(mBus, this);
    mBus.register(mLocationRequestHandler);

    mTickRequestHandler = new TickRequestHandler(mBus, this);
    mBus.register(mTickRequestHandler);

    mFileUploadHandler = new FileUploadHandler(mBus, this);
    mBus.register(mFileUploadHandler);

    JodaTimeAndroid.init(this);
}
 
开发者ID:pmk2429,项目名称:investickation,代码行数:29,代码来源:InvestickationApp.java

示例13: onCreate

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    // Initalize JodaTime
    JodaTimeAndroid.init(this);

    // Get the RetrofitRestadapter reference
    mGithubApiClient = new GithubApiClient();

    // Initialize a MyDataStore to handle SharedPreferences
    mMyDataStore = new DatastoreBuilder(PreferenceManager.getDefaultSharedPreferences(this))
            .create(MyDataStore.class);

    // Check if it is the first time the application runs
    if (mMyDataStore.isFirstRun().get(true)) {
        onFirstRun();
    }
}
 
开发者ID:mmazzarolo,项目名称:top-github,代码行数:20,代码来源:MainApplication.java

示例14: onCreate

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
@Override public void onCreate() {
    super.onCreate();

    instance = this;

    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/lato/Lato-Light.ttf")
            .setFontAttrId(R.attr.fontPath)
            .build()
    );

    JodaTimeAndroid.init(this);

    // init the user from shared prefs
    Cache.INSTANCE.readFromSharedPrefs(this);

    // Obtain the FirebaseAnalytics instance.
    FirebaseAnalytics.getInstance(this).logEvent(FirebaseAnalytics.Event.APP_OPEN, null);
}
 
开发者ID:SpartaHack,项目名称:SpartaHack-Android,代码行数:20,代码来源:MyApplication.java

示例15: onCreate

import net.danlew.android.joda.JodaTimeAndroid; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    USER_AGENT = getString(R.string.user_agent);
    APPLICATION_ID = getString(R.string.receiver_application_id);

    JodaTimeAndroid.init(this);
    DateTimeZone.setDefault(DateTimeZone.forTimeZone(TimeZone.getDefault()));

    CookieManager cookieManager = new CookieManager();
    CookieHandler.setDefault(cookieManager);

    PreferenceManager.setDefaultValues(this, R.xml.preference_login, false);

    initializeVideoCastManager(getApplicationContext());
}
 
开发者ID:lukasniemeier,项目名称:gcls,代码行数:18,代码来源:CoreApplication.java


注:本文中的net.danlew.android.joda.JodaTimeAndroid.init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。