本文整理汇总了Java中org.wlf.filedownloader.DownloadFileInfo.getStatus方法的典型用法代码示例。如果您正苦于以下问题:Java DownloadFileInfo.getStatus方法的具体用法?Java DownloadFileInfo.getStatus怎么用?Java DownloadFileInfo.getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wlf.filedownloader.DownloadFileInfo
的用法示例。
在下文中一共展示了DownloadFileInfo.getStatus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isDownloadingStatus
import org.wlf.filedownloader.DownloadFileInfo; //导入方法依赖的package包/类
/**
* whether is downloading status
*
* @param downloadFileInfo download file
* @return true means the download is downloading
*/
public static boolean isDownloadingStatus(DownloadFileInfo downloadFileInfo) {
if (!DownloadFileUtil.isLegal(downloadFileInfo)) {
return false;
}
// only the status below is downloading
switch (downloadFileInfo.getStatus()) {
case Status.DOWNLOAD_STATUS_WAITING:
case Status.DOWNLOAD_STATUS_RETRYING:
case Status.DOWNLOAD_STATUS_PREPARING:
case Status.DOWNLOAD_STATUS_PREPARED:
case Status.DOWNLOAD_STATUS_DOWNLOADING:
return true;
}
return false;
}
示例2: onFileDownloadStatusFailed
import org.wlf.filedownloader.DownloadFileInfo; //导入方法依赖的package包/类
@Override
public void onFileDownloadStatusFailed(String url, DownloadFileInfo downloadFileInfo,
FileDownloadStatusFailReason failReason) {
if (DownloadFileUtil.isLegal(downloadFileInfo)) {
if (downloadFileInfo.getStatus() == Status.DOWNLOAD_STATUS_FILE_NOT_EXIST) {
// record the state and not notify caller, wait notifyTaskFinish()
mFinishState = new FinishState(Status.DOWNLOAD_STATUS_FILE_NOT_EXIST, failReason);
} else {
// record the state and not notify caller, wait notifyTaskFinish()
mFinishState = new FinishState(Status.DOWNLOAD_STATUS_ERROR, failReason);
}
// record download range
mRecordedRange = new Range(mRecordedRange.startPos, downloadFileInfo.getDownloadedSizeLong());
}
}
示例3: isCompleted
import org.wlf.filedownloader.DownloadFileInfo; //导入方法依赖的package包/类
/**
* whether the download file is completed
*
* @param downloadFileInfo download file
* @return true means is completed
*/
public static boolean isCompleted(DownloadFileInfo downloadFileInfo) {
if (!DownloadFileUtil.isLegal(downloadFileInfo)) {
return false;
}
switch (downloadFileInfo.getStatus()) {
case Status.DOWNLOAD_STATUS_COMPLETED:
return true;
}
return false;
}
示例4: onFileDownloadStatusCompleted
import org.wlf.filedownloader.DownloadFileInfo; //导入方法依赖的package包/类
@Override
public void onFileDownloadStatusCompleted(DownloadFileInfo downloadFileInfo) {
if (downloadFileInfo == null) {
return;
}
String url = downloadFileInfo.getUrl();
View cacheConvertView = mConvertViews.get(url);
if (cacheConvertView != null) {
LinearLayout lnlyDownloadItem = (LinearLayout) cacheConvertView.findViewById(R.id.lnlyDownloadItem);
TextView tvDownloadSize = (TextView) cacheConvertView.findViewById(R.id.tvDownloadSize);
TextView tvPercent = (TextView) cacheConvertView.findViewById(R.id.tvPercent);
TextView tvText = (TextView) cacheConvertView.findViewById(R.id.tvText);
tvDownloadSize.setText("");
// download percent
float percent = 1;
tvPercent.setText(((float) (Math.round(percent * 100)) / 100 * 100) + "%");
if (downloadFileInfo.getStatus() == Status.DOWNLOAD_STATUS_COMPLETED) {
if ("apk".equalsIgnoreCase(FileUtil.getFileSuffix(downloadFileInfo.getFileName()))) {// apk
String packageName = ApkUtil.getUnInstallApkPackageName(mActivity, downloadFileInfo.getFilePath());
boolean isInstall = ApkUtil.checkAppInstalled(mActivity, packageName);
if (isInstall) {
tvText.setText(cacheConvertView.getContext().getString(R.string.main__open));
} else {
tvText.setText(cacheConvertView.getContext().getString(R.string.main__not_install));
}
} else {
tvText.setText(cacheConvertView.getContext().getString(R.string.main__download_completed));
}
}
setBackgroundOnClickListener(lnlyDownloadItem, downloadFileInfo);
} else {
updateShow();
}
Log.d(TAG, "onFileDownloadStatusCompleted url:" + url + ",status(正常应该是" + Status.DOWNLOAD_STATUS_COMPLETED +
"):" + downloadFileInfo.getStatus());
}