From 5b0951c7650323da05f8c405aa15e0038d1bdc5c Mon Sep 17 00:00:00 2001 From: AriaLyy <511455842@qq.com> Date: Wed, 24 May 2017 11:26:33 +0800 Subject: [PATCH] doc --- .idea/modules.xml | 2 +- Aria/build.gradle | 4 +-- .../com/arialyy/aria/core/AriaManager.java | 24 +++++++------- .../aria/core/download/DownloadTask.java | 32 ++++++++++++------- .../arialyy/aria/core/upload/UploadTask.java | 32 ++++++++++++------- .../simple/download/DownloadDialog.java | 2 +- .../simple/download/DownloadPopupWindow.java | 2 +- .../fragment_download/DownloadFragment.java | 3 +- .../service_download/DownloadService.java | 6 +--- 9 files changed, 60 insertions(+), 47 deletions(-) diff --git a/.idea/modules.xml b/.idea/modules.xml index 5f6de159..9f4bd159 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,8 +2,8 @@ - + diff --git a/Aria/build.gradle b/Aria/build.gradle index 9eeea133..36c3b695 100644 --- a/Aria/build.gradle +++ b/Aria/build.gradle @@ -7,8 +7,8 @@ android { defaultConfig { minSdkVersion 9 targetSdkVersion 23 - versionCode 102 - versionName "3.0.3" + versionCode 310 + versionName "3.1.0" } buildTypes { release { diff --git a/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java b/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java index d9972ac1..1e4a2ed0 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java +++ b/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java @@ -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()); } } /** * 如果需要在代码中修改下载配置,请使用以下方法 - * - * @ //修改最大任务队列数 - * Aria.get(this).getDownloadConfig().setMaxTaskNum(3); - * + *
+   *   
+   *     //修改最大任务队列数
+   *     Aria.get(this).getDownloadConfig().setMaxTaskNum(3);
+   *   
+   * 
*/ public Configuration.DownloadConfig getDownloadConfig() { return mDConfig; @@ -110,10 +112,12 @@ import org.xml.sax.SAXException; /** * 如果需要在代码中修改下载配置,请使用以下方法 - * - * @ //修改最大任务队列数 - * Aria.get(this).getUploadConfig().setMaxTaskNum(3); - * + *
+   *   
+   *     //修改最大任务队列数
+   *     Aria.get(this).getUploadConfig().setMaxTaskNum(3);
+   *   
+   * 
*/ 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(); diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java index 059db183..80a99edf 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java @@ -56,13 +56,17 @@ public class DownloadTask implements ITask { /** * @return 返回原始byte速度,需要你在配置文件中配置 *
-   *   
-   *    ...
-   *    
-   *   
+   *   {@code
+   *    
+   *      
+   *        ...
+   *        
+   *      
    *
-   *  或在代码中设置
-   *  Aria.get(this).getDownloadConfig().setConvertSpeed(false);
+   *      或在代码中设置
+   *      Aria.get(this).getDownloadConfig().setConvertSpeed(false);
+   *    
+   *   }
    * 
* 才能生效 */ @@ -73,13 +77,17 @@ public class DownloadTask implements ITask { /** * @return 返回转换单位后的速度,需要你在配置文件中配置,转换完成后为:1b/s、1k/s、1m/s、1g/s、1t/s *
-   *   
-   *    ...
-   *    
-   *   
+   *   {@code
+   *    
+   *      
+   *        ...
+   *        
+   *      
    *
-   *  或在代码中设置
-   *  Aria.get(this).getDownloadConfig().setConvertSpeed(true);
+   *      或在代码中设置
+   *      Aria.get(this).getDownloadConfig().setConvertSpeed(true);
+   *    
+   *   }
    * 
* 才能生效 */ diff --git a/Aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java b/Aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java index bc5c2d76..87b05d41 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java @@ -111,13 +111,17 @@ public class UploadTask implements ITask { /** * @return 返回原始byte速度,需要你在配置文件中配置 *
-   *   
-   *    ...
-   *    
-   *   
+   *  {@code
+   *   
+   *    
+   *      ...
+   *      
+   *    
    *
-   *  或在代码中设置
-   *  Aria.get(this).getUploadConfig().setConvertSpeed(false);
+   *    或在代码中设置
+   *    Aria.get(this).getUploadConfig().setConvertSpeed(false);
+   *   
+   *  }
    * 
* 才能生效 */ @@ -128,13 +132,17 @@ public class UploadTask implements ITask { /** * @return 返回转换单位后的速度,需要你在配置文件中配置,转换完成后为:1b/s、1k/s、1m/s、1g/s、1t/s *
-   *   
-   *    ...
-   *    
-   *   
+   *   {@code
+   *   
+   *    
+   *      ...
+   *      
+   *    
    *
-   *  或在代码中设置
-   *  Aria.get(this).getUploadConfig().setConvertSpeed(true);
+   *    或在代码中设置
+   *    Aria.get(this).getUploadConfig().setConvertSpeed(true);
+   *   
+   *   }
    * 
* * 才能生效 diff --git a/app/src/main/java/com/arialyy/simple/download/DownloadDialog.java b/app/src/main/java/com/arialyy/simple/download/DownloadDialog.java index 1f18dc73..ffc5e6ef 100644 --- a/app/src/main/java/com/arialyy/simple/download/DownloadDialog.java +++ b/app/src/main/java/com/arialyy/simple/download/DownloadDialog.java @@ -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); diff --git a/app/src/main/java/com/arialyy/simple/download/DownloadPopupWindow.java b/app/src/main/java/com/arialyy/simple/download/DownloadPopupWindow.java index 450f3004..538f320d 100644 --- a/app/src/main/java/com/arialyy/simple/download/DownloadPopupWindow.java +++ b/app/src/main/java/com/arialyy/simple/download/DownloadPopupWindow.java @@ -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()); } } } diff --git a/app/src/main/java/com/arialyy/simple/download/fragment_download/DownloadFragment.java b/app/src/main/java/com/arialyy/simple/download/fragment_download/DownloadFragment.java index afb2f068..bb90e783 100644 --- a/app/src/main/java/com/arialyy/simple/download/fragment_download/DownloadFragment.java +++ b/app/src/main/java/com/arialyy/simple/download/fragment_download/DownloadFragment.java @@ -45,7 +45,7 @@ public class DownloadFragment extends AbsFragment { @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 { Aria.download(this) .load(DOWNLOAD_URL) .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/daialog.apk") - .setDownloadName("daialog.apk") .start(); break; case R.id.stop: diff --git a/app/src/main/java/com/arialyy/simple/download/service_download/DownloadService.java b/app/src/main/java/com/arialyy/simple/download/service_download/DownloadService.java index 92cc65f4..5e2038c0 100644 --- a/app/src/main/java/com/arialyy/simple/download/service_download/DownloadService.java +++ b/app/src/main/java/com/arialyy/simple/download/service_download/DownloadService.java @@ -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) {