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


Java PersistableBundleCompat.getBoolean方法代码示例

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


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

示例1: onRunJob

import com.evernote.android.job.util.support.PersistableBundleCompat; //导入方法依赖的package包/类
@NonNull
@Override
protected Result onRunJob(Params params) {

    EventBus.getDefault()
            .postSticky(new SyncStateChangedEvent(true));

    PersistableBundleCompat extras = params.getExtras();

    String startDate = extras.getString(ARG_START_DATE, null);
    String endDate = extras.getString(ARG_END_DATE, null);
    boolean initByUser = extras.getBoolean(ARG_INITIATED_BY_USER, false);


    NSDictionary plist = callPlist(startDate, endDate);

    if (plist == null) {
        if (initByUser) {
            EventBus.getDefault().post(new SyncErrorEvent(getContext().getString(R.string.sync_job_plist_empty)));
            return endJob(Result.SUCCESS);
        } else {
            return endJob(Result.RESCHEDULE);
        }
    } else {
        if (!initByUser) autoDeleteTask();
        handlePlist(plist);
    }

    if (startDate == null && endDate == null) {
        downloadLatestRessource();
    }

    cleanUpResources();


    if (moveToPaperAtEnd != null) {
        EventBus.getDefault()
                .post(new ScrollToPaperEvent(moveToPaperAtEnd.getId()));
        moveToPaperAtEnd = null;
    }

    Paper latestPaper = Paper.getLatestPaper(getContext());
    if (latestPaper != null) AutoDownloadJob.scheduleJob(latestPaper);

    return endJob(Result.SUCCESS);
}
 
开发者ID:die-tageszeitung,项目名称:tazapp-android,代码行数:47,代码来源:SyncJob.java

示例2: onRunJob

import com.evernote.android.job.util.support.PersistableBundleCompat; //导入方法依赖的package包/类
@NonNull
@Override
protected final Result onRunJob(@NonNull Params params) {
    PersistableBundleCompat extras = params.getExtras();
    boolean runOnce = extras.getBoolean(EXTRA_ONCE, false);

    if (!runOnce && (!extras.containsKey(EXTRA_START_MS) || !extras.containsKey(EXTRA_END_MS))) {
        CAT.e("Daily job doesn't contain start and end time");
        return Result.FAILURE;
    }

    DailyJobResult result = null;

    try {
        if (meetsRequirements()) {
            result = onRunDailyJob(params);
        } else {
            result = DailyJobResult.SUCCESS; // reschedule
            CAT.i("Daily job requirements not met, reschedule for the next day");
        }

    } finally {
        if (result == null) {
            // shouldn't happen if the job follows the contract
            result = DailyJobResult.SUCCESS;
            CAT.e("Daily job result was null");
        }

        if (!runOnce) {
            JobRequest request = params.getRequest();
            if (result == DailyJobResult.SUCCESS) {
                CAT.i("Rescheduling daily job %s", request);

                // don't update current, it would cancel this currently running job
                int newJobId = schedule(request.createBuilder(), false,
                        extras.getLong(EXTRA_START_MS, 0) % DAY, extras.getLong(EXTRA_END_MS, 0L) % DAY);

                request = JobManager.instance().getJobRequest(newJobId);
                if (request != null) {
                    request.updateStats(false, true);
                }

            } else {
                CAT.i("Cancel daily job %s", request);
            }
        }
    }

    return Result.SUCCESS;
}
 
开发者ID:evernote,项目名称:android-job,代码行数:51,代码来源:DailyJob.java


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