parent
1c8f808c1c
commit
577b3d2546
@ -0,0 +1,64 @@ |
|||||||
|
/* |
||||||
|
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||||
|
* |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.arialyy.aria.core.command; |
||||||
|
|
||||||
|
import android.text.TextUtils; |
||||||
|
import android.util.Log; |
||||||
|
import com.arialyy.aria.core.download.DownloadEntity; |
||||||
|
import com.arialyy.aria.core.download.DownloadTaskEntity; |
||||||
|
import com.arialyy.aria.core.inf.ITaskEntity; |
||||||
|
import com.arialyy.aria.core.task.DownloadTask; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by lyy on 2016/9/20. |
||||||
|
* 停止命令 |
||||||
|
*/ |
||||||
|
class StopCmd<T extends ITaskEntity> extends IDownloadCmd<T> { |
||||||
|
|
||||||
|
StopCmd(String targetName, T entity) { |
||||||
|
super(targetName, entity); |
||||||
|
} |
||||||
|
|
||||||
|
@Override public void executeCmd() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
//StopCmd(DownloadTaskEntity entity) {
|
||||||
|
// super(entity);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//StopCmd(String targetName, DownloadTaskEntity entity) {
|
||||||
|
// super(targetName, entity);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//@Override public void executeCmd() {
|
||||||
|
// DownloadTask task = mQueue.getTask(mEntity.downloadEntity);
|
||||||
|
// if (task == null) {
|
||||||
|
// if (mEntity.downloadEntity.getState() == DownloadEntity.STATE_DOWNLOAD_ING) {
|
||||||
|
// task = mQueue.createTask(mTargetName, mEntity);
|
||||||
|
// mQueue.stopTask(task);
|
||||||
|
// } else {
|
||||||
|
// Log.w(TAG, "停止命令执行失败,【调度器中没有该任务】");
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (!TextUtils.isEmpty(mTargetName)) {
|
||||||
|
// task.setTargetName(mTargetName);
|
||||||
|
// }
|
||||||
|
// mQueue.stopTask(task);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
} |
@ -1,48 +0,0 @@ |
|||||||
///*
|
|
||||||
// * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
|
||||||
// *
|
|
||||||
// * Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// * you may not use this file except in compliance with the License.
|
|
||||||
// * You may obtain a copy of the License at
|
|
||||||
// *
|
|
||||||
// * http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
// *
|
|
||||||
// * Unless required by applicable law or agreed to in writing, software
|
|
||||||
// * distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// * See the License for the specific language governing permissions and
|
|
||||||
// * limitations under the License.
|
|
||||||
// */
|
|
||||||
//package com.arialyy.aria.core.command.download;
|
|
||||||
//
|
|
||||||
//import android.util.Log;
|
|
||||||
//import com.arialyy.aria.core.download.DownloadEntity;
|
|
||||||
//import com.arialyy.aria.core.task.DownloadTask;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Created by lyy on 2016/11/30.
|
|
||||||
// * 获取任务状态命令
|
|
||||||
// */
|
|
||||||
//class SingleCmd extends IDownloadCmd {
|
|
||||||
// /**
|
|
||||||
// * @param entity 下载实体
|
|
||||||
// */
|
|
||||||
// SingleCmd(String target, DownloadEntity entity) {
|
|
||||||
// super(target, entity);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// SingleCmd(DownloadEntity entity) {
|
|
||||||
// super(entity);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override public void executeCmd() {
|
|
||||||
// DownloadTask task = mQueue.getTask(mEntity);
|
|
||||||
// if (task == null) {
|
|
||||||
// task = mQueue.createTask(mTargetName, mEntity);
|
|
||||||
// } else {
|
|
||||||
// Log.w(TAG, "添加命令执行失败,【该任务已经存在】");
|
|
||||||
// }
|
|
||||||
// task.setTargetName(mTargetName);
|
|
||||||
// mQueue.startTask(task);
|
|
||||||
// }
|
|
||||||
//}
|
|
@ -1,55 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
|
|
||||||
package com.arialyy.aria.core.download.command; |
|
||||||
|
|
||||||
import android.text.TextUtils; |
|
||||||
import android.util.Log; |
|
||||||
import com.arialyy.aria.core.download.DownloadEntity; |
|
||||||
import com.arialyy.aria.core.download.DownloadTaskEntity; |
|
||||||
import com.arialyy.aria.core.download.task.DownloadTask; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by lyy on 2016/9/20. |
|
||||||
* 停止命令 |
|
||||||
*/ |
|
||||||
class StopCmd extends IDownloadCmd { |
|
||||||
|
|
||||||
StopCmd(DownloadTaskEntity entity) { |
|
||||||
super(entity); |
|
||||||
} |
|
||||||
|
|
||||||
StopCmd(String targetName, DownloadTaskEntity entity) { |
|
||||||
super(targetName, entity); |
|
||||||
} |
|
||||||
|
|
||||||
@Override public void executeCmd() { |
|
||||||
DownloadTask task = mQueue.getTask(mEntity.downloadEntity); |
|
||||||
if (task == null) { |
|
||||||
if (mEntity.downloadEntity.getState() == DownloadEntity.STATE_DOWNLOAD_ING) { |
|
||||||
task = mQueue.createTask(mTargetName, mEntity); |
|
||||||
mQueue.stopTask(task); |
|
||||||
} else { |
|
||||||
Log.w(TAG, "停止命令执行失败,【调度器中没有该任务】"); |
|
||||||
} |
|
||||||
} else { |
|
||||||
if (!TextUtils.isEmpty(mTargetName)) { |
|
||||||
task.setTargetName(mTargetName); |
|
||||||
} |
|
||||||
mQueue.stopTask(task); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,8 @@ |
|||||||
|
package com.arialyy.aria.core.inf; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Aria.Lao on 2017/2/13. |
||||||
|
*/ |
||||||
|
|
||||||
|
public interface ITask { |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
package com.arialyy.aria.core.inf; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Aria.Lao on 2017/2/13. |
||||||
|
*/ |
||||||
|
|
||||||
|
public interface ITaskEntity { |
||||||
|
} |
Loading…
Reference in new issue