diff --git a/HttpGroup/.gitignore b/HttpGroup/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/HttpGroup/.gitignore @@ -0,0 +1 @@ +/build diff --git a/HttpGroup/build.gradle b/HttpGroup/build.gradle new file mode 100644 index 00000000..61852072 --- /dev/null +++ b/HttpGroup/build.gradle @@ -0,0 +1,15 @@ +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + implementation project(path: ':PublicComponent') + implementation project(path: ':Http') + implementation(libs.bundles.room) + implementation(libs.kt.coroutines) + kapt libs.room.compiler +} + +//apply from: 'bintray-release.gradle' +ext { + PUBLISH_ARTIFACT_ID = 'http' +} +apply from: '../gradle/mavenCentral-release.gradle' \ No newline at end of file diff --git a/HttpGroup/consumer-rules.pro b/HttpGroup/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/HttpGroup/proguard-rules.pro b/HttpGroup/proguard-rules.pro new file mode 100644 index 00000000..f1b42451 --- /dev/null +++ b/HttpGroup/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/HttpGroup/src/main/AndroidManifest.xml b/HttpGroup/src/main/AndroidManifest.xml new file mode 100644 index 00000000..bb0d2bdf --- /dev/null +++ b/HttpGroup/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + diff --git a/HttpGroup/src/main/java/com/arialyy/dua/group/DGroupUtil.kt b/HttpGroup/src/main/java/com/arialyy/dua/group/DGroupUtil.kt new file mode 100644 index 00000000..f9b8e68e --- /dev/null +++ b/HttpGroup/src/main/java/com/arialyy/dua/group/DGroupUtil.kt @@ -0,0 +1,46 @@ +/* + * 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.dua.group + +import com.arialyy.aria.core.inf.IBlockManager +import com.arialyy.aria.core.task.AbsTaskUtil + +/** + * @Author laoyuyu + * @Description + * @Date 21:58 2023/2/20 + **/ +internal class DGroupUtil : AbsTaskUtil() { + override fun getBlockManager(): IBlockManager { + TODO("Not yet implemented") + } + + override fun isRunning(): Boolean { + TODO("Not yet implemented") + } + + override fun cancel() { + TODO("Not yet implemented") + } + + override fun stop() { + TODO("Not yet implemented") + } + + override fun start() { + TODO("Not yet implemented") + } +} \ No newline at end of file diff --git a/HttpGroup/src/main/java/com/arialyy/dua/group/HttpGroupComponent.kt b/HttpGroup/src/main/java/com/arialyy/dua/group/HttpGroupComponent.kt new file mode 100644 index 00000000..7280540f --- /dev/null +++ b/HttpGroup/src/main/java/com/arialyy/dua/group/HttpGroupComponent.kt @@ -0,0 +1,30 @@ +/* + * 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.dua.group + +import android.content.Context +import com.arialyy.aria.core.inf.IComponentInit + +/** + * @Author laoyuyu + * @Description + * @Date 21:51 2023/2/20 + **/ +class HttpGroupComponent : IComponentInit { + override fun init(context: Context) { + + } +} \ No newline at end of file diff --git a/HttpGroup/src/main/resources/META-INF/MANIFEST.MF b/HttpGroup/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/HttpGroup/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/HttpGroup/src/main/resources/META-INF/services/com.arialyy.aria.core.inf.IComponentInit b/HttpGroup/src/main/resources/META-INF/services/com.arialyy.aria.core.inf.IComponentInit new file mode 100644 index 00000000..510f8e0a --- /dev/null +++ b/HttpGroup/src/main/resources/META-INF/services/com.arialyy.aria.core.inf.IComponentInit @@ -0,0 +1 @@ +com.arialyy.dua.group.HttpGroupComponent \ No newline at end of file diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/task/AbsGroupTask.java b/PublicComponent/src/main/java/com/arialyy/aria/core/task/AbsGroupTask.java deleted file mode 100644 index bc925169..00000000 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/task/AbsGroupTask.java +++ /dev/null @@ -1,53 +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.task; - -import com.arialyy.aria.core.download.AbsGroupTaskWrapper; -import com.arialyy.aria.core.group.AbsGroupLoaderUtil; - -/** - * Created by AriaL on 2017/6/29. - * 任务组任务抽象类 - */ -public abstract class AbsGroupTask - extends AbsTask { - - @Override public String getKey() { - return mTaskWrapper.getEntity().getKey(); - } - - /** - * 启动任务组中的子任务 - * - * @param url 子任务下载地址 - */ - public void startSubTask(String url) { - if (getTaskUtil() != null) { - ((AbsGroupLoaderUtil) getTaskUtil()).startSubTask(url); - } - } - - /** - * 停止任务组中的子任务 - * - * @param url 子任务下载地址 - */ - public void stopSubTask(String url) { - if (getTaskUtil() != null) { - ((AbsGroupLoaderUtil) getTaskUtil()).stopSubTask(url); - } - } -} diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/task/DownloadGroupTask.java b/PublicComponent/src/main/java/com/arialyy/aria/core/task/DownloadGroupTask.java index ac5820d3..9fa2b650 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/task/DownloadGroupTask.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/task/DownloadGroupTask.java @@ -15,62 +15,26 @@ */ package com.arialyy.aria.core.task; -import android.os.Handler; -import android.os.Looper; -import android.text.TextUtils; -import com.arialyy.aria.core.AriaConfig; -import com.arialyy.aria.core.download.DGTaskWrapper; -import com.arialyy.aria.core.download.DownloadGroupEntity; -import com.arialyy.aria.core.listener.ISchedulers; -import com.arialyy.aria.util.ComponentUtil; +import com.arialyy.aria.core.download.DTaskOption; +import com.arialyy.aria.core.inf.ITaskOption; +import com.arialyy.aria.core.inf.ITaskUtil; +import java.util.Objects; /** * Created by AriaL on 2017/6/27. * 任务组任务 */ -public class DownloadGroupTask extends AbsGroupTask { +public class DownloadGroupTask extends AbsTask { - private DownloadGroupTask(DGTaskWrapper taskWrapper, Handler outHandler) { - mTaskWrapper = taskWrapper; - mOutHandler = outHandler; - mContext = AriaConfig.getInstance().getAPP(); - mListener = - ComponentUtil.getInstance().buildListener(taskWrapper.getRequestType(), this, mOutHandler); - } - - public DownloadGroupEntity getEntity() { - return mTaskWrapper.getEntity(); - } - - @Override public String getTaskName() { - return "任务组->" + (TextUtils.isEmpty(mTaskWrapper.getEntity().getAlias()) - ? mTaskWrapper.getEntity().getGroupHash() : mTaskWrapper.getEntity().getAlias()); + protected DownloadGroupTask(ITaskOption taskOption, ITaskUtil util) { + super(taskOption, util); } @Override public int getTaskType() { return DOWNLOAD_GROUP; } - public static class Builder { - DGTaskWrapper taskEntity; - Handler outHandler; - - public Builder(DGTaskWrapper taskEntity) { - this.taskEntity = taskEntity; - } - - /** - * 设置自定义Handler处理下载状态时间 - * - * @param schedulers {@link ISchedulers} - */ - public DownloadGroupTask.Builder setOutHandler(ISchedulers schedulers) { - outHandler = new Handler(Looper.getMainLooper(), schedulers); - return this; - } - - public DownloadGroupTask build() { - return new DownloadGroupTask(taskEntity, outHandler); - } + @Override public String getFilePath() { + return Objects.requireNonNull(getTaskOption(DTaskOption.class).getSavePathUri()).toString(); } } diff --git a/settings.gradle b/settings.gradle index 3307b1fa..234a5a57 100644 --- a/settings.gradle +++ b/settings.gradle @@ -56,7 +56,7 @@ gradle.rootProject { def componentList = [':app', ':Aria', ':AriaAnnotations', ':AriaCompiler', ':AppFrame', ':Http', ':M3U8Component', ':SFtpComponent', ':FtpComponent', ':PublicComponent', - ':Queue', ':Schedulers' + ':Queue', ':Schedulers', ":HttpGroup" ] componentList.forEach {