重构线程任务模块

This commit is contained in:
laoyuyu
2019-05-31 22:33:12 +08:00
parent 39a43c836d
commit d3fb30d8b9
79 changed files with 3338 additions and 4089 deletions

View File

@@ -0,0 +1,33 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="1024"
android:viewportWidth="1024"
android:width="24dp">
<path
android:fillColor="#F4F4F4"
android:pathData="M891.9,307.2v634.88c0,15.87 -12.8,28.16 -28.16,28.67H206.34c-11.78,0 -21.5,-9.22 -22.02,-21.5V90.62c0,-8.7 7.17,-15.87 15.87,-15.87h442.88c0.51,0 1.02,0.51 1.02,1.02s0,0.51 -0.51,0.51c-0.51,0.51 -0.51,1.02 0,1.54l247.81,228.86c0.51,0 0.51,0.51 0.51,0.51z"/>
<path
android:fillColor="#6200AF"
android:pathData="M643.58,291.84L643.58,74.75l248.32,231.94h-233.98c-7.68,0 -14.34,-6.66 -14.34,-14.85zM420.35,366.08L202.24,366.08c-58.37,0 -105.47,-47.1 -105.47,-105.47S143.36,154.62 202.24,154.62h218.11c58.37,0 105.47,47.1 105.47,105.47s-47.1,105.98 -105.47,105.98zM658.43,771.58h-235.52c-21.5,0 -38.4,-17.41 -38.91,-38.4v-178.69c0,-21.5 17.41,-38.4 38.4,-38.4h235.52c21.5,0 38.4,17.41 38.4,38.4v178.69c0,20.99 -16.9,38.4 -37.89,38.4zM422.91,529.41c-13.82,0 -24.58,11.26 -24.58,24.58v178.69c0,13.82 11.26,24.58 24.58,24.58h235.52c13.82,0 24.58,-11.26 24.58,-24.58v-178.69c0,-13.82 -11.26,-24.58 -24.58,-24.58h-235.52z"/>
<path
android:fillColor="#6200AF"
android:pathData="M437.76,771.58c-4.1,0 -7.17,-3.07 -7.17,-7.17L430.59,522.24c0,-4.1 3.07,-7.17 7.17,-7.17s7.17,3.07 7.17,7.17v242.18c0,4.1 -3.07,7.17 -7.17,7.17zM643.07,771.58c-4.1,0 -7.17,-3.07 -7.17,-7.17L635.9,522.24c0,-4.1 3.07,-7.17 7.17,-7.17s7.17,3.07 7.17,7.17v242.18c0,4.1 -3.07,7.17 -7.17,7.17z"/>
<path
android:fillColor="#6200AF"
android:pathData="M437.76,595.97h-46.59c-4.1,0 -7.17,-3.07 -7.17,-7.17s3.07,-7.17 7.17,-7.17h46.59c4.1,0 7.17,3.07 7.17,7.17s-3.58,7.17 -7.17,7.17zM437.76,650.75h-46.59c-4.1,0 -7.17,-3.07 -7.17,-7.17s3.07,-7.17 7.17,-7.17h46.59c4.1,0 7.17,3.07 7.17,7.17s-3.58,7.17 -7.17,7.17zM437.76,712.19h-46.59c-4.1,0 -7.17,-3.07 -7.17,-7.17s3.07,-7.17 7.17,-7.17h46.59c4.1,0 7.17,3.07 7.17,7.17s-3.58,7.17 -7.17,7.17zM689.66,595.97h-46.59c-4.1,0 -7.17,-3.07 -7.17,-7.17s3.07,-7.17 7.17,-7.17h46.59c4.1,0 7.17,3.07 7.17,7.17s-3.07,7.17 -7.17,7.17zM689.66,650.75h-46.59c-4.1,0 -7.17,-3.07 -7.17,-7.17s3.07,-7.17 7.17,-7.17h46.59c4.1,0 7.17,3.07 7.17,7.17s-3.07,7.17 -7.17,7.17zM689.66,712.19h-46.59c-4.1,0 -7.17,-3.07 -7.17,-7.17s3.07,-7.17 7.17,-7.17h46.59c4.1,0 7.17,3.07 7.17,7.17s-3.07,7.17 -7.17,7.17zM509.44,693.25c-1.02,0 -2.56,-0.51 -3.58,-1.02 -2.05,-1.02 -3.58,-3.58 -3.58,-6.14v-86.02c0,-2.56 1.54,-4.61 3.58,-6.14 2.05,-1.02 4.61,-1.02 7.17,0l74.24,43.01c3.58,2.05 4.61,6.14 2.56,9.73 -0.51,1.02 -1.54,2.05 -2.56,2.56l-74.24,43.01c-1.02,1.02 -2.05,1.02 -3.58,1.02zM516.61,612.86v61.44l53.25,-30.72 -53.25,-30.72z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M284.16,301.57h-15.36L261.12,279.55h-33.79L220.16,301.57h-15.36l31.74,-84.99h15.87l31.74,84.99zM257.54,268.29L245.76,233.98c-0.51,-1.54 -1.02,-3.58 -1.02,-5.12 -0.51,1.54 -0.51,3.58 -1.02,5.12l-11.78,33.79h25.6zM360.96,216.06l-30.72,85.5h-15.87l-30.21,-85.5h15.36l20.99,64.51c0.51,2.56 1.02,4.61 1.54,7.17 0.51,-2.56 1.02,-5.12 1.54,-7.17l21.5,-64.51h15.87zM391.68,301.57h-14.34L377.34,216.06h14.34v85.5z"/>
<path
android:fillColor="#F4F4F4"
android:pathData="M891.9,307.2v634.88c0,15.87 -12.8,28.16 -28.16,28.67H206.34c-11.78,0 -21.5,-9.22 -22.02,-21.5V90.62c0,-8.7 7.17,-15.87 15.87,-15.87h442.88c0.51,0 1.02,0.51 1.02,1.02s0,0.51 -0.51,0.51c-0.51,0.51 -0.51,1.02 0,1.54l247.81,228.86c0.51,0 0.51,0.51 0.51,0.51z"/>
<path
android:fillColor="@color/icon_color"
android:pathData="M643.58,291.84V74.75l248.32,231.94h-233.98c-7.68,0 -14.34,-6.66 -14.34,-14.85zM420.35,366.08H202.24c-58.37,0 -105.47,-47.1 -105.47,-105.47S143.36,154.62 202.24,154.62h218.11c58.37,0 105.47,47.1 105.47,105.47s-47.1,105.98 -105.47,105.98z"/>
<path
android:fillColor="#FFFFFF"
android:pathData="M308.22,231.94h-24.06v69.63h-19.46V231.94H240.64v-15.87h67.58v15.87zM321.02,297.98v-18.94c3.58,3.07 7.17,5.12 11.26,6.66 4.1,1.54 8.19,2.05 12.29,2.05 2.56,0 4.61,0 6.14,-0.51s3.07,-1.02 4.61,-2.05c1.02,-1.02 2.05,-1.54 2.56,-2.56 0.51,-1.02 1.02,-2.05 1.02,-3.58 0,-1.54 -0.51,-3.07 -1.54,-4.61 -1.02,-1.54 -2.05,-2.56 -4.1,-3.58 -1.54,-1.02 -3.58,-2.05 -5.63,-3.07 -2.05,-1.02 -4.61,-2.05 -7.17,-3.07 -6.66,-2.56 -11.78,-6.14 -14.85,-10.24 -3.07,-4.1 -5.12,-8.7 -5.12,-14.34 0,-4.61 1.02,-8.19 2.56,-11.26 1.54,-3.07 4.1,-5.63 7.17,-7.68s6.66,-3.58 10.75,-4.61 8.19,-1.54 12.8,-1.54c4.61,0 8.19,0.51 11.78,1.02 3.58,0.51 6.66,1.54 9.73,2.56v17.92c-1.54,-1.02 -3.07,-2.05 -4.61,-2.56 -1.54,-0.51 -3.58,-1.54 -5.12,-2.05s-3.58,-1.02 -5.12,-1.02c-1.54,0 -3.58,-0.51 -5.12,-0.51 -2.05,0 -4.1,0 -6.14,0.51l-4.61,1.54c-1.02,0.51 -2.05,1.54 -3.07,2.56 -0.51,1.02 -1.02,2.05 -1.02,3.58 0,1.54 0.51,2.56 1.02,3.58 0.51,1.02 2.05,2.05 3.07,3.07 1.54,1.02 3.07,2.05 5.12,3.07 2.05,1.02 4.1,2.05 6.66,3.07 3.58,1.54 6.66,3.07 9.22,4.61 2.56,1.54 5.12,3.58 7.17,5.63 2.05,2.05 3.58,4.1 4.61,7.17s1.54,5.63 1.54,9.22c0,4.61 -1.02,8.7 -2.56,11.78s-4.1,5.63 -7.17,7.68 -6.66,3.58 -10.75,4.1c-4.1,1.02 -8.19,1.54 -12.8,1.54 -4.61,0 -9.22,-0.51 -13.31,-1.02 -4.61,-1.02 -8.19,-2.56 -11.26,-4.1z"/>
<path
android:fillColor="@color/icon_color"
android:pathData="M504.83,708.61l75.26,-43.01c5.12,-3.58 6.66,-10.75 3.58,-15.87 -1.02,-1.54 -2.05,-2.56 -3.58,-3.58l-75.26,-43.01c-4.61,-2.05 -10.24,0 -12.8,4.61 -0.51,1.54 -1.02,3.07 -1.02,5.12v85.5c-0.51,5.12 3.58,9.73 8.7,10.24 2.05,1.02 3.58,0.51 5.12,0zM660.48,527.36L416.26,527.36c-15.36,0 -28.16,14.34 -28.16,32.26v192.51c0,17.92 12.29,32.26 28.16,32.26L660.48,784.38c15.36,0 28.16,-14.34 28.16,-32.26v-192c0,-17.92 -12.8,-32.77 -28.16,-32.77zM444.42,752.13c0,5.63 -4.1,10.24 -9.22,10.75h-18.43c-5.63,-0.51 -9.73,-5.12 -9.22,-10.75v-20.99c-0.51,-5.63 4.1,-10.24 9.22,-10.75L435.2,720.38c5.63,0.51 9.73,5.12 9.22,10.75v20.99zM444.42,666.62c0.51,5.63 -4.1,10.24 -9.22,10.75h-18.43c-5.63,-0.51 -9.73,-5.12 -9.22,-10.75v-20.99c0,-5.63 4.1,-10.24 9.22,-10.75L435.2,634.88c5.63,0.51 9.73,5.12 9.22,10.75v20.99zM444.42,581.12c0.51,5.63 -4.1,10.24 -9.22,10.75h-18.43c-5.63,-0.51 -9.73,-5.12 -9.22,-10.75v-20.99c-0.51,-5.63 4.1,-10.24 9.22,-10.75L435.2,549.38c5.63,0.51 9.73,5.12 9.22,10.75v20.99zM613.38,762.88L463.36,762.88v-214.02h150.02L613.38,762.88zM669.7,752.13c0,5.63 -3.58,10.24 -9.22,10.75h-18.43c-5.63,-0.51 -9.73,-5.12 -9.22,-10.75v-20.99c-0.51,-5.63 4.1,-10.24 9.22,-10.75h18.43c5.63,0.51 9.73,5.12 9.73,10.75l-0.51,20.99zM669.7,666.62c0.51,5.63 -4.1,10.24 -9.73,10.75h-18.43c-5.63,-0.51 -9.73,-5.12 -9.22,-10.75v-20.99c-0.51,-5.63 4.1,-10.24 9.22,-10.75h18.94c5.63,0.51 9.73,5.12 9.73,10.75l-0.51,20.99zM669.7,581.12c0.51,5.63 -4.1,10.24 -9.73,10.75h-18.43c-5.63,-0.51 -9.73,-5.12 -9.22,-10.75v-20.99c-0.51,-5.63 4.1,-10.24 9.22,-10.75h18.94c5.63,0.51 9.73,5.12 9.73,10.75l-0.51,20.99z"/>
</vector>

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bind="http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name="fileSize"
type="String"
/>
<variable
name="speed"
type="String"
/>
<variable
name="progress"
type="int"
/>
<variable
name="stateStr"
type="String"
/>
<variable
name="url"
type="String"
/>
<variable
name="filePath"
type="String"
/>
<variable
name="viewModel"
type="com.arialyy.simple.core.download.m3u8.M3U8DownloadActivity"
/>
</data>
<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".core.download.SingleTaskActivity"
>
<include layout="@layout/layout_bar"/>
<com.arialyy.simple.widget.SvgTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
bind:iconClickListener="@{() -> viewModel.chooseUrl()}"
bind:svg_text_view_icon="@drawable/ic_modify"
bind:text="@{@string/url(url)}"
/>
<com.arialyy.simple.widget.SvgTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
bind:iconClickListener="@{() -> viewModel.chooseFilePath()}"
bind:svg_text_view_icon="@drawable/ic_choose_file"
bind:text="@{@string/file_path(filePath)}"
/>
<include
layout="@layout/layout_content_single"
bind:fileSize="@{fileSize}"
bind:progress="@{progress}"
bind:speed="@{speed}"
bind:stateStr="@{stateStr}"
/>
</LinearLayout>
</layout>

View File

@@ -35,6 +35,7 @@
<item>FTP 下载</item>
<item>FTP 文件夹下载</item>
<item>FTP 文件上传</item>
<item>M3U8 点播文件下载</item>
</string-array>
<string-array name="main_items_desc">
@@ -44,6 +45,7 @@
<item>单文件下载、多文件队列下载</item>
<item>下载服务器上的某个FTP文件夹</item>
<item>上传单个文件到服务器</item>
<item>下载M3U8点播文件</item>
</string-array>
<string-array name="download_items">