本文整理汇总了Java中org.wlf.filedownloader.DownloadFileInfo类的典型用法代码示例。如果您正苦于以下问题:Java DownloadFileInfo类的具体用法?Java DownloadFileInfo怎么用?Java DownloadFileInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DownloadFileInfo类属于org.wlf.filedownloader包,在下文中一共展示了DownloadFileInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beginDownloads
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
private void beginDownloads(int currentDownloadIndex, List<String> urls) {
try {
FileDownloader.delete(urls.get(currentDownloadIndex), true, new OnDeleteDownloadFileListener() {
@Override
public void onDeleteDownloadFilePrepared(DownloadFileInfo downloadFileNeedDelete) {
}
@Override
public void onDeleteDownloadFileSuccess(DownloadFileInfo downloadFileDeleted) {
FileDownloader.start(urls.get(currentDownloadIndex));
}
@Override
public void onDeleteDownloadFileFailed(DownloadFileInfo downloadFileInfo, DeleteDownloadFileFailReason failReason) {
if (DeleteDownloadFileFailReason.TYPE_FILE_RECORD_IS_NOT_EXIST.equals(failReason.getType())) {
FileDownloader.start(urls.get(currentDownloadIndex));
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: addNewDownloadFileInfo
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
/**
* add new download file info
*/
public boolean addNewDownloadFileInfo(DownloadFileInfo downloadFileInfo) {
if (downloadFileInfo != null) {
if (!mDownloadFileInfos.contains(downloadFileInfo)) {
boolean isFind = false;
for (DownloadFileInfo info : mDownloadFileInfos) {
if (info != null && info.getUrl().equals(downloadFileInfo.getUrl())) {
isFind = true;
break;
}
}
if (isFind) {
return false;
}
mDownloadFileInfos.add(downloadFileInfo);
notifyDataSetChanged();
return true;
}
}
return false;
}
示例3: notifySuccess
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
/**
* notifySuccess
*/
private void notifySuccess(DownloadFileInfo downloadFileInfo) {
if (mIsNotifyFinish.get()) {
return;
}
if (mIsNotifyFinish.compareAndSet(false, true)) {
if (mOnDeleteDownloadFileListener != null) {
if (mIsSyncCallback) {
mOnDeleteDownloadFileListener.onDeleteDownloadFileSuccess(downloadFileInfo);
} else {
OnDeleteDownloadFileListener.MainThreadHelper.onDeleteDownloadFileSuccess(downloadFileInfo,
mOnDeleteDownloadFileListener);
}
}
}
}
示例4: onFileDownloadStatusPreparing
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
@Override
public void onFileDownloadStatusPreparing(DownloadFileInfo downloadFileInfo) {
if (downloadFileInfo == null) {
return;
}
String url = downloadFileInfo.getUrl();
View cacheConvertView = mConvertViews.get(url);
if (cacheConvertView != null) {
TextView tvText = (TextView) cacheConvertView.findViewById(R.id.tvText);
tvText.setText(cacheConvertView.getContext().getString(R.string.main__getting_resource));
Log.d(TAG, "onFileDownloadStatusPreparing url:" + url + ",status(正常应该是" + Status
.DOWNLOAD_STATUS_PREPARING + "):" + downloadFileInfo.getStatus());
} else {
updateShow();
}
}
示例5: onFileDownloadStatusPrepared
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
@Override
public void onFileDownloadStatusPrepared(DownloadFileInfo downloadFileInfo) {
if (downloadFileInfo == null) {
return;
}
String url = downloadFileInfo.getUrl();
View cacheConvertView = mConvertViews.get(url);
if (cacheConvertView != null) {
TextView tvText = (TextView) cacheConvertView.findViewById(R.id.tvText);
tvText.setText(cacheConvertView.getContext().getString(R.string.main__connected_resource));
Log.d(TAG, "onFileDownloadStatusPrepared url:" + url + ",status(正常应该是" + Status.DOWNLOAD_STATUS_PREPARED
+ "):" + downloadFileInfo.getStatus());
} else {
updateShow();
}
}
示例6: onFileDownloadStatusPaused
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
@Override
public void onFileDownloadStatusPaused(DownloadFileInfo downloadFileInfo) {
if (downloadFileInfo == null) {
return;
}
String url = downloadFileInfo.getUrl();
Log.d(TAG, "onFileDownloadStatusPaused url:" + url + ",status(正常应该是" + Status.DOWNLOAD_STATUS_PAUSED + "):" +
downloadFileInfo.getStatus());
View cacheConvertView = mConvertViews.get(url);
if (cacheConvertView != null) {
LinearLayout lnlyDownloadItem = (LinearLayout) cacheConvertView.findViewById(R.id.lnlyDownloadItem);
TextView tvText = (TextView) cacheConvertView.findViewById(R.id.tvText);
tvText.setText(cacheConvertView.getContext().getString(R.string.main__paused));
setBackgroundOnClickListener(lnlyDownloadItem, downloadFileInfo);
} else {
updateShow();
}
}
示例7: onDeleteDownloadFileFailed
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
/**
* delete failed
*
* @param downloadFileInfo download file needed to delete,may be null
* @param failReason fail reason
*/
public static void onDeleteDownloadFileFailed(final DownloadFileInfo downloadFileInfo, final
DeleteDownloadFileFailReason failReason, final OnDeleteDownloadFileListener onDeleteDownloadFileListener) {
if (onDeleteDownloadFileListener == null) {
return;
}
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
if (onDeleteDownloadFileListener == null) {
return;
}
onDeleteDownloadFileListener.onDeleteDownloadFileFailed(downloadFileInfo, failReason);
}
});
}
示例8: onFileDownloadStatusPrepared
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
@Override
public void onFileDownloadStatusPrepared(DownloadFileInfo downloadFileInfo) {
// if cur task stopped,stop internal impl, wait notifyTaskFinish()
if (mIsTaskStop) {
// stop internal impl
stopInternalImpl();
// wait for the task run method finished, notifyTaskFinish()
return;
}
if (mOnFileDownloadStatusListener != null) {
mOnFileDownloadStatusListener.onFileDownloadStatusPrepared(downloadFileInfo);
}
if (DownloadFileUtil.isLegal(downloadFileInfo)) {
// record download range
mRecordedRange = new Range(downloadFileInfo.getDownloadedSizeLong(), mRecordedRange.endPos);
}
}
示例9: findPosition
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
private int findPosition(DownloadFileInfo downloadFileInfo) {
if (downloadFileInfo == null) {
return -1;
}
for (int i = 0; i < mCoursePreviewInfos.size(); i++) {
CoursePreviewInfo coursePreviewInfo = mCoursePreviewInfos.get(i);
if (coursePreviewInfo == null || TextUtils.isEmpty(coursePreviewInfo.getCourseUrl())) {
continue;
}
if (coursePreviewInfo.getCourseUrl().equals(downloadFileInfo.getUrl())) {
// find
return i;
}
}
return -1;
}
示例10: onMoveDownloadFilePrepared
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
/**
* prepared move
*
* @param downloadFileNeedToMove download file needed to move
*/
public static void onMoveDownloadFilePrepared(final DownloadFileInfo downloadFileNeedToMove, final
OnMoveDownloadFileListener onMoveDownloadFileListener) {
if (onMoveDownloadFileListener == null) {
return;
}
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
if (onMoveDownloadFileListener == null) {
return;
}
onMoveDownloadFileListener.onMoveDownloadFilePrepared(downloadFileNeedToMove);
}
});
}
示例11: onMoveDownloadFileSuccess
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
/**
* move succeed
*
* @param downloadFileMoved download file moved
*/
public static void onMoveDownloadFileSuccess(final DownloadFileInfo downloadFileMoved, final
OnMoveDownloadFileListener onMoveDownloadFileListener) {
if (onMoveDownloadFileListener == null) {
return;
}
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
if (onMoveDownloadFileListener == null) {
return;
}
onMoveDownloadFileListener.onMoveDownloadFileSuccess(downloadFileMoved);
}
});
}
示例12: onMoveDownloadFileFailed
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
/**
* move failed
*
* @param downloadFileInfo download file needed to move,may be null
* @param failReason fail reason
*/
public static void onMoveDownloadFileFailed(final DownloadFileInfo downloadFileInfo, final
MoveDownloadFileFailReason failReason, final OnMoveDownloadFileListener onMoveDownloadFileListener) {
if (onMoveDownloadFileListener == null) {
return;
}
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
if (onMoveDownloadFileListener == null) {
return;
}
onMoveDownloadFileListener.onMoveDownloadFileFailed(downloadFileInfo, failReason);
}
});
}
示例13: notifyFailed
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
/**
* notifyFailed
*/
private void notifyFailed(DownloadFileInfo downloadFileInfo, MoveDownloadFileFailReason failReason) {
if (mIsNotifyFinish.get()) {
return;
}
if (mIsNotifyFinish.compareAndSet(false, true)) {
if (mOnMoveDownloadFileListener != null) {
if (mIsSyncCallback) {
mOnMoveDownloadFileListener.onMoveDownloadFileFailed(downloadFileInfo, failReason);
} else {
OnMoveDownloadFileListener.MainThreadHelper.onMoveDownloadFileFailed(downloadFileInfo,
failReason, mOnMoveDownloadFileListener);
}
}
}
}
示例14: onRenameDownloadFileSuccess
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
/**
* rename succeed
*
* @param downloadFileRenamed download files renamed
*/
public static void onRenameDownloadFileSuccess(final DownloadFileInfo downloadFileRenamed, final
OnRenameDownloadFileListener onRenameDownloadFileListener) {
if (onRenameDownloadFileListener == null) {
return;
}
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
if (onRenameDownloadFileListener == null) {
return;
}
onRenameDownloadFileListener.onRenameDownloadFileSuccess(downloadFileRenamed);
}
});
}
示例15: onRenameDownloadFileFailed
import org.wlf.filedownloader.DownloadFileInfo; //导入依赖的package包/类
/**
* rename failed
*
* @param downloadFileInfo download files needed to rename
* @param failReason fail reason
*/
public static void onRenameDownloadFileFailed(final DownloadFileInfo downloadFileInfo, final
RenameDownloadFileFailReason failReason, final OnRenameDownloadFileListener onRenameDownloadFileListener) {
if (onRenameDownloadFileListener == null) {
return;
}
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
if (onRenameDownloadFileListener == null) {
return;
}
onRenameDownloadFileListener.onRenameDownloadFileFailed(downloadFileInfo, failReason);
}
});
}