..
This commit is contained in:
@ -18,11 +18,8 @@ package com.arialyy.simple;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import butterknife.Bind;
|
||||
import butterknife.OnClick;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.simple.base.BaseActivity;
|
||||
import com.arialyy.simple.databinding.ActivityMainBinding;
|
||||
import com.arialyy.simple.download.DownloadActivity;
|
||||
@ -45,15 +42,20 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> {
|
||||
return R.layout.activity_main;
|
||||
}
|
||||
|
||||
@OnClick(R.id.download) public void downloadDemo() {
|
||||
startActivity(new Intent(this, DownloadActivity.class));
|
||||
}
|
||||
|
||||
@OnClick(R.id.upload) public void uploadDemo() {
|
||||
startActivity(new Intent(this, UploadActivity.class));
|
||||
}
|
||||
@OnClick({R.id.download, R.id.upload, R.id.download_task_group})
|
||||
public void funcation(View view){
|
||||
switch (view.getId()){
|
||||
case R.id.download:
|
||||
startActivity(new Intent(this, DownloadActivity.class));
|
||||
break;
|
||||
case R.id.upload:
|
||||
startActivity(new Intent(this, UploadActivity.class));
|
||||
break;
|
||||
case R.id.download_task_group:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@OnClick(R.id.multi_test) public void mutliTest() {
|
||||
startActivity(new Intent(this, TestMutilTaskSysDownload.class));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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.group;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
import butterknife.Bind;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadTask;
|
||||
import com.arialyy.aria.core.scheduler.AbsSchedulerListener;
|
||||
import com.arialyy.simple.R;
|
||||
import com.arialyy.simple.base.BaseActivity;
|
||||
import com.arialyy.simple.databinding.ActivityDownloadGroupBinding;
|
||||
import com.arialyy.simple.widget.HorizontalProgressBarWithNumber;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Aria.Lao on 2017/7/6.
|
||||
*/
|
||||
public class DownloadGroupActivity extends BaseActivity<ActivityDownloadGroupBinding> {
|
||||
|
||||
@Bind(R.id.progressBar) HorizontalProgressBarWithNumber mPb;
|
||||
@Bind(R.id.start) Button mStart;
|
||||
@Bind(R.id.stop) Button mStop;
|
||||
@Bind(R.id.cancel) Button mCancel;
|
||||
@Bind(R.id.size) TextView mSize;
|
||||
@Bind(R.id.speed) TextView mSpeed;
|
||||
List<String> mUrls;
|
||||
|
||||
@Override protected void init(Bundle savedInstanceState) {
|
||||
super.init(savedInstanceState);
|
||||
setTitle("任务组");
|
||||
mUrls = getModule(GroupModule.class).getUrls();
|
||||
}
|
||||
|
||||
@Override protected int setLayoutId() {
|
||||
return R.layout.activity_download_group;
|
||||
}
|
||||
|
||||
@Override protected void onResume() {
|
||||
super.onResume();
|
||||
//Aria.download(this).addSchedulerListener(new AbsSchedulerListener<DownloadTask>() {
|
||||
//
|
||||
//});
|
||||
}
|
||||
|
||||
//public void onClick(View view) {
|
||||
// switch (view.getId()) {
|
||||
// case R.id.start:
|
||||
// String text = ((TextView) view).getText().toString();
|
||||
// if (text.equals("重新开始?") || text.equals("开始")) {
|
||||
// Aria.download(this)
|
||||
// .load(mUrls)
|
||||
// .setDownloadPaths()
|
||||
// .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/test.apk")
|
||||
// .start();
|
||||
// } else if (text.equals("恢复")) {
|
||||
// Aria.download(this).load(DOWNLOAD_URL).resume();
|
||||
// }
|
||||
// break;
|
||||
// case R.id.stop:
|
||||
// Aria.download(this).load(DOWNLOAD_URL).pause();
|
||||
// break;
|
||||
// case R.id.cancel:
|
||||
// Aria.download(this).load(DOWNLOAD_URL).cancel();
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.group;
|
||||
|
||||
import android.content.Context;
|
||||
import com.arialyy.simple.R;
|
||||
import com.arialyy.simple.base.BaseModule;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Aria.Lao on 2017/7/6.
|
||||
*/
|
||||
public class GroupModule extends BaseModule {
|
||||
public GroupModule(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
List<String> getUrls() {
|
||||
List<String> urls = new ArrayList<>();
|
||||
String[] str = getContext().getResources().getStringArray(R.array.download_url);
|
||||
Collections.addAll(urls, str);
|
||||
return urls;
|
||||
}
|
||||
|
||||
//List<String> convertPath(List<String> urls){
|
||||
// List<String> paths = new ArrayList<>();
|
||||
//
|
||||
// for (String url : urls){
|
||||
//
|
||||
// }
|
||||
//}
|
||||
}
|
Reference in New Issue
Block a user