本文整理汇总了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);
}
示例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;
}