本文整理匯總了Java中com.yolanda.nohttp.download.DownloadRequest類的典型用法代碼示例。如果您正苦於以下問題:Java DownloadRequest類的具體用法?Java DownloadRequest怎麽用?Java DownloadRequest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DownloadRequest類屬於com.yolanda.nohttp.download包,在下文中一共展示了DownloadRequest類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: download
import com.yolanda.nohttp.download.DownloadRequest; //導入依賴的package包/類
/**
* 開始下載全部。
*/
private void download(SchoolGymCourseCombinationDetail schoolGymCourseCombinationDetail) {
mDownloadRequests = new ArrayList<>();
mFileList = new ArrayList<>();
for (int x = 0; x < schoolGymCourseCombinationDetail.courses.size(); x++) {
Courses l = schoolGymCourseCombinationDetail.courses.get(x);
DownloadRequest downloadRequest = NoHttp.createDownloadRequest(getReleaUrl(l.gym_video_url), FileUtil.getDownloadDir(context), getFileName(l.gym_video_url), true, true);
mDownloadRequests.add(downloadRequest);
mFileList.add(new LoadFile(l.name, 0));
if (l.app_cartoon_lesson.download_images_url != null && !"".equals(l.app_cartoon_lesson.download_images_url)) {
DownloadRequest lesson = NoHttp.createDownloadRequest(getReleaUrl(l.app_cartoon_lesson.download_images_url), FileUtil.getDownloadDir(context), getFileName(l.app_cartoon_lesson.download_images_url), true, true);
mDownloadRequests.add(lesson);
mFileList.add(new LoadFile(l.app_cartoon_lesson.name, 0));
}
}
x = 0;
for (int i = 0; i < mDownloadRequests.size(); i++) {
CallServer.getDownloadInstance().add(i, mDownloadRequests.get(i), listDownloadListener);
}
}
示例2: download
import com.yolanda.nohttp.download.DownloadRequest; //導入依賴的package包/類
/**
* 開始下載全部。
*/
private void download(SchoolGymCourseCombinationDetail schoolGymCourseCombinationDetail) {
Log.d("onFinish",id);
mDownloadRequests = new ArrayList<>();
mFileList = new ArrayList<>();
for (int x = 0; x < schoolGymCourseCombinationDetail.courses.size(); x++) {
Courses l = schoolGymCourseCombinationDetail.courses.get(x);
// 創建四個下載請求並且保存起來。
// Log.d("onFinish","===============================================");
// Log.d("onFinish",getReleaUrl(l.gym_video_url));
// Log.d("onFinish",FileUtil.getDownloadDir(context));
// Log.d("onFinish",getFileName(l.gym_video_url));
// Log.d("onFinish",l.name);
// Log.d("onFinish","===============================================");
DownloadRequest downloadRequest = NoHttp.createDownloadRequest(getReleaUrl(l.gym_video_url), FileUtil.getDownloadDir(context), getFileName(l.gym_video_url), true, true);
mDownloadRequests.add(downloadRequest);
mFileList.add(new LoadFile(l.name, 0));
if(l.app_cartoon_lesson.download_images_url != null && !"".equals(l.app_cartoon_lesson.download_images_url)){
DownloadRequest lesson = NoHttp.createDownloadRequest(getReleaUrl(l.app_cartoon_lesson.download_images_url), FileUtil.getDownloadDir(context), getFileName(l.app_cartoon_lesson.download_images_url), true, true);
mDownloadRequests.add(lesson);
mFileList.add(new LoadFile(l.app_cartoon_lesson.name, 0));
// Log.d("onFinish","===============================================");
// Log.d("onFinish",getReleaUrl(l.app_cartoon_lesson.download_images_url));
// Log.d("onFinish",FileUtil.getDownloadDir(context));
// Log.d("onFinish",getFileName(l.app_cartoon_lesson.download_images_url));
// Log.d("onFinish",l.app_cartoon_lesson.name);
// Log.d("onFinish","===============================================");
}
}
showListDownDialog();
x = 0;
for (int i = 0; i < mDownloadRequests.size(); i++) {
CallServer.getDownloadInstance().add(i, mDownloadRequests.get(i), listDownloadListener);
}
}
示例3: showListDownDialog
import com.yolanda.nohttp.download.DownloadRequest; //導入依賴的package包/類
private void showListDownDialog() {
listDownDialog = new DownListDialog(context, R.style.transparentFrameWindowStyle, mFileList);
listDownDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
for (DownloadRequest downloadRequest : mDownloadRequests) {
downloadRequest.cancel();
}
}
});
listDownDialog.setCanceledOnTouchOutside(false);// 設置點擊屏幕Dialog不消失
listDownDialog.show();
dimActivity(listDownDialog, 0.6f);
}
示例4: showListDownDialog
import com.yolanda.nohttp.download.DownloadRequest; //導入依賴的package包/類
private void showListDownDialog() {
listDownDialog = new DownListDialog(getThis(), R.style.transparentFrameWindowStyle, mFileList);
listDownDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
for (DownloadRequest downloadRequest : mDownloadRequests) {
downloadRequest.cancel();
}
}
});
listDownDialog.setCanceledOnTouchOutside(false);// 設置點擊屏幕Dialog不消失
listDownDialog.show();
dimActivity(listDownDialog, 0.6f);
}
示例5: onStartCommand
import com.yolanda.nohttp.download.DownloadRequest; //導入依賴的package包/類
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null) {
url = intent.getStringExtra("url");
if (url != null && !TextUtils.isEmpty(url)) {
FileUtil.initDirectory(SAVE_URL);//如果沒有的話需要創建文件夾
DownloadQueue downloadQueue = NoHttp.newDownloadQueue(2);
DownloadRequest downloadRequest = NoHttp.createDownloadRequest(url, SAVE_URL, fileName, true, true);
downloadQueue.add(0, downloadRequest, downloadListener);
} else {
ToastUtil.show(this, "下載地址錯誤");
}
}
return super.onStartCommand(intent, flags, startId);
}
示例6: downLoadKnowledge
import com.yolanda.nohttp.download.DownloadRequest; //導入依賴的package包/類
@OnClick(R.id.tv_down)
void downLoadKnowledge() {
DownloadRequest mMDownloadRequest = NoHttp.createDownloadRequest(resourceUrl, SAVE_URL, "knowledge.json", true, true);
DownloadQueue mDownloadQueue = NoHttp.newDownloadQueue();
mDownloadQueue.add(0, mMDownloadRequest, downloadListener);
}