pull/330/head
AriaLyy 8 years ago
parent e5aa798df5
commit 5b0951c765
  1. 2
      .idea/modules.xml
  2. 4
      Aria/build.gradle
  3. 24
      Aria/src/main/java/com/arialyy/aria/core/AriaManager.java
  4. 32
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java
  5. 32
      Aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java
  6. 2
      app/src/main/java/com/arialyy/simple/download/DownloadDialog.java
  7. 2
      app/src/main/java/com/arialyy/simple/download/DownloadPopupWindow.java
  8. 3
      app/src/main/java/com/arialyy/simple/download/fragment_download/DownloadFragment.java
  9. 6
      app/src/main/java/com/arialyy/simple/download/service_download/DownloadService.java

@ -2,8 +2,8 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Aria.iml" filepath="$PROJECT_DIR$/Aria.iml" />
<module fileurl="file://$PROJECT_DIR$/Aria/Aria.iml" filepath="$PROJECT_DIR$/Aria/Aria.iml" />
<module fileurl="file://$PROJECT_DIR$/Aria.iml" filepath="$PROJECT_DIR$/Aria.iml" />
<module fileurl="file://$PROJECT_DIR$/Aria/Aria-Aria.iml" filepath="$PROJECT_DIR$/Aria/Aria-Aria.iml" />
<module fileurl="file://$PROJECT_DIR$/AriaPrj.iml" filepath="$PROJECT_DIR$/AriaPrj.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />

@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 9
targetSdkVersion 23
versionCode 102
versionName "3.0.3"
versionCode 310
versionName "3.1.0"
}
buildTypes {
release {

@ -93,16 +93,18 @@ import org.xml.sax.SAXException;
SAXParser parser = factory.newSAXParser();
parser.parse(APP.getAssets().open("aria_config.xml"), helper);
} catch (ParserConfigurationException | IOException | SAXException e) {
Log.d(TAG, e.toString());
Log.e(TAG, e.toString());
}
}
/**
* 如果需要在代码中修改下载配置请使用以下方法
*
* @<code> //修改最大任务队列数
* Aria.get(this).getDownloadConfig().setMaxTaskNum(3);
* </code>
* <pre>
* <code>
* //修改最大任务队列数
* Aria.get(this).getDownloadConfig().setMaxTaskNum(3);
* </code>
* </pre>
*/
public Configuration.DownloadConfig getDownloadConfig() {
return mDConfig;
@ -110,10 +112,12 @@ import org.xml.sax.SAXException;
/**
* 如果需要在代码中修改下载配置请使用以下方法
*
* @<code> //修改最大任务队列数
* Aria.get(this).getUploadConfig().setMaxTaskNum(3);
* </code>
* <pre>
* <code>
* //修改最大任务队列数
* Aria.get(this).getUploadConfig().setMaxTaskNum(3);
* </code>
* </pre>
*/
public Configuration.UploadConfig getUploadConfig() {
return mUConfig;
@ -242,8 +246,6 @@ import org.xml.sax.SAXException;
* 初始化配置文件
*/
private void initConfig() {
//File dFile = new File(APP.getFilesDir().getPath() + Configuration.DOWNLOAD_CONFIG_FILE);
//File uFile = new File(APP.getFilesDir().getPath() + Configuration.UPLOAD_CONFIG_FILE);
File xmlFile = new File(APP.getFilesDir().getPath() + Configuration.XML_FILE);
if (!xmlFile.exists()) {
loadConfig();

@ -56,13 +56,17 @@ public class DownloadTask implements ITask {
/**
* @return 返回原始byte速度需要你在配置文件中配置
* <pre>
* <download>
* ...
* <convertSpeed value="false"/>
* </download>
* {@code
* <xml>
* <download>
* ...
* <convertSpeed value="false"/>
* </download>
*
* 或在代码中设置
* Aria.get(this).getDownloadConfig().setConvertSpeed(false);
* 或在代码中设置
* Aria.get(this).getDownloadConfig().setConvertSpeed(false);
* </xml>
* }
* </pre>
* 才能生效
*/
@ -73,13 +77,17 @@ public class DownloadTask implements ITask {
/**
* @return 返回转换单位后的速度需要你在配置文件中配置转换完成后为1b/s1k/s1m/s1g/s1t/s
* <pre>
* <download>
* ...
* <convertSpeed value="true"/>
* </download>
* {@code
* <xml>
* <download>
* ...
* <convertSpeed value="true"/>
* </download>
*
* 或在代码中设置
* Aria.get(this).getDownloadConfig().setConvertSpeed(true);
* 或在代码中设置
* Aria.get(this).getDownloadConfig().setConvertSpeed(true);
* </xml>
* }
* </pre>
* 才能生效
*/

@ -111,13 +111,17 @@ public class UploadTask implements ITask {
/**
* @return 返回原始byte速度需要你在配置文件中配置
* <pre>
* <upload>
* ...
* <convertSpeed value="false"/>
* </upload>
* {@code
* <xml>
* <upload>
* ...
* <convertSpeed value="false"/>
* </upload>
*
* 或在代码中设置
* Aria.get(this).getUploadConfig().setConvertSpeed(false);
* 或在代码中设置
* Aria.get(this).getUploadConfig().setConvertSpeed(false);
* </xml>
* }
* </pre>
* 才能生效
*/
@ -128,13 +132,17 @@ public class UploadTask implements ITask {
/**
* @return 返回转换单位后的速度需要你在配置文件中配置转换完成后为1b/s1k/s1m/s1g/s1t/s
* <pre>
* <upload>
* ...
* <convertSpeed value="true"/>
* </upload>
* {@code
* <xml>
* <upload>
* ...
* <convertSpeed value="true"/>
* </upload>
*
* 或在代码中设置
* Aria.get(this).getUploadConfig().setConvertSpeed(true);
* 或在代码中设置
* Aria.get(this).getUploadConfig().setConvertSpeed(true);
* </xml>
* }
* </pre>
*
* 才能生效

@ -44,7 +44,7 @@ public class DownloadDialog extends AbsDialog {
@Bind(R.id.speed) TextView mSpeed;
private static final String DOWNLOAD_URL =
"http://static.gaoshouyou.com/d/3a/93/573ae1db9493a801c24bf66128b11e39.apk";
"http://clashroyalecdn.static.kunlun.com/Clash_Royale-1.2.6-kunlun_landing_page-release.apk.apk";
public DownloadDialog(Context context) {
super(context);

@ -131,7 +131,7 @@ public class DownloadPopupWindow extends AbsPopupWindow {
} else {
mPb.setProgress((int) ((current * 100) / len));
}
mSpeed.setText(CommonUtil.formatFileSize(task.getSpeed()) + "/s");
mSpeed.setText(task.getConvertSpeed());
}
}
}

@ -45,7 +45,7 @@ public class DownloadFragment extends AbsFragment<FragmentDownloadBinding> {
@Bind(R.id.speed) TextView mSpeed;
private static final String DOWNLOAD_URL =
"http://static.gaoshouyou.com/d/3a/93/573ae1db9493a801c24bf66128b11e39.apk";
"http://rs.0.gaoshouyou.com/d/90/d7/7490c6fd6cd733bef336e766778507c5.apk";
@Override protected void init(Bundle savedInstanceState) {
if (Aria.download(this).taskExists(DOWNLOAD_URL)) {
@ -74,7 +74,6 @@ public class DownloadFragment extends AbsFragment<FragmentDownloadBinding> {
Aria.download(this)
.load(DOWNLOAD_URL)
.setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/daialog.apk")
.setDownloadName("daialog.apk")
.start();
break;
case R.id.stop:

@ -31,11 +31,7 @@ import com.arialyy.frame.util.show.T;
public class DownloadService extends Service {
private static final String DOWNLOAD_URL =
//"http://kotlinlang.org/docs/kotlin-docs.pdf";
//"https://atom-installer.github.com/v1.13.0/AtomSetup.exe?s=1484074138&ext=.exe";
//"http://static.gaoshouyou.com/d/21/e8/61218d78d0e8b79df68dbc18dd484c97.apk";
//不支持断点的链接
"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-";
"http://rs.0.gaoshouyou.com/d/df/db/03df9eab61dbc48a5939f671f05f1cdf.apk";
private DownloadNotification mNotify;
@Nullable @Override public IBinder onBind(Intent intent) {

Loading…
Cancel
Save