http group component

v4
laoyuyu 2 years ago
parent ca3a8dc122
commit 34e60bd578
  1. 1
      HttpGroup/.gitignore
  2. 15
      HttpGroup/build.gradle
  3. 0
      HttpGroup/consumer-rules.pro
  4. 21
      HttpGroup/proguard-rules.pro
  5. 2
      HttpGroup/src/main/AndroidManifest.xml
  6. 46
      HttpGroup/src/main/java/com/arialyy/dua/group/DGroupUtil.kt
  7. 30
      HttpGroup/src/main/java/com/arialyy/dua/group/HttpGroupComponent.kt
  8. 2
      HttpGroup/src/main/resources/META-INF/MANIFEST.MF
  9. 1
      HttpGroup/src/main/resources/META-INF/services/com.arialyy.aria.core.inf.IComponentInit
  10. 53
      PublicComponent/src/main/java/com/arialyy/aria/core/task/AbsGroupTask.java
  11. 54
      PublicComponent/src/main/java/com/arialyy/aria/core/task/DownloadGroupTask.java
  12. 2
      settings.gradle

@ -0,0 +1 @@
/build

@ -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'

@ -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

@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.arialyy.aria.http" />

@ -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")
}
}

@ -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) {
}
}

@ -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<TASK_ENTITY extends AbsGroupTaskWrapper>
extends AbsTask<TASK_ENTITY> {
@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);
}
}
}

@ -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<DGTaskWrapper> {
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();
}
}

@ -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 {

Loading…
Cancel
Save