修改demo界面

This commit is contained in:
laoyuyu
2019-03-07 21:09:20 +08:00
parent 0f9f2577b8
commit 3042d06a0e
70 changed files with 691 additions and 377 deletions

View File

@@ -14,6 +14,7 @@ android {
versionCode 1
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {

View File

@@ -29,20 +29,20 @@
</intent-filter>
</activity>
<activity android:name=".download.DownloadActivity"/>
<activity android:name=".download.SingleTaskActivity"/>
<activity android:name=".download.multi_download.MultiTaskActivity"/>
<activity android:name=".download.fragment_download.FragmentActivity"/>
<activity android:name=".download.multi_download.MultiDownloadActivity"/>
<activity android:name=".download.HighestPriorityActivity"/>
<activity android:name=".test.TestMutilTaskSysDownload"/>
<activity android:name=".download.group.DownloadGroupActivity"/>
<activity android:name=".download.FtpDownloadActivity"/>
<activity android:name=".download.group.FTPDirDownloadActivity"/>
<activity android:name=".upload.HttpUploadActivity"/>
<activity android:name=".upload.FtpUploadActivity"/>
<activity android:name=".core.download.DownloadActivity"/>
<activity android:name=".core.download.SingleTaskActivity"/>
<activity android:name=".core.download.multi_download.MultiTaskActivity"/>
<activity android:name=".core.download.fragment_download.FragmentActivity"/>
<activity android:name=".core.download.multi_download.MultiDownloadActivity"/>
<activity android:name=".core.download.HighestPriorityActivity"/>
<activity android:name="com.arialyy.simple.core.test.TestMutilTaskSysDownload"/>
<activity android:name=".core.download.group.DownloadGroupActivity"/>
<activity android:name=".core.download.FtpDownloadActivity"/>
<activity android:name=".core.download.group.FTPDirDownloadActivity"/>
<activity android:name=".core.upload.HttpUploadActivity"/>
<activity android:name=".core.upload.FtpUploadActivity"/>
<service android:name=".download.service_download.DownloadService"/>
<service android:name=".core.download.service_download.DownloadService"/>
</application>
</manifest>

View File

@@ -16,66 +16,129 @@
package com.arialyy.simple;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.arialyy.frame.permission.OnPermissionCallback;
import com.arialyy.frame.permission.PermissionManager;
import com.arialyy.frame.util.show.T;
import com.arialyy.simple.base.BaseActivity;
import com.arialyy.simple.base.adapter.AbsHolder;
import com.arialyy.simple.base.adapter.AbsRVAdapter;
import com.arialyy.simple.base.adapter.RvItemClickSupport;
import com.arialyy.simple.databinding.ActivityMainBinding;
import com.arialyy.simple.download.DownloadActivity;
import com.arialyy.simple.download.FtpDownloadActivity;
import com.arialyy.simple.download.group.DownloadGroupActivity;
import com.arialyy.simple.download.group.FTPDirDownloadActivity;
import com.arialyy.simple.upload.FtpUploadActivity;
import com.arialyy.simple.upload.HttpUploadActivity;
import com.arialyy.simple.core.download.DownloadActivity;
import com.arialyy.simple.core.download.FtpDownloadActivity;
import com.arialyy.simple.core.download.group.DownloadGroupActivity;
import com.arialyy.simple.core.download.group.FTPDirDownloadActivity;
import com.arialyy.simple.core.upload.FtpUploadActivity;
import com.arialyy.simple.core.upload.HttpUploadActivity;
import com.arialyy.simple.modlue.CommonModule;
import com.arialyy.simple.to.NormalTo;
import java.util.List;
/**
* Created by lyy on 2017/3/1.
* 首页
*/
public class MainActivity extends BaseActivity<ActivityMainBinding>
implements View.OnClickListener {
public class MainActivity extends BaseActivity<ActivityMainBinding> {
public static final String KEY_MAIN_DATA = "KEY_MAIN_DATA";
@Override protected void init(Bundle savedInstanceState) {
super.init(savedInstanceState);
setSupportActionBar(mBar);
mBar.setTitle("Aria Demo");
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
getBinding().download.setOnClickListener(this);
getBinding().upload.setOnClickListener(this);
getBinding().downloadTaskGroup.setOnClickListener(this);
getBinding().ftpDownload.setOnClickListener(this);
getBinding().ftpDirDownload.setOnClickListener(this);
getBinding().ftpUpload.setOnClickListener(this);
getBinding().kotlinDownload.setOnClickListener(this);
getBinding().list.setLayoutManager(new LinearLayoutManager(this));
final List<NormalTo> data = getModule(CommonModule.class).getMainData();
getBinding().list.setAdapter(
new Adapter(this, data));
RvItemClickSupport.addTo(getBinding().list).setOnItemClickListener(
new RvItemClickSupport.OnItemClickListener() {
@Override public void onItemClicked(RecyclerView recyclerView, int position, View v) {
CommonModule module = getModule(CommonModule.class);
switch (position) {
case 0:
module.startNextActivity(data.get(position), DownloadActivity.class);
break;
case 1:
module.startNextActivity(data.get(position), HttpUploadActivity.class);
break;
case 2:
module.startNextActivity(data.get(position), DownloadGroupActivity.class);
break;
case 3:
module.startNextActivity(data.get(position), FtpDownloadActivity.class);
break;
case 4:
module.startNextActivity(data.get(position), FTPDirDownloadActivity.class);
break;
case 5:
module.startNextActivity(data.get(position), FtpUploadActivity.class);
break;
}
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
boolean hasPermission = PermissionManager.getInstance()
.checkPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (!hasPermission) {
PermissionManager.getInstance().requestPermission(this, new OnPermissionCallback() {
@Override public void onSuccess(String... permissions) {
}
@Override public void onFail(String... permissions) {
T.showShort(MainActivity.this, "没有文件读写权限");
finish();
}
}, Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
}
}
@Override protected int setLayoutId() {
return R.layout.activity_main;
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.download:
startActivity(new Intent(this, DownloadActivity.class));
break;
case R.id.upload:
startActivity(new Intent(this, HttpUploadActivity.class));
break;
case R.id.download_task_group:
startActivity(new Intent(this, DownloadGroupActivity.class));
break;
case R.id.ftp_download:
startActivity(new Intent(this, FtpDownloadActivity.class));
break;
case R.id.ftp_dir_download:
startActivity(new Intent(this, FTPDirDownloadActivity.class));
break;
case R.id.ftp_upload:
startActivity(new Intent(this, FtpUploadActivity.class));
break;
case R.id.kotlin_download:
//startActivity(new Intent(this, KotlinDownloadActivity.class));
break;
private static class Adapter extends AbsRVAdapter<NormalTo, Adapter.Holder> {
Adapter(Context context, List<NormalTo> data) {
super(context, data);
}
@Override protected Holder getViewHolder(View convertView, int viewType) {
return new Holder(convertView);
}
@Override protected int setLayoutId(int type) {
return R.layout.item_main;
}
@Override protected void bindData(Holder holder, int position, NormalTo item) {
holder.text.setText(item.title);
Log.d(TAG, item.icon + "");
holder.image.setImageResource(item.icon);
}
private static class Holder extends AbsHolder {
TextView text;
AppCompatImageView image;
Holder(View itemView) {
super(itemView);
text = findViewById(R.id.text);
image = findViewById(R.id.image);
}
}
}
}

View File

@@ -26,7 +26,7 @@ import android.view.View;
* 通用Holder
*/
public class AbsHolder extends RecyclerView.ViewHolder {
View mView;
private View mView;
private SparseArray<View> mViews = new SparseArray<>();
public AbsHolder(View itemView) {
@@ -35,7 +35,7 @@ public class AbsHolder extends RecyclerView.ViewHolder {
}
@SuppressWarnings("unchecked")
public <T extends View> T getView(@IdRes int id) {
public <T extends View> T findViewById(@IdRes int id) {
View view = mViews.get(id);
if (view == null) {
view = mView.findViewById(id);

View File

@@ -0,0 +1,148 @@
/*
* 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.simple.core.download;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import com.arialyy.simple.MainActivity;
import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseActivity;
import com.arialyy.simple.base.adapter.AbsHolder;
import com.arialyy.simple.base.adapter.AbsRVAdapter;
import com.arialyy.simple.base.adapter.RvItemClickSupport;
import com.arialyy.simple.databinding.ActivityDownloadMeanBinding;
import com.arialyy.simple.core.download.fragment_download.FragmentActivity;
import com.arialyy.simple.core.download.multi_download.MultiTaskActivity;
import com.arialyy.simple.core.download.service_download.DownloadService;
import com.arialyy.simple.modlue.CommonModule;
import com.arialyy.simple.to.NormalTo;
import java.util.List;
/**
* Created by Lyy on 2016/10/13.
*/
public class DownloadActivity extends BaseActivity<ActivityDownloadMeanBinding> {
private NormalTo mTo;
@Override protected int setLayoutId() {
return R.layout.activity_download_mean;
}
@Override protected void init(Bundle savedInstanceState) {
super.init(savedInstanceState);
mTo = getIntent().getParcelableExtra(MainActivity.KEY_MAIN_DATA);
setTitle(mTo.title);
final List<NormalTo> data = getModule(CommonModule.class).getDownloadData();
getBinding().list.setLayoutManager(new GridLayoutManager(this, 2));
getBinding().list.setAdapter(new Adapter(this, data));
RvItemClickSupport.addTo(getBinding().list).setOnItemClickListener(
new RvItemClickSupport.OnItemClickListener() {
@Override public void onItemClicked(RecyclerView recyclerView, int position, View v) {
CommonModule module = getModule(CommonModule.class);
switch (position) {
case 0:
module.startNextActivity(data.get(position), SingleTaskActivity.class);
break;
case 1:
module.startNextActivity(data.get(position), MultiTaskActivity.class);
break;
case 2:
module.startNextActivity(data.get(position), HighestPriorityActivity.class);
break;
case 3:
break;
case 4:
break;
}
}
});
}
//public void onClick(View view) {
// switch (view.getId()) {
// case R.id.highest_priority:
// startActivity(new Intent(this, HighestPriorityActivity.class));
// break;
// case R.id.service:
// startService(new Intent(this, DownloadService.class));
// break;
// case R.id.single_task:
// startActivity(new Intent(this, SingleTaskActivity.class));
// break;
// case R.id.multi_task:
// startActivity(new Intent(this, MultiTaskActivity.class));
// break;
// case R.id.dialog_task:
// DownloadDialog dialog = new DownloadDialog(this);
//
// dialog.show();
// //DownloadDialogFragment dialog = new DownloadDialogFragment(this);
// //dialog.show(getSupportFragmentManager(), "dialog");
// break;
// case R.id.pop_task:
// DownloadPopupWindow pop = new DownloadPopupWindow(this);
// pop.showAtLocation(mRootView, Gravity.CENTER_VERTICAL, 0, 0);
// break;
// case R.id.fragment_task:
// startActivity(new Intent(this, FragmentActivity.class));
// break;
// case R.id.notification:
// //SimpleNotification notification = new SimpleNotification(this);
// //notification.start();
// break;
// }
//}
private static class Adapter extends AbsRVAdapter<NormalTo, Adapter.Holder> {
Adapter(Context context, List<NormalTo> data) {
super(context, data);
}
@Override protected Adapter.Holder getViewHolder(View convertView, int viewType) {
return new Adapter.Holder(convertView);
}
@Override protected int setLayoutId(int type) {
return R.layout.item_download;
}
@Override protected void bindData(Adapter.Holder holder, int position, NormalTo item) {
holder.text.setText(item.title);
holder.image.setImageResource(item.icon);
}
private static class Holder extends AbsHolder {
TextView text;
AppCompatImageView image;
Holder(View itemView) {
super(itemView);
text = findViewById(R.id.title);
image = findViewById(R.id.image);
}
}
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download;
package com.arialyy.simple.core.download;
import android.content.Context;
import android.os.Environment;

View File

@@ -1,4 +1,4 @@
package com.arialyy.simple.download;
package com.arialyy.simple.core.download;
import android.annotation.SuppressLint;
import android.os.Bundle;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download;
package com.arialyy.simple.core.download;
import android.content.Context;
import android.content.res.Resources;
@@ -23,7 +23,7 @@ import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.util.CommonUtil;
import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseModule;
import com.arialyy.simple.download.multi_download.FileListEntity;
import com.arialyy.simple.core.download.multi_download.FileListEntity;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download;
package com.arialyy.simple.core.download;
import android.content.Context;
import android.graphics.Color;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arialyy.simple.download;
package com.arialyy.simple.core.download;
import android.os.Bundle;
import android.util.Log;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arialyy.simple.download;
package com.arialyy.simple.core.download;
import android.os.Bundle;
import android.os.Environment;
@@ -35,7 +35,7 @@ import com.arialyy.frame.util.show.L;
import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseActivity;
import com.arialyy.simple.databinding.ActivityHighestPriorityBinding;
import com.arialyy.simple.download.multi_download.DownloadAdapter;
import com.arialyy.simple.core.download.multi_download.DownloadAdapter;
import com.arialyy.simple.widget.HorizontalProgressBarWithNumber;
import java.util.ArrayList;
import java.util.HashSet;

View File

@@ -1,4 +1,4 @@
//package com.arialyy.simple.download
//package com.arialyy.simple.core.download
//
//import android.os.Bundle
//import android.os.Environment

View File

@@ -14,7 +14,7 @@
// * limitations under the License.
// */
//
//package com.arialyy.simple.download;
//package com.arialyy.simple.core.download;
//
//import android.app.NotificationManager;
//import android.content.Context;

View File

@@ -14,16 +14,12 @@
* limitations under the License.
*/
package com.arialyy.simple.download;
package com.arialyy.simple.core.download;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
@@ -34,7 +30,6 @@ import android.widget.Toast;
import com.arialyy.annotations.Download;
import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.common.RequestEnum;
import com.arialyy.aria.core.download.DownloadTarget;
import com.arialyy.aria.core.download.DownloadTask;
import com.arialyy.aria.core.inf.IEntity;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download.fragment_download;
package com.arialyy.simple.core.download.fragment_download;
import android.os.Bundle;
import android.os.Environment;
@@ -29,7 +29,6 @@ import com.arialyy.aria.util.CommonUtil;
import com.arialyy.frame.core.AbsFragment;
import com.arialyy.simple.R;
import com.arialyy.simple.databinding.FragmentDownloadBinding;
import com.arialyy.simple.widget.HorizontalProgressBarWithNumber;
/**
* Created by lyy on 2017/1/4.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download.fragment_download;
package com.arialyy.simple.core.download.fragment_download;
import android.os.Bundle;
import com.arialyy.aria.core.Aria;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arialyy.simple.download.group;
package com.arialyy.simple.core.download.group;
import android.annotation.SuppressLint;
import android.content.Context;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arialyy.simple.download.group;
package com.arialyy.simple.core.download.group;
import android.os.Bundle;
import android.os.Environment;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arialyy.simple.download.group;
package com.arialyy.simple.core.download.group;
import android.os.Bundle;
import android.os.Environment;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arialyy.simple.download.group;
package com.arialyy.simple.core.download.group;
import android.content.Context;
import com.arialyy.simple.R;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download.multi_download;
package com.arialyy.simple.core.download.multi_download;
import android.annotation.SuppressLint;
import android.content.Context;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download.multi_download;
package com.arialyy.simple.core.download.multi_download;
import android.annotation.SuppressLint;
import android.os.Bundle;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download.multi_download;
package com.arialyy.simple.core.download.multi_download;
import android.content.Context;
import android.view.View;
@@ -118,10 +118,10 @@ final class FileListAdapter extends AbsRVAdapter<FileListEntity, FileListAdapter
FileListHolder(View itemView) {
super(itemView);
name = getView(R.id.name);
url = getView(R.id.download_url);
path = getView(R.id.download_path);
bt = getView(R.id.bt);
name = findViewById(R.id.name);
url = findViewById(R.id.download_url);
path = findViewById(R.id.download_path);
bt = findViewById(R.id.bt);
}
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download.multi_download;
package com.arialyy.simple.core.download.multi_download;
/**
* Created by AriaL on 2017/1/6.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download.multi_download;
package com.arialyy.simple.core.download.multi_download;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arialyy.simple.download.multi_download;
package com.arialyy.simple.core.download.multi_download;
import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.download.DownloadGroupEntity;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arialyy.simple.download.multi_download;
package com.arialyy.simple.core.download.multi_download;
import android.content.Context;
import com.arialyy.simple.base.BaseModule;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download.multi_download;
package com.arialyy.simple.core.download.multi_download;
import android.content.Intent;
import android.os.Bundle;
@@ -33,7 +33,7 @@ import com.arialyy.frame.util.FileUtil;
import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseActivity;
import com.arialyy.simple.databinding.ActivityMultiBinding;
import com.arialyy.simple.download.DownloadModule;
import com.arialyy.simple.core.download.DownloadModule;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.download.service_download;
package com.arialyy.simple.core.download.service_download;
import android.app.NotificationManager;
import android.content.Context;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arialyy.simple.download.service_download;
package com.arialyy.simple.core.download.service_download;
import android.app.Service;
import android.content.Intent;

View File

@@ -1,4 +1,4 @@
package com.arialyy.simple.test;
package com.arialyy.simple.core.test;
import android.os.Bundle;
import android.util.Log;
@@ -8,6 +8,7 @@ import com.arialyy.aria.core.download.DTaskWrapper;
import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseActivity;
import com.arialyy.simple.databinding.ActivityTestBinding;
import com.arialyy.simple.modlue.AnyRunnModule;
/**
* Created by laoyuyu on 2018/4/13.

View File

@@ -1,15 +1,11 @@
package com.arialyy.simple.test;
package com.arialyy.simple.core.test;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import com.arialyy.annotations.Upload;
import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.common.ProtocolType;
import com.arialyy.aria.core.common.RequestEnum;
import com.arialyy.aria.core.upload.UploadTask;
import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil;
import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseActivity;

View File

@@ -1,4 +1,4 @@
package com.arialyy.simple.test;
package com.arialyy.simple.core.test;
import android.os.Bundle;
import android.os.Environment;
@@ -10,7 +10,7 @@ import com.arialyy.frame.util.show.L;
import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseActivity;
import com.arialyy.simple.databinding.ActivityTestBinding;
import com.arialyy.simple.download.group.GroupModule;
import com.arialyy.simple.core.download.group.GroupModule;
import java.util.List;
/**

View File

@@ -1,4 +1,4 @@
package com.arialyy.simple.test;
package com.arialyy.simple.core.test;
import android.os.Environment;
import android.view.View;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arialyy.simple.upload;
package com.arialyy.simple.core.upload;
import android.os.Bundle;
import android.util.Log;
@@ -22,7 +22,6 @@ import com.arialyy.annotations.Upload;
import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.upload.UploadEntity;
import com.arialyy.aria.core.upload.UploadTask;
import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil;
import com.arialyy.frame.util.FileUtil;
import com.arialyy.frame.util.show.T;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.arialyy.simple.upload;
package com.arialyy.simple.core.upload;
import android.os.Bundle;
import android.view.View;

View File

@@ -1,120 +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.simple.download;
import android.Manifest;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import com.arialyy.frame.permission.OnPermissionCallback;
import com.arialyy.frame.permission.PermissionManager;
import com.arialyy.frame.util.show.T;
import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseActivity;
import com.arialyy.simple.databinding.ActivityDownloadMeanBinding;
import com.arialyy.simple.download.fragment_download.FragmentActivity;
import com.arialyy.simple.download.multi_download.MultiTaskActivity;
import com.arialyy.simple.download.service_download.DownloadService;
/**
* Created by Lyy on 2016/10/13.
*/
public class DownloadActivity extends BaseActivity<ActivityDownloadMeanBinding> {
Button mSigleBt;
Button mMultiBt;
Button mDialogBt;
Button mPopBt;
@Override protected int setLayoutId() {
return R.layout.activity_download_mean;
}
@Override protected void init(Bundle savedInstanceState) {
super.init(savedInstanceState);
setTitle("Aria下载");
mSigleBt = getBinding().singleTask;
mMultiBt = getBinding().multiTask;
mDialogBt = getBinding().dialogTask;
mPopBt = getBinding().popTask;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
setEnable(true);
} else { //6.0处理
boolean hasPermission = PermissionManager.getInstance()
.checkPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (hasPermission) {
setEnable(true);
} else {
setEnable(false);
PermissionManager.getInstance().requestPermission(this, new OnPermissionCallback() {
@Override public void onSuccess(String... permissions) {
setEnable(true);
}
@Override public void onFail(String... permissions) {
T.showShort(DownloadActivity.this, "没有文件读写权限");
setEnable(false);
}
}, Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
}
}
private void setEnable(boolean enable) {
mSigleBt.setEnabled(enable);
mMultiBt.setEnabled(enable);
mDialogBt.setEnabled(enable);
mPopBt.setEnabled(enable);
}
public void onClick(View view) {
switch (view.getId()) {
case R.id.highest_priority:
startActivity(new Intent(this, HighestPriorityActivity.class));
break;
case R.id.service:
startService(new Intent(this, DownloadService.class));
break;
case R.id.single_task:
startActivity(new Intent(this, SingleTaskActivity.class));
break;
case R.id.multi_task:
startActivity(new Intent(this, MultiTaskActivity.class));
break;
case R.id.dialog_task:
DownloadDialog dialog = new DownloadDialog(this);
dialog.show();
//DownloadDialogFragment dialog = new DownloadDialogFragment(this);
//dialog.show(getSupportFragmentManager(), "dialog");
break;
case R.id.pop_task:
DownloadPopupWindow pop = new DownloadPopupWindow(this);
pop.showAtLocation(mRootView, Gravity.CENTER_VERTICAL, 0, 0);
break;
case R.id.fragment_task:
startActivity(new Intent(this, FragmentActivity.class));
break;
case R.id.notification:
//SimpleNotification notification = new SimpleNotification(this);
//notification.start();
break;
}
}
}

View File

@@ -1,11 +1,25 @@
package com.arialyy.simple.test;
/*
* 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.simple.modlue;
import android.content.Context;
import android.os.Environment;
import android.util.Log;
import com.arialyy.annotations.Download;
import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.common.RequestEnum;
import com.arialyy.aria.core.download.DownloadTask;
import com.arialyy.aria.util.CommonUtil;
import com.arialyy.frame.util.show.L;
@@ -62,7 +76,7 @@ public class AnyRunnModule {
L.d(TAG, "md5Code ==> " + CommonUtil.getFileMD5(new File(task.getDownloadPath())));
}
void start(String url) {
public void start(String url) {
mUrl = url;
String path = Environment.getExternalStorageDirectory().getPath() + "/mmm2.mp4";
Aria.download(this)
@@ -72,7 +86,7 @@ public class AnyRunnModule {
.start();
}
void startFtp(String url) {
public void startFtp(String url) {
mUrl = url;
Aria.download(this)
.loadFtp(url)
@@ -85,15 +99,15 @@ public class AnyRunnModule {
.start();
}
void stop(String url) {
public void stop(String url) {
Aria.download(this).load(url).stop();
}
void cancel(String url) {
public void cancel(String url) {
Aria.download(this).load(url).cancel();
}
void unRegister() {
public void unRegister() {
Aria.download(this).unRegister();
}
}

View File

@@ -0,0 +1,83 @@
/*
* 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.simple.modlue;
import android.content.Context;
import android.content.Intent;
import com.arialyy.frame.module.AbsModule;
import com.arialyy.simple.MainActivity;
import com.arialyy.simple.R;
import com.arialyy.simple.to.NormalTo;
import java.util.ArrayList;
import java.util.List;
/**
* 通用Modle块
*/
public class CommonModule extends AbsModule {
public CommonModule(Context context) {
super(context);
}
public void startNextActivity(NormalTo to, Class clazz) {
Intent intent = new Intent(getContext(), clazz);
intent.putExtra(MainActivity.KEY_MAIN_DATA, to);
getContext().startActivity(intent);
}
public List<NormalTo> getDownloadData() {
List<NormalTo> list = new ArrayList<>();
String[] titles = getContext().getResources().getStringArray(R.array.download_items);
int[] icons = new int[] {
R.drawable.ic_http,
R.drawable.ic_http_group,
R.drawable.ic_top,
R.drawable.ic_server,
R.drawable.ic_windows
};
int i = 0;
for (String title : titles) {
NormalTo to = new NormalTo();
to.icon = icons[i];
to.title = title;
i++;
list.add(to);
}
return list;
}
public List<NormalTo> getMainData() {
List<NormalTo> list = new ArrayList<>();
String[] titles = getContext().getResources().getStringArray(R.array.main_items);
int[] icons = new int[] {
R.drawable.ic_http,
R.drawable.ic_http,
R.drawable.ic_http_group,
R.drawable.ic_ftp,
R.drawable.ic_ftp_dir,
R.drawable.ic_ftp
};
int i = 0;
for (String title : titles) {
NormalTo to = new NormalTo();
to.icon = icons[i];
to.title = title;
i++;
list.add(to);
}
return list;
}
}

View File

@@ -0,0 +1,54 @@
/*
* 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.simple.to;
import android.os.Parcel;
import android.os.Parcelable;
/**
* 简单列表对象
*/
public class NormalTo implements Parcelable {
public int icon;
public String title;
@Override public int describeContents() {
return 0;
}
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.icon);
dest.writeString(this.title);
}
public NormalTo() {
}
protected NormalTo(Parcel in) {
this.icon = in.readInt();
this.title = in.readString();
}
public static final Parcelable.Creator<NormalTo> CREATOR = new Parcelable.Creator<NormalTo>() {
@Override public NormalTo createFromParcel(Parcel source) {
return new NormalTo(source);
}
@Override public NormalTo[] newArray(int size) {
return new NormalTo[size];
}
};
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/ripple_material_light">
<item android:id="@android:id/mask" android:drawable="@android:color/white" />
<item>
<selector>
<!-- <item android:drawable="@color/bg_grey" android:state_pressed="true"/> -->
<item android:drawable="@android:color/transparent"/>
</selector>
</item>
</ripple>

View File

@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M160,375.01l354.02,216q4.99,3.01 11.01,3.01l10.02,-3.01 360,-220q10.02,-4.99 10.02,-16 0,-6.02 -2.5,-10.5t-7.49,-6.5L541.06,121.02q-10.02,-6.02 -20.99,0l-360,220q-8.99,6.02 -8.99,16.99 0,4.99 2.5,9.5t6.5,7.49zM531.01,162.02l316,192.99 -322.02,196L208,358.02zM875.01,476.99l-350.02,212.99 -344,-210.02q-7.01,-4 -15.01,-2.02t-12.99,8.99q-2.02,3.01 -2.5,7.01t0.51,7.49 3.49,7.01 5.5,5.5l354.02,216q3.01,2.02 5.5,2.5t5.5,0.51q4.99,0 10.02,-3.01l360,-220q7.01,-4 8.99,-12t-2.02,-15.01q-3.01,-4.99 -7.49,-7.49t-10.02,-2.02 -9.5,3.49zM875.01,615.01l-350.02,214.02 -344,-210.02q-7.01,-4 -15.01,-2.02t-12.99,8.99q-2.02,4 -2.5,9.5t2.02,10.02 7.49,7.49l354.02,216 11.01,3.01q2.02,0 4.99,-0.51t4.99,-2.5l360,-220q7.01,-4 8.99,-12t-2.02,-15.01q-3.01,-4.99 -7.49,-7.49t-10.02,-2.02 -9.5,2.5z"/>
</vector>

View File

@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M512,442.64L148.24,78.88c-20.01,-20.01 -50.59,-19.53 -69.74,-0.38 -18.59,18.59 -18.98,50.38 0.38,69.74L442.64,512 78.88,875.76c-20.01,20.01 -19.53,50.59 -0.38,69.74 18.59,18.59 50.38,18.98 69.74,-0.38L512,581.36l363.76,363.76c20.01,20.01 50.59,19.53 69.74,0.38 18.59,-18.59 18.98,-50.38 -0.38,-69.74L581.36,512l363.76,-363.76c20.01,-20.01 19.53,-50.59 0.38,-69.74 -18.59,-18.59 -50.38,-18.98 -69.74,0.38L512,442.64z"/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M1019.25,1024L882.39,1024l-2.9,-17.39c-11.1,-66.08 -68.78,-114.17 -135.16,-112.27 -62.88,2 -116.17,49.19 -126.76,112.27l-2.9,17.39L144.21,1024v-226.93c-78.48,-10.2 -139.96,-77.18 -140.76,-157.95 -0.4,-42.89 16.2,-83.58 46.79,-114.47 25.79,-25.99 58.58,-42.29 93.97,-46.89L144.21,148.96h283.12C439.12,65.98 510.7,2.1 595.88,2.1h2.1c83.78,1 154.55,65.18 166.35,146.86h254.93v171.15l-19.99,0.8c-64.08,2.7 -116.87,53.58 -120.16,115.77 -1.7,31.69 9.7,62.68 31.89,87.27 22.99,25.29 54.38,40.09 88.27,41.69l19.89,0.9v457.47zM916.68,982.31h60.78L977.46,605.22c-37.39,-6.1 -71.48,-24.59 -97.37,-53.28 -29.79,-32.79 -44.89,-74.48 -42.69,-117.47 4,-76.88 63.98,-140.76 140.06,-153.26v-90.67L724.74,190.54l-0.5,-20.39c-1.5,-68.88 -58.38,-125.56 -126.86,-126.46 -69.98,-0.4 -128.46,55.88 -130.06,126.46l-0.4,20.39L185.9,190.54v327.5L165.1,518.05c-32.09,0 -62.38,12.7 -85.18,35.79 -22.69,22.99 -34.99,52.98 -34.69,84.68 0.7,65.08 54.48,117.97 119.86,117.97h20.79v225.63h394.38c20.09,-73.78 85.97,-127.26 162.75,-129.66 80.08,-2.7 152.46,52.38 173.65,129.86z"/>
<path android:fillColor="@color/icon_color" android:pathData="M538.79,836.16L242.08,500.75l127.26,-170.05h353.3l108.47,170.95 -292.31,334.5zM295.76,498.55l242.83,274.42 240.53,-275.22 -79.48,-125.26H390.24l-94.47,126.06z"/>
<path android:fillColor="@color/icon_color" android:pathData="M268.97,478.86h536.14v41.69H268.97z"/>
<path android:fillColor="@color/icon_color" android:pathData="M396.03,507.45l38.64,-15.65 123.44,304.86 -38.64,15.65z"/>
<path android:fillColor="@color/icon_color" android:pathData="M524.35,784.56L643.47,489.27l38.66,15.6 -119.12,295.29zM396.22,485.29l92.07,-141.31 34.93,22.76 -92.07,141.31z"/>
<path android:fillColor="@color/icon_color" android:pathData="M558.2,362.12l35.97,-21.07 85.35,145.7 -35.97,21.07z"/>
</vector>

View File

@@ -0,0 +1,6 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M643.67,570.54c-8.24,0 -13.83,0.54 -16.76,1.33v52.93c3.46,0.79 7.72,1.07 13.56,1.07 21.54,0 34.85,-10.9 34.85,-29 0,-16.48 -11.17,-26.33 -31.65,-26.33z"/>
<path android:fillColor="@color/icon_color" android:pathData="M553.31,329.84c-22.77,-22.76 -59.68,-22.76 -82.45,0L211.94,588.76c-22.77,22.77 -22.77,59.69 0,82.46L470.84,930.13c22.77,22.77 59.68,22.77 82.45,0l258.92,-258.92a58.29,58.29 0,0 0,0 -82.45l-258.91,-258.91zM417.98,574.26h-68.88v40.97h64.36v32.97h-64.36v72.08h-40.42L308.68,541.02h109.3v33.24zM572.78,575.07h-48.95v145.2h-40.41v-145.2h-48.4v-34.04h137.76v34.04zM699.25,638.09c-13.83,12.79 -34.58,18.89 -58.51,18.89 -5.32,0 -10.1,-0.26 -13.83,-1.07v64.36h-40.15L586.76,543.42c12.5,-2.13 30.06,-3.73 54.79,-3.73 24.99,0 43.08,4.8 55.05,14.63 11.44,8.78 18.88,23.67 18.88,41.23 -0,17.82 -5.58,32.7 -16.23,42.54z"/>
<path android:fillColor="@color/icon_color" android:pathData="M816.52,233.62a19.23,19.23 0,0 1,-14.22 -7.93c-41.61,-57.71 -109.39,-93.42 -181.56,-93.42 -5.23,0 -10.46,0.19 -15.69,0.55a19.19,19.19 0,0 1,-13.05 -3.93C548.31,95.28 495.07,77.06 439.28,77.06c-99.7,0 -188.06,58.43 -228.31,146.63a19.22,19.22 0,0 1,-15.11 11.08C85.63,248.56 0.07,342.84 0.07,456.74c0,100.93 67.24,186.39 159.25,214.13a102,102 0,0 1,-8.53 -40.88c0,-18.38 4.91,-35.96 13.93,-51.42 -45.2,-22 -76.51,-68.27 -76.51,-121.84 0,-74.75 60.81,-135.55 135.56,-135.55 3.78,0 7.48,0.3 11.18,0.61 21.53,1.65 41.04,-12.31 46.28,-33.2 18.24,-72.64 83.22,-123.38 158.04,-123.38 42.75,0 83.2,16.51 113.9,46.48a44.08,44.08 0,0 0,39.77 11.59,137.33 137.33,0 0,1 27.8,-2.86c52.33,0 99.07,29.41 121.97,76.78 8.05,16.65 25.64,26.57 44.06,24.68a134.18,134.18 0,0 1,13.6 -0.69c74.75,0 135.57,60.81 135.57,135.55 0,53.57 -31.31,99.83 -76.51,121.84 9.02,15.45 13.93,33.02 13.93,51.39a102.13,102.13 0,0 1,-8.54 40.91c92.02,-27.75 159.25,-113.21 159.25,-214.14 0.02,-117.92 -91.69,-214.84 -207.54,-223.14z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1199" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M479.38,472.06L479.38,506.15h-119.81v76.65h114.1v34.08h-114.1v118.05h-35.4L324.17,472.06h155.21zM681.84,472.06L681.84,506.15h-76.65v228.94L569.2,735.09L569.2,506.29h-75.78v-34.08L681.84,472.21zM804.72,472.06c54.86,0 82.07,26.62 82.07,80.02s-27.79,79.43 -82.65,79.43h-59.98v102.4h-34.82v-261.85L804.72,472.06zM744.74,598.6h57.2c13.17,0.88 26.33,-3.07 36.86,-11.12 8.63,-9.65 13.02,-22.38 12,-35.4 1.32,-12.73 -3.07,-25.6 -12,-34.82 -10.83,-8.19 -24.28,-12.29 -37.74,-11.12h-56.61l0.29,92.45zM744.74,598.6"/>
<path android:fillColor="@color/icon_color" android:pathData="M776.48,241.96l-144.97,-119.81L1057.79,122.15c37.89,-0.88 71.39,24.58 80.6,61.44v58.37L776.48,241.96zM1138.4,914.87c-4.39,25.16 -25.16,44.03 -50.61,46.08h-977.19c-25.45,-2.05 -46.23,-21.07 -50.61,-46.08L59.98,108.4c4.39,-25.16 25.16,-44.03 50.61,-46.08h355.62l282.77,239.62h389.41v612.94zM1087.78,62.32L578.41,62.32l-72.85,-59.98h-394.97C81.63,1.32 53.69,12.14 32.91,32.04 12,52.08 0.15,79.58 0,108.4v806.47c0.15,28.82 12,56.47 32.91,76.36 20.77,19.89 48.86,30.72 77.68,29.7h977.33c28.82,1.02 56.76,-9.8 77.68,-29.7 20.77,-20.04 32.62,-47.54 32.91,-76.36L1198.52,183.59c0.88,-63.34 -47.54,-116.44 -110.74,-121.27zM1087.78,62.32"/>
</vector>

View File

@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1443" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M1200.17,1023.22L349.21,1023.22c-192.4,0 -349.21,-215.37 -349.21,-406.21a348.01,348.01 0,0 1,349.21 -346.02,335.2 335.2,0 0,1 38.78,2.34C470.96,141.06 617.25,0 774.78,0a454.37,454.37 0,0 1,454.67 423.4c120.25,14.31 213.63,168.95 213.63,359.19a242.01,242.01 0,0 1,-242.91 240.62zM349.15,330.57A288.06,288.06 0,0 0,60.13 617.01c0,158.01 129.69,346.62 289.08,346.62h850.96A182.12,182.12 0,0 0,1382.89 782.6c0,-156.87 -81.95,-301.35 -182.66,-301.35a30.06,30.06 0,0 1,-30.06 -30.06A394.06,394.06 0,0 0,774.72 59.29c-142.68,0 -274.89,136.97 -344.94,260.7a29.7,29.7 0,0 1,-31.27 14.79,291.19 291.19,0 0,0 -49.3,-4.21zM1230.23,451.48zM300.63,783.5L240.5,783.5v-240.5h60.13v60.13h60.13v-60.13h60.13v240.5L360.75,783.5v-120.25L300.63,663.25v120.25zM481,603.12v-60.13h180.38v60.13h-60.13v180.38L541.13,783.5v-180.38L481,603.12zM721.51,603.12v-60.13h180.38v60.13h-60.13v180.38h-60.13v-180.38h-60.13zM1022.13,783.5h-60.13v-240.5h60.13c71.37,-0.96 127.23,-24.05 126.26,30.06 -1.86,50.26 -7.94,147.55 -66.14,150.31h-60.13v60.13zM1022.13,603.12v60.13a35.29,35.29 0,0 0,12.03 6.01q56.4,5.59 54.95,-36.08 0,-37.7 -54.95,-36.08a35.29,35.29 0,0 0,-12.03 6.01z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M193.28,478.21v94.72h102.4v-94.72h29.95v224.77h-29.44v-100.61h-102.4v100.86L163.33,703.23v-225.02zM510.21,478.21v29.18h-65.28v195.58h-29.7v-195.58h-65.79v-29.18zM679.68,478.21v29.18L614.4,507.39v195.58h-29.95v-195.58h-65.79v-29.18zM784.64,478.21c46.85,0 70.14,22.78 70.14,68.35S830.98,614.4 784.13,614.4h-51.2v87.55h-29.7v-223.74zM733.44,586.24h48.9a46.85,46.85 0,0 0,32.51 -9.47,40.19 40.19,0 0,0 10.24,-30.21 36.86,36.86 0,0 0,-10.5 -29.7,46.59 46.59,0 0,0 -32.26,-9.47h-49.15z"/>
<path android:fillColor="@color/icon_color" android:pathData="M663.55,281.6l-123.9,-102.4h364.29A69.38,69.38 0,0 1,972.8 231.68V281.6zM972.8,856.58A47.87,47.87 0,0 1,929.54 896H94.46A47.87,47.87 0,0 1,51.2 856.58V167.42A47.87,47.87 0,0 1,94.46 128h303.87L640,332.8h332.8zM929.54,128h-435.2l-62.21,-51.2H94.46A91.39,91.39 0,0 0,0 167.42v689.15A91.39,91.39 0,0 0,94.46 947.2h835.07A91.39,91.39 0,0 0,1024 856.58V231.68A102.4,102.4 0,0 0,929.54 128z"/>
</vector>

View File

@@ -0,0 +1,6 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M0,411.44l0,201.1c0,16.62 5.36,31.88 14.25,44.51l995.48,0C1018.64,644.44 1024,629.16 1024,612.56L1024,411.44c0,-16.62 -5.36,-31.88 -14.25,-44.51L14.25,366.93C5.36,379.56 0,394.84 0,411.44zM887.47,520.53c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S878.05,520.53 887.47,520.53zM853.33,469.33c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S843.91,469.33 853.33,469.33zM819.2,520.53c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S809.78,520.53 819.2,520.53zM785.07,469.33c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S775.65,469.33 785.07,469.33zM750.93,520.53c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S741.51,520.53 750.93,520.53zM716.8,469.33c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S707.38,469.33 716.8,469.33zM682.67,520.53c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S673.25,520.53 682.67,520.53zM648.53,469.33c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S639.11,469.33 648.53,469.33zM614.4,520.53c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S604.98,520.53 614.4,520.53zM580.27,469.33c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S570.85,469.33 580.27,469.33zM179.2,435.2c42.34,0 76.8,34.46 76.8,76.8s-34.46,76.8 -76.8,76.8S102.4,554.34 102.4,512 136.86,435.2 179.2,435.2z"/>
<path android:fillColor="@color/icon_color" android:pathData="M1009.75,332.8C1018.64,320.17 1024,304.9 1024,288.29L1024,87.18C1024,43.81 988.72,8.53 945.36,8.53L78.64,8.53C35.28,8.53 0,43.81 0,87.18l0,201.1c0,16.62 5.36,31.88 14.25,44.51L1009.75,332.78zM887.47,196.27c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S878.05,196.27 887.47,196.27zM853.33,145.07c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S843.91,145.07 853.33,145.07zM819.2,196.27c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S809.78,196.27 819.2,196.27zM785.07,145.07c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S775.65,145.07 785.07,145.07zM750.93,196.27c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S741.51,196.27 750.93,196.27zM716.8,145.07c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S707.38,145.07 716.8,145.07zM682.67,196.27c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S673.25,196.27 682.67,196.27zM648.53,145.07c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S639.11,145.07 648.53,145.07zM614.4,196.27c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S604.98,196.27 614.4,196.27zM580.27,145.07c9.42,0 17.07,7.65 17.07,17.07s-7.65,17.07 -17.07,17.07 -17.07,-7.65 -17.07,-17.07S570.85,145.07 580.27,145.07zM179.2,110.93c42.34,0 76.8,34.46 76.8,76.8s-34.46,76.8 -76.8,76.8S102.4,230.08 102.4,187.73 136.86,110.93 179.2,110.93z"/>
<path android:fillColor="@color/icon_color" android:pathData="M14.25,691.2C5.36,703.83 0,719.1 0,735.71l0,201.1C0,980.19 35.28,1015.47 78.64,1015.47l866.7,0c43.37,0 78.64,-35.28 78.64,-78.64L1023.98,735.71c0,-16.62 -5.36,-31.88 -14.25,-44.51L14.25,691.2zM179.2,913.07C136.86,913.07 102.4,878.61 102.4,836.27s34.46,-76.8 76.8,-76.8S256,793.92 256,836.27 221.54,913.07 179.2,913.07zM580.27,827.73c-9.42,0 -17.07,-7.65 -17.07,-17.07s7.65,-17.07 17.07,-17.07 17.07,7.65 17.07,17.07S589.69,827.73 580.27,827.73zM614.4,878.93c-9.42,0 -17.07,-7.65 -17.07,-17.07s7.65,-17.07 17.07,-17.07 17.07,7.65 17.07,17.07S623.82,878.93 614.4,878.93zM648.53,827.73c-9.42,0 -17.07,-7.65 -17.07,-17.07s7.65,-17.07 17.07,-17.07 17.07,7.65 17.07,17.07S657.95,827.73 648.53,827.73zM682.67,878.93c-9.42,0 -17.07,-7.65 -17.07,-17.07s7.65,-17.07 17.07,-17.07 17.07,7.65 17.07,17.07S692.09,878.93 682.67,878.93zM716.8,827.73c-9.42,0 -17.07,-7.65 -17.07,-17.07s7.65,-17.07 17.07,-17.07 17.07,7.65 17.07,17.07S726.22,827.73 716.8,827.73zM750.93,878.93c-9.42,0 -17.07,-7.65 -17.07,-17.07s7.65,-17.07 17.07,-17.07 17.07,7.65 17.07,17.07S760.35,878.93 750.93,878.93zM785.07,827.73c-9.42,0 -17.07,-7.65 -17.07,-17.07s7.65,-17.07 17.07,-17.07 17.07,7.65 17.07,17.07S794.49,827.73 785.07,827.73zM819.2,878.93c-9.42,0 -17.07,-7.65 -17.07,-17.07s7.65,-17.07 17.07,-17.07 17.07,7.65 17.07,17.07S828.62,878.93 819.2,878.93zM853.33,827.73c-9.42,0 -17.07,-7.65 -17.07,-17.07s7.65,-17.07 17.07,-17.07 17.07,7.65 17.07,17.07S862.75,827.73 853.33,827.73zM887.47,878.93c-9.42,0 -17.07,-7.65 -17.07,-17.07s7.65,-17.07 17.07,-17.07 17.07,7.65 17.07,17.07S896.89,878.93 887.47,878.93z"/>
</vector>

View File

@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M759.47,490.67L311.47,136.53C307.2,132.27 298.67,128 290.13,128c-17.07,0 -34.13,12.8 -34.13,25.6v712.53c0,17.07 17.07,25.6 34.13,25.6 8.53,0 17.07,-4.27 21.33,-8.53l448,-358.4c12.8,-4.27 12.8,-21.33 0,-34.13z"/>
</vector>

View File

@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M303.43,882.79H210.73c-27.81,0 -46.35,-18.54 -46.35,-46.35V187.56c0,-27.81 18.54,-46.35 46.35,-46.35h92.7c27.81,0 46.35,18.54 46.35,46.35v648.88c0,27.81 -18.54,46.35 -46.35,46.35zM813.27,882.79h-92.7c-27.81,0 -46.35,-18.54 -46.35,-46.35V187.56c0,-27.81 18.54,-46.35 46.35,-46.35h92.7c27.81,0 46.35,18.54 46.35,46.35v648.88c0,27.81 -18.54,46.35 -46.35,46.35z"/>
</vector>

View File

@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M0,347.65h83.97v438.78h141.82L225.79,347.65h83.97L309.76,238.08L0,238.08v109.57zM636.42,284.16c-14.34,-19.46 -32.77,-33.79 -55.81,-43.01 -23.04,-9.73 -49.66,-14.34 -78.34,-14.34 -30.72,0 -57.86,5.12 -80.9,15.36s-41.47,24.58 -55.3,43.52c-13.31,18.94 -21.5,39.94 -24.06,62.98 -2.56,22.53 -4.1,61.44 -4.1,116.22v93.7c0,56.32 1.54,95.74 4.1,118.27 2.56,22.53 11.26,43.52 25.09,62.46 14.34,18.94 32.77,33.79 55.81,43.01 23.04,9.73 49.66,14.34 78.85,14.34 30.72,0 57.86,-5.12 80.9,-15.36s41.47,-24.58 54.78,-43.52c13.31,-18.94 21.5,-39.94 24.06,-62.98 2.56,-23.04 4.1,-61.95 4.1,-117.25L665.6,464.9c0,-56.32 -1.54,-95.74 -4.1,-118.78 -2.56,-22.02 -10.75,-43.01 -25.09,-61.95zM524.29,630.78c0,32.26 -1.54,52.74 -4.1,61.44 -2.56,8.7 -8.7,12.8 -18.43,12.8 -9.22,0 -15.36,-3.58 -17.92,-11.26 -2.56,-7.68 -4.1,-27.14 -4.1,-58.88L479.74,378.88c0,-28.16 2.05,-45.06 6.14,-51.2 4.1,-5.63 9.73,-8.7 16.9,-8.7 8.7,0 14.34,3.58 17.41,10.75 2.56,7.17 4.1,23.55 4.1,49.15v251.9zM1018.37,315.39c-3.58,-16.38 -10.75,-30.21 -20.99,-41.98 -10.24,-11.26 -26.11,-20.48 -46.59,-26.62 -20.99,-6.14 -50.69,-9.22 -89.09,-9.22h-142.85v548.35h141.82v-220.67h37.89c31.23,0 55.81,-4.1 75.26,-12.8 18.94,-8.7 32.26,-20.99 39.42,-36.86 7.17,-15.87 10.75,-41.47 10.75,-76.8v-47.62c0,-34.3 -2.05,-59.39 -5.63,-75.78zM905.73,421.89c0,20.48 -2.56,33.79 -7.68,39.94 -5.12,6.66 -14.34,9.73 -27.14,9.73 -3.07,0 -6.66,0 -10.24,-0.51L860.67,331.78c18.43,0 30.72,3.07 36.35,8.7 5.63,5.63 8.7,17.92 8.7,36.35v45.06z"/>
</vector>

View File

@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M160,160h64v736H160zM288,160h175.23v175.23H288zM288,440.38h175.23v175.23H288zM288,720.77h175.23V896H288zM576,160h64v736h-64zM704,160h175.23v175.23H704zM704,440.38h175.23v175.23H704zM704,720.77h175.23V896H704z"/>
</vector>

View File

@@ -0,0 +1,7 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/icon_color" android:pathData="M512.82,545.87v315.45l412.98,67.77v-383.22h-412.98zM512.82,545.87z"/>
<path android:fillColor="@color/icon_color" android:pathData="M925.8,476.59v-383.21l-412.98,68.85v314.36h412.98zM925.8,476.59z"/>
<path android:fillColor="@color/icon_color" android:pathData="M443.54,476.59v-302.89l-349.11,58.24v244.65h349.11zM443.54,476.59z"/>
<path android:fillColor="@color/icon_color" android:pathData="M94.43,545.87v246.82l349.11,57.26v-304.08h-349.11zM94.43,545.87z"/>
</vector>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/bg_grey" android:state_pressed="true"/>
<item android:drawable="@android:color/transparent"/>
</selector>

View File

@@ -11,76 +11,10 @@
<include layout="@layout/layout_bar"/>
<Button
android:id="@+id/single_task"
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="单任务下载"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/multi_task"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="多任务下载"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/highest_priority"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="将任务设置为最高优先级任务"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/dialog_task"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="在dialog中使用"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/pop_task"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="在popupwindow中使用"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/fragment_task"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="在Fragment中使用"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/notification"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="在Notification中使用"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/service"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="在Service中使用"
style="?buttonBarButtonStyle"
android:layout_height="match_parent"
/>
</LinearLayout>

View File

@@ -9,7 +9,7 @@
<include layout="@layout/layout_bar"/>
<fragment
android:id="@+id/fragment1"
android:name="com.arialyy.simple.download.fragment_download.DownloadFragment"
android:name="com.arialyy.simple.core.download.fragment_download.DownloadFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>

View File

@@ -9,60 +9,10 @@
<include layout="@layout/layout_bar"/>
<Button
android:id="@+id/download"
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="http 下载"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/upload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="http 上传"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/download_task_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="http 下载任务组"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/ftp_download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="FTP 下载"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/ftp_dir_download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="FTP 文件夹下载"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/ftp_upload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="FTP 文件上传"
style="?buttonBarButtonStyle"
/>
<Button
android:id="@+id/kotlin_download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="kotlin 下载"
style="?buttonBarButtonStyle"
android:layout_height="match_parent"
/>
</LinearLayout>

View File

@@ -23,7 +23,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.arialyy.simple.download.SingleTaskActivity"
tools:context=".core.download.SingleTaskActivity"
>
<android.support.design.widget.AppBarLayout

View File

@@ -23,7 +23,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.arialyy.simple.download.SingleTaskActivity"
tools:context=".core.download.SingleTaskActivity"
tools:showIn="@layout/activity_single"
>

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:clickable="true"
android:foreground="@drawable/item_bg"
android:padding="16dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="4dp"
app:cardElevation="4dp"
app:cardMaxElevation="8dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="140dp"
android:padding="30dp"
app:srcCompat="@drawable/ic_ftp"
/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/image"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:ellipsize="marquee"
android:marqueeRepeatLimit="2"
android:singleLine="true"
android:text="qqqq"
android:textColor="@color/text_black"
android:textSize="@dimen/text_size_normal"
android:textStyle="bold"
android:layout_marginBottom="16dp"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/item_h"
android:background="@drawable/item_bg"
android:clickable="true"
android:orientation="vertical"
>
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image"
android:layout_marginLeft="16dp"
android:layout_centerVertical="true"
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
app:srcCompat="@drawable/ic_ftp"
/>
<TextView
android:layout_toRightOf="@+id/image"
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="16dp"
android:textColor="@color/colorAccent"
android:textSize="@dimen/text_size_normal"
/>
</RelativeLayout>

View File

@@ -3,5 +3,8 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="icon_color">#FF4081</color>
<color name="black">#2B2B2B</color>
<color name="text_black">#2B2B2B</color>
<color name="bg_grey">#efefef</color>
</resources>

View File

@@ -3,4 +3,16 @@
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="item_h">48dp</dimen>
<dimen name="text_size_smallest">12sp</dimen>
<dimen name="text_size_smaller">13sp</dimen>
<dimen name="text_size_small">14sp</dimen>
<dimen name="text_size_normal">15sp</dimen>
<dimen name="text_size_big">16sp</dimen>
<dimen name="text_size_bigger">17sp</dimen>
<dimen name="text_size_biggest">18sp</dimen>
<dimen name="icon_size">24dp</dimen>
</resources>

View File

@@ -1,19 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright (C) 2014 Lucas Rocha
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.
-->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="item_click_support" type="id" />
<item name="item_click_support" type="id"/>
<array name="main_icons">
<item>@drawable/ic_http</item>
<item>@drawable/ic_http</item>
<item>@drawable/ic_http</item>
<item>@drawable/ic_ftp</item>
<item>@drawable/ic_ftp_dir</item>
<item>@drawable/ic_ftp</item>
</array>
</resources>

View File

@@ -2,6 +2,23 @@
<string name="app_name">Aria</string>
<string name="action_settings">Settings</string>
<string-array name="main_items">
<item>http 下载</item>
<item>http 上传</item>
<item>http 组合任务下载</item>
<item>FTP 下载</item>
<item>FTP 文件夹下载</item>
<item>FTP 文件上传</item>
</string-array>
<string-array name="download_items">
<item>单任务下载</item>
<item>多任务下载</item>
<item>高优先级任务</item>
<item>Service中使用</item>
<item>组件中使用</item>
</string-array>
<string-array name="test_apk_download_url">
<item>http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk</item> <!--300M的文件-->
<item>http://static.gaoshouyou.com/d/21/e8/61218d78d0e8b79df68dbc18dd484c97.apk</item>