本文整理汇总了Java中com.liulishuo.filedownloader.model.FileDownloadStatus类的典型用法代码示例。如果您正苦于以下问题:Java FileDownloadStatus类的具体用法?Java FileDownloadStatus怎么用?Java FileDownloadStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileDownloadStatus类属于com.liulishuo.filedownloader.model包,在下文中一共展示了FileDownloadStatus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateNotDownloaded
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
public void updateNotDownloaded(final int status, final long sofar, final long total) {
if (sofar > 0 && total > 0) {
final float percent = sofar
/ (float) total;
taskPb.setMax(100);
taskPb.setProgress((int) (percent * 100));
} else {
taskPb.setMax(1);
taskPb.setProgress(0);
}
switch (status) {
case FileDownloadStatus.error:
taskStatusTv.setText(R.string.tasks_manager_demo_status_error);
break;
case FileDownloadStatus.paused:
taskStatusTv.setText(R.string.tasks_manager_demo_status_paused);
break;
default:
taskStatusTv.setText(R.string.tasks_manager_demo_status_not_downloaded);
break;
}
// taskActionBtn.setText(R.string.start);
}
开发者ID:popo1379,项目名称:popomusic,代码行数:25,代码来源:DownMusicAdapter.java
示例2: handleProgress
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
private void handleProgress(final long now,
final boolean isNeedCallbackToUser) {
if (model.getSoFar() == model.getTotal()) {
database.updateProgress(model.getId(), model.getSoFar());
return;
}
if (needSetProcess) {
needSetProcess = false;
model.setStatus(FileDownloadStatus.progress);
}
if (isNeedCallbackToUser) {
lastCallbackTimestamp = now;
onStatusChanged(FileDownloadStatus.progress);
callbackIncreaseBuffer.set(0);
}
}
开发者ID:angcyo,项目名称:RLibrary,代码行数:19,代码来源:DownloadStatusCallback.java
示例3: onProgress
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
void onProgress(long increaseBytes) {
callbackIncreaseBuffer.addAndGet(increaseBytes);
model.increaseSoFar(increaseBytes);
model.setStatus(FileDownloadStatus.progress);
final long now = SystemClock.elapsedRealtime();
final boolean isNeedCallbackToUser = isNeedCallbackToUser(now);
if (handler == null) {
// direct
handleProgress(now, isNeedCallbackToUser);
} else if (isNeedCallbackToUser) {
// flow
sendMessage(handler.obtainMessage(FileDownloadStatus.progress));
}
}
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:20,代码来源:DownloadStatusCallback.java
示例4: getReceiveServiceTaskList
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
List<BaseDownloadTask.IRunningTask> getReceiveServiceTaskList(final int id){
final List<BaseDownloadTask.IRunningTask> list = new ArrayList<>();
synchronized (this.mList) {
for (BaseDownloadTask.IRunningTask task : this.mList) {
if (task.is(id) && !task.isOver()) {
final byte status = task.getOrigin().getStatus();
if (status != FileDownloadStatus.INVALID_STATUS &&
status != FileDownloadStatus.toLaunchPool) {
list.add(task);
}
}
}
}
return list;
}
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:19,代码来源:FileDownloadList.java
示例5: onStatusChanged
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
private void onStatusChanged(final byte status) {
// In current situation, it maybe invoke this method simultaneously between #onPause() and
// others.
if (status == FileDownloadStatus.paused) {
if (FileDownloadLog.NEED_LOG) {
/**
* Already paused or the current status is paused.
*
* We don't need to call-back to Task in here, because the pause status has
* already handled by {@link BaseDownloadTask#pause()} manually.
*
* In some case, it will arrive here by High concurrent cause. For performance
* more make sense.
*
* High concurrent cause.
*/
FileDownloadLog.d(this, "High concurrent cause, Already paused and we don't " +
"need to call-back to Task in here, %d", model.getId());
}
return;
}
MessageSnapshotFlow.getImpl().inflow(
MessageSnapshotTaker.take(status, model, processParams));
}
开发者ID:angcyo,项目名称:RLibrary,代码行数:26,代码来源:DownloadStatusCallback.java
示例6: getStatus
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
/**
* @param id The downloadId.
* @param path The target file path.
* @return the downloading status.
* @see FileDownloadStatus
* @see #getStatus(String, String)
* @see #getStatusIgnoreCompleted(int)
*/
public byte getStatus(final int id, final String path) {
byte status;
BaseDownloadTask.IRunningTask task = FileDownloadList.getImpl().get(id);
if (task == null) {
status = FileDownloadServiceProxy.getImpl().getStatus(id);
} else {
status = task.getOrigin().getStatus();
}
if (path != null && status == FileDownloadStatus.INVALID_STATUS) {
if (FileDownloadUtils.isFilenameConverted(FileDownloadHelper.getAppContext()) &&
new File(path).exists()) {
status = FileDownloadStatus.completed;
}
}
return status;
}
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:27,代码来源:FileDownloader.java
示例7: handleError
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
private void handleError(Exception exception) {
Exception errProcessEx = exFiltrate(exception);
if (errProcessEx instanceof SQLiteFullException) {
// If the error is sqLite full exception already, no need to update it to the database
// again.
handleSQLiteFullException((SQLiteFullException) errProcessEx);
} else {
// Normal case.
try {
model.setStatus(FileDownloadStatus.error);
model.setErrMsg(exception.toString());
database.updateError(model.getId(), errProcessEx, model.getSoFar());
} catch (SQLiteFullException fullException) {
errProcessEx = fullException;
handleSQLiteFullException((SQLiteFullException) errProcessEx);
}
}
processParams.setException(errProcessEx);
onStatusChanged(FileDownloadStatus.error);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:DownloadStatusCallback.java
示例8: sendCompletedBroadcast
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
public static void sendCompletedBroadcast(FileDownloadModel model) {
if (model == null) throw new IllegalArgumentException();
if (model.getStatus() != FileDownloadStatus.completed) throw new IllegalStateException();
final Intent intent = new Intent(ACTION_COMPLETED);
intent.putExtra(KEY_MODEL, model);
FileDownloadHelper.getAppContext().sendBroadcast(intent);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:FileDownloadBroadcastHandler.java
示例9: onConnected
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
void onConnected(boolean isResume, long totalLength, String etag, String fileName) throws IllegalArgumentException {
final String oldEtag = model.getETag();
if (oldEtag != null && !oldEtag.equals(etag)) throw
new IllegalArgumentException(FileDownloadUtils.formatString("callback " +
"onConnected must with precondition succeed, but the etag is changes(%s != %s)",
etag, oldEtag));
// direct
processParams.setResuming(isResume);
model.setStatus(FileDownloadStatus.connected);
model.setTotal(totalLength);
model.setETag(etag);
model.setFilename(fileName);
database.updateConnected(model.getId(), totalLength, etag, fileName);
onStatusChanged(FileDownloadStatus.connected);
callbackMinIntervalBytes = calculateCallbackMinIntervalBytes(totalLength, callbackProgressMaxCount);
}
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:21,代码来源:DownloadStatusCallback.java
示例10: reset
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
@Override
public void reset() {
mThrowable = null;
mEtag = null;
mIsResuming = false;
mRetryingTimes = 0;
mIsReusedOldFile = false;
mIsLargeFile = false;
mSoFarBytes = 0;
mTotalBytes = 0;
mSpeedMonitor.reset();
if (FileDownloadStatus.isOver(mStatus)) {
mMessenger.discard();
mMessenger = new FileDownloadMessenger(mTask.getRunningTask(), this);
} else {
mMessenger.reAppointment(mTask.getRunningTask(), this);
}
mStatus = FileDownloadStatus.INVALID_STATUS;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:DownloadTaskHunter.java
示例11: onStatusChanged
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
private void onStatusChanged(final byte status) {
// In current situation, it maybe invoke this method simultaneously between #onPause() and
// others.
if (model.getStatus() == FileDownloadStatus.paused) {
if (FileDownloadLog.NEED_LOG) {
/**
* Already paused or the current status is paused.
*
* We don't need to call-back to Task in here, because the pause status has
* already handled by {@link BaseDownloadTask#pause()} manually.
*
* In some case, it will arrive here by High concurrent cause. For performance
* more make sense.
*
* High concurrent cause.
*/
FileDownloadLog.d(this, "High concurrent cause, Already paused and we don't " +
"need to call-back to Task in here, %d", model.getId());
}
return;
}
MessageSnapshotFlow.getImpl().inflow(MessageSnapshotTaker.take(status, model, processParams));
}
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:25,代码来源:DownloadStatusCallback.java
示例12: onProgress
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
void onProgress(long increaseBytes) {
callbackIncreaseBuffer.addAndGet(increaseBytes);
model.increaseSoFar(increaseBytes);
final long now = SystemClock.elapsedRealtime();
final boolean isNeedCallbackToUser = isNeedCallbackToUser(now);
if (handler == null) {
// direct
handleProgress(now, isNeedCallbackToUser);
} else if (isNeedCallbackToUser) {
// flow
sendMessage(handler.obtainMessage(FileDownloadStatus.progress));
}
}
开发者ID:angcyo,项目名称:RLibrary,代码行数:18,代码来源:DownloadStatusCallback.java
示例13: updateNotDownloaded
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
public void updateNotDownloaded(final int status, final long sofar, final long total) {
if (sofar > 0 && total > 0) {
final float percent = sofar
/ (float) total;
taskPb.setMax(100);
taskPb.setProgress((int) (percent * 100));
} else {
taskPb.setMax(1);
taskPb.setProgress(0);
}
switch (status) {
case FileDownloadStatus.error:
taskStatusTv.setText(R.string.tasks_manager_demo_status_error);
break;
case FileDownloadStatus.paused:
taskStatusTv.setText(R.string.tasks_manager_demo_status_paused);
break;
default:
taskStatusTv.setText(R.string.tasks_manager_demo_status_not_downloaded);
break;
}
taskActionBtn.setText(R.string.start);
}
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:25,代码来源:TaskItemViewHolder.java
示例14: onConnected
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
void onConnected(boolean isResume, long totalLength, String etag, String fileName) throws
IllegalArgumentException {
final String oldEtag = model.getETag();
if (oldEtag != null && !oldEtag.equals(etag)) throw
new IllegalArgumentException(FileDownloadUtils.formatString("callback " +
"onConnected must with precondition succeed, but the etag is changes(%s != %s)",
etag, oldEtag));
// direct
processParams.setResuming(isResume);
model.setStatus(FileDownloadStatus.connected);
model.setTotal(totalLength);
model.setETag(etag);
model.setFilename(fileName);
database.updateConnected(model.getId(), totalLength, etag, fileName);
onStatusChanged(FileDownloadStatus.connected);
callbackMinIntervalBytes = calculateCallbackMinIntervalBytes(totalLength,
callbackProgressMaxCount);
needSetProcess = true;
}
开发者ID:angcyo,项目名称:RLibrary,代码行数:24,代码来源:DownloadStatusCallback.java
示例15: updateDownloading
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
public void updateDownloading(final int status, final long sofar, final long total) {
final float percent = sofar
/ (float) total;
taskPb.setMax(100);
taskPb.setProgress((int) (percent * 100));
switch (status) {
case FileDownloadStatus.pending:
taskStatusTv.setText(R.string.tasks_manager_demo_status_pending);
break;
case FileDownloadStatus.started:
taskStatusTv.setText(R.string.tasks_manager_demo_status_started);
break;
case FileDownloadStatus.connected:
taskStatusTv.setText(R.string.tasks_manager_demo_status_connected);
break;
case FileDownloadStatus.progress:
taskStatusTv.setText(R.string.tasks_manager_demo_status_progress);
break;
default:
// taskStatusTv.setText(MyApplication.CONTEXT.getString(
// R.string.tasks_manager_demo_status_downloading, status));
break;
}
// taskActionBtn.setText(R.string.pause);
}
开发者ID:popo1379,项目名称:popomusic,代码行数:28,代码来源:DownMusicAdapter.java
示例16: updateError
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
@Override
public void updateError(int id, Throwable throwable, long sofar) {
ContentValues cv = new ContentValues();
cv.put(FileDownloadModel.ERR_MSG, throwable.toString());
cv.put(FileDownloadModel.STATUS, FileDownloadStatus.error);
cv.put(FileDownloadModel.SOFAR, sofar);
update(id, cv);
}
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:10,代码来源:DefaultDatabaseImpl.java
示例17: getStatus
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
@Override
public byte getStatus(final int id) {
if (!isConnected()) {
return DownloadServiceNotConnectedHelper.getStatus(id);
}
byte status = FileDownloadStatus.INVALID_STATUS;
try {
status = getService().getStatus(id);
} catch (RemoteException e) {
e.printStackTrace();
}
return status;
}
开发者ID:angcyo,项目名称:RLibrary,代码行数:16,代码来源:FileDownloadServiceUIGuard.java
示例18: onPaused
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
void onPaused() {
if (handler == null) {
// direct
handlePaused();
} else {
// flow
sendMessage(handler.obtainMessage(FileDownloadStatus.paused));
}
}
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:10,代码来源:DownloadStatusCallback.java
示例19: progress
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
@Override
protected void progress(BaseDownloadTask task, int soFarBytes, int totalBytes) {
super.progress(task, soFarBytes, totalBytes);
final TaskItemViewHolder tag = checkCurrentHolder(task);
if (tag == null) {
return;
}
tag.updateDownloading(FileDownloadStatus.progress, soFarBytes
, totalBytes);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:TasksManagerDemoActivity.java
示例20: updateSameFilePathTaskRunning
import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入依赖的package包/类
@Override
public boolean updateSameFilePathTaskRunning(MessageSnapshot snapshot) {
if (!mTask.getRunningTask().getOrigin().isPathAsDirectory()) {
return false;
}
if (snapshot.getStatus() != FileDownloadStatus.warn ||
getStatus() != FileDownloadStatus.connected) {
return false;
}
update(snapshot);
return true;
}
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:15,代码来源:DownloadTaskHunter.java
注:本文中的com.liulishuo.filedownloader.model.FileDownloadStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论