任务组功能实现

This commit is contained in:
AriaLyy
2017-07-18 22:08:47 +08:00
152 changed files with 7074 additions and 2885 deletions

View File

@@ -0,0 +1,44 @@
<?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"
/>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<include layout="@layout/layout_bar"/>
<include
layout="@layout/content_single"
bind:fileSize="@{fileSize}"
bind:progress="@{progress}"
bind:speed="@{speed}"
/>
<com.arialyy.simple.widget.SubStateLinearLayout
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:id="@+id/child_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
</layout>

View File

@@ -13,7 +13,7 @@
android:id="@+id/download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="下载 demo"
android:text="下载"
style="?buttonBarButtonStyle"
/>
@@ -21,15 +21,15 @@
android:id="@+id/upload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="上传 demo"
android:text="上传"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/multi_test"
android:id="@+id/download_task_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="多任务测试"
android:text="下载任务组"
style="?buttonBarButtonStyle"
/>

View File

@@ -1,5 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<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"
/>
</data>
<android.support.design.widget.CoordinatorLayout
xmlns:tools="http://schemas.android.com/tools"
@@ -18,7 +35,12 @@
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_single"/>
<include
layout="@layout/content_single"
bind:fileSize="@{fileSize}"
bind:progress="@{progress}"
bind:speed="@{speed}"
/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"

View File

@@ -1,135 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.arialyy.simple.download.SingleTaskActivity"
tools:showIn="@layout/activity_single"
>
<com.arialyy.simple.widget.HorizontalProgressBarWithNumber
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_margin="16dp"
android:layout_toLeftOf="@+id/size"
android:max="100"
style="?android:attr/progressBarStyleHorizontal"
/>
<data>
<variable
name="fileSize"
type="String"
/>
<variable
name="speed"
type="String"
/>
<variable
name="progress"
type="int"
/>
</data>
<TextView
android:id="@+id/size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/progressBar"
android:layout_marginRight="16dp"
android:text="0mb"
android:textSize="16sp"
/>
<LinearLayout
android:id="@+id/handle_bar"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/progressBar"
android:orientation="horizontal"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.arialyy.simple.download.SingleTaskActivity"
tools:showIn="@layout/activity_single"
>
<com.arialyy.simple.widget.HorizontalProgressBarWithNumber
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_margin="16dp"
android:layout_toLeftOf="@+id/size"
android:max="100"
android:progress="@{progress}"
style="?android:attr/progressBarStyleHorizontal"
/>
<TextView
android:id="@+id/speed"
android:id="@+id/size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="0kb/s"
android:textColor="@color/black"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/progressBar"
android:layout_marginRight="16dp"
android:text="@{fileSize}"
android:textSize="16sp"
/>
<Button
android:id="@+id/start"
android:layout_width="0dp"
<LinearLayout
android:id="@+id/handle_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onClick"
android:text="开始"
style="?buttonBarButtonStyle"
/>
android:layout_below="@+id/progressBar"
android:orientation="horizontal"
>
<TextView
android:id="@+id/speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="@{speed}"
android:textColor="@color/black"
/>
<Button
android:id="@+id/stop"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onClick"
android:text="暂停"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/start"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onClick"
android:text="开始"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/cancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onClick"
android:text="删除任务"
style="?buttonBarButtonStyle"
/>
</LinearLayout>
<Button
android:id="@+id/stop"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onClick"
android:text="暂停"
style="?buttonBarButtonStyle"
/>
<TextView
android:id="@+id/speed_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/handle_bar"
/>
<Button
android:id="@+id/cancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onClick"
android:text="删除任务"
style="?buttonBarButtonStyle"
/>
</LinearLayout>
<RadioGroup
android:visibility="gone"
android:id="@+id/speeds"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/speed_hint"
android:orientation="horizontal"
>
<RadioButton
<TextView
android:id="@+id/speed_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="256kb"
android:layout_below="@+id/handle_bar"
/>
<RadioButton
android:layout_width="wrap_content"
<RadioGroup
android:id="@+id/speeds"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="512kb"
/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="1mb"
/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="2mb"
/>
android:layout_below="@+id/speed_hint"
android:orientation="horizontal"
android:visibility="gone"
>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="max"
/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="256kb"
/>
</RadioGroup>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="512kb"
/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="1mb"
/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="2mb"
/>
</RelativeLayout>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="max"
/>
</RadioGroup>
</RelativeLayout>
</layout>

View File

@@ -1,12 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<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"
/>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<include layout="@layout/dialog_download"/>
<include
layout="@layout/dialog_download"
bind:fileSize="@{fileSize}"
bind:progress="@{progress}"
bind:speed="@{speed}"
/>
</LinearLayout>
</layout>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<include
layout="@layout/layout_item_progress"
android:id="@+id/include"
/>
<com.arialyy.simple.widget.SubStateLinearLayout
android:visibility="gone"
android:id="@+id/child_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/include"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
/>
</RelativeLayout>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<include layout="@layout/layout_item_progress"/>
</RelativeLayout>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@color/black"
android:textSize="14sp"
/>

View File

@@ -65,7 +65,6 @@
android:textColor="@color/bt_selector_cancel"
/>
</RelativeLayout>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
@@ -75,22 +74,4 @@
android:text="name"
/>
<TextView
android:id="@+id/download_url"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/name"
android:layout_marginTop="5dp"
android:ellipsize="end"
android:maxLines="2"
/>
<TextView
android:id="@+id/download_path"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/download_url"
android:layout_marginTop="5dp"
/>
</RelativeLayout>
</RelativeLayout>

View File

@@ -22,6 +22,7 @@
<item>幻影纹章</item>
<item>史上最坑爹的游戏10</item>
<item>鲜果消消乐</item>
<item>航海奇迹</item>
</string-array>
<string-array name="download_url">
@@ -30,6 +31,7 @@
<item>http://rs.0.gaoshouyou.com/d/51/46/58514d126c46b8a3f27fc8c7db3b09ec.apk</item>
<item>http://rs.0.gaoshouyou.com/d/23/69/07238f952669727878d7a0e180534c8b.apk</item>
<item>http://rs.0.gaoshouyou.com/d/e7/3d/73e716d3353de5b479fcf7da8d36a5ef.apk</item>
<item>http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk</item>
</string-array>
<string-array name="highest_names">
@@ -44,4 +46,20 @@
<item>https://res5.d.cn/6f78ee3bcfdd033ef8e38596afb298d87de07e5f0f1f91f22acd57750f8ae68270531e2b266ea41c86cd196da839a0afef1952dde89773c7e26b9019249503174ca0513fa0a36a6472c4202bbf94da382964a0478471b753ebd95b67aac7ad89.apk</item>
</string-array>
<string-array name="group_urls">
<item>https://res5.d.cn/5a6a3384c1b2be1a65d84b914e6a6fef697637578b6db2eb1056d50b09cf1dcf289d4045df7ef95746e498e3d6a848ab84c89b77aa60194e2c48e5a7cb748265.apk</item>
<item>https://res5.d.cn/5a6a3384c1b2be1a52034c72752e8475414630ebc69318b84ef584115ebf5eaaab945ae07b7fe3596afc72a7940ff328d4a9553f6ae92d6c09ba4bfb533137f6.apk</item>
<item>https://res5.d.cn/5a6a3384c1b2be1a426f06bfc69034d69c44ae1a01da180cab8e59bd1a5e1a784bac46ba0c64579d14f0e80a4ce4f068af89b0369a393456f4f449a8829cad5c.apk</item>
<!--<item>http://static.gaoshouyou.com/d/12/0d/7f120f50c80d2e7b8c4ba24ece4f9cdd.apk</item>-->
<!--<item>http://static.gaoshouyou.com/d/d4/4f/d6d48db3794fb9ecf47e83c346570881.apk</item>-->
</string-array>
<string-array name="group_names">
<item>王者荣耀.apk</item>
<item>战斗吧剑灵.apk</item>
<item>天魔幻想.apk</item>
</string-array>
</resources>