pull/330/head
AriaLyy 8 years ago
parent e5aa798df5
commit 5b0951c765
  1. 2
      .idea/modules.xml
  2. 4
      Aria/build.gradle
  3. 16
      Aria/src/main/java/com/arialyy/aria/core/AriaManager.java
  4. 8
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java
  5. 8
      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"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <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/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$/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$/AriaPrj.iml" filepath="$PROJECT_DIR$/AriaPrj.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />

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

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

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

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

@ -44,7 +44,7 @@ public class DownloadDialog extends AbsDialog {
@Bind(R.id.speed) TextView mSpeed; @Bind(R.id.speed) TextView mSpeed;
private static final String DOWNLOAD_URL = 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) { public DownloadDialog(Context context) {
super(context); super(context);

@ -131,7 +131,7 @@ public class DownloadPopupWindow extends AbsPopupWindow {
} else { } else {
mPb.setProgress((int) ((current * 100) / len)); 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; @Bind(R.id.speed) TextView mSpeed;
private static final String DOWNLOAD_URL = 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) { @Override protected void init(Bundle savedInstanceState) {
if (Aria.download(this).taskExists(DOWNLOAD_URL)) { if (Aria.download(this).taskExists(DOWNLOAD_URL)) {
@ -74,7 +74,6 @@ public class DownloadFragment extends AbsFragment<FragmentDownloadBinding> {
Aria.download(this) Aria.download(this)
.load(DOWNLOAD_URL) .load(DOWNLOAD_URL)
.setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/daialog.apk") .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/daialog.apk")
.setDownloadName("daialog.apk")
.start(); .start();
break; break;
case R.id.stop: case R.id.stop:

@ -31,11 +31,7 @@ import com.arialyy.frame.util.show.T;
public class DownloadService extends Service { public class DownloadService extends Service {
private static final String DOWNLOAD_URL = private static final String DOWNLOAD_URL =
//"http://kotlinlang.org/docs/kotlin-docs.pdf"; "http://rs.0.gaoshouyou.com/d/df/db/03df9eab61dbc48a5939f671f05f1cdf.apk";
//"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-";
private DownloadNotification mNotify; private DownloadNotification mNotify;
@Nullable @Override public IBinder onBind(Intent intent) { @Nullable @Override public IBinder onBind(Intent intent) {

Loading…
Cancel
Save