Skip to content
Permalink
Browse files

修改demo界面

  • Loading branch information...
AriaLyy committed Mar 7, 2019
1 parent 0f9f257 commit 3042d06a0e566d94adbada2e7f45c75896ca6eaa
Showing with 691 additions and 377 deletions.
  1. +1 −1 Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java
  2. +4 −1 Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java
  3. +1 −1 AriaCompiler/src/main/java/com/arialyy/compiler/EventProxyFiler.java
  4. +1 −0 app/build.gradle
  5. +13 −13 app/src/main/AndroidManifest.xml
  6. +102 −39 app/src/main/java/com/arialyy/simple/MainActivity.java
  7. +2 −2 app/src/main/java/com/arialyy/simple/base/adapter/AbsHolder.java
  8. +148 −0 app/src/main/java/com/arialyy/simple/core/download/DownloadActivity.java
  9. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/DownloadDialog.java
  10. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/DownloadDialogFragment.java
  11. +2 −2 app/src/main/java/com/arialyy/simple/{ → core}/download/DownloadModule.java
  12. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/DownloadPopupWindow.java
  13. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/FtpDownloadActivity.java
  14. +2 −2 app/src/main/java/com/arialyy/simple/{ → core}/download/HighestPriorityActivity.java
  15. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/KotlinDownloadActivity.kt
  16. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/SimpleNotification.java
  17. +1 −6 app/src/main/java/com/arialyy/simple/{ → core}/download/SingleTaskActivity.java
  18. +1 −2 app/src/main/java/com/arialyy/simple/{ → core}/download/fragment_download/DownloadFragment.java
  19. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/fragment_download/FragmentActivity.java
  20. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/group/ChildHandleDialog.java
  21. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/group/DownloadGroupActivity.java
  22. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/group/FTPDirDownloadActivity.java
  23. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/group/GroupModule.java
  24. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/multi_download/DownloadAdapter.java
  25. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/multi_download/DownloadNumDialog.java
  26. +5 −5 app/src/main/java/com/arialyy/simple/{ → core}/download/multi_download/FileListAdapter.java
  27. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/multi_download/FileListEntity.java
  28. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/multi_download/MultiDownloadActivity.java
  29. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/multi_download/MultiEntity.java
  30. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/multi_download/MultiModule.java
  31. +2 −2 app/src/main/java/com/arialyy/simple/{ → core}/download/multi_download/MultiTaskActivity.java
  32. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/service_download/DownloadNotification.java
  33. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/download/service_download/DownloadService.java
  34. +2 −1 app/src/main/java/com/arialyy/simple/{ → core}/test/AnyRunActivity.java
  35. +1 −5 app/src/main/java/com/arialyy/simple/{ → core}/test/TestFTPActivity.java
  36. +2 −2 app/src/main/java/com/arialyy/simple/{ → core}/test/TestFTPDirActivity.java
  37. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/test/TestMutilTaskSysDownload.java
  38. +1 −2 app/src/main/java/com/arialyy/simple/{ → core}/upload/FtpUploadActivity.java
  39. +1 −1 app/src/main/java/com/arialyy/simple/{ → core}/upload/HttpUploadActivity.java
  40. +0 −120 app/src/main/java/com/arialyy/simple/download/DownloadActivity.java
  41. +21 −7 app/src/main/java/com/arialyy/simple/{test → modlue}/AnyRunnModule.java
  42. +83 −0 app/src/main/java/com/arialyy/simple/modlue/CommonModule.java
  43. +54 −0 app/src/main/java/com/arialyy/simple/to/NormalTo.java
  44. +11 −0 app/src/main/res/drawable-v21/item_bg.xml
  45. +4 −0 app/src/main/res/drawable/ic_activity.xml
  46. +4 −0 app/src/main/res/drawable/ic_del.xml
  47. +9 −0 app/src/main/res/drawable/ic_fragment.xml
  48. +6 −0 app/src/main/res/drawable/ic_ftp.xml
  49. +5 −0 app/src/main/res/drawable/ic_ftp_dir.xml
  50. +4 −0 app/src/main/res/drawable/ic_http.xml
  51. +5 −0 app/src/main/res/drawable/ic_http_group.xml
  52. +6 −0 app/src/main/res/drawable/ic_server.xml
  53. +4 −0 app/src/main/res/drawable/ic_start.xml
  54. +4 −0 app/src/main/res/drawable/ic_stop.xml
  55. +4 −0 app/src/main/res/drawable/ic_top.xml
  56. +4 −0 app/src/main/res/drawable/ic_view.xml
  57. +7 −0 app/src/main/res/drawable/ic_windows.xml
  58. +7 −0 app/src/main/res/drawable/item_bg.xml
  59. +3 −69 app/src/main/res/layout/activity_download_mean.xml
  60. +1 −1 app/src/main/res/layout/activity_fragment.xml
  61. +3 −53 app/src/main/res/layout/activity_main.xml
  62. +1 −1 app/src/main/res/layout/activity_single.xml
  63. +1 −1 app/src/main/res/layout/content_single.xml
  64. +52 −0 app/src/main/res/layout/item_download.xml
  65. +32 −0 app/src/main/res/layout/item_main.xml
  66. +3 −0 app/src/main/res/values/colors.xml
  67. +12 −0 app/src/main/res/values/dimens.xml
  68. +11 −17 app/src/main/res/values/ids.xml
  69. +17 −0 app/src/main/res/values/strings.xml
  70. +1 −1 build.gradle
@@ -470,7 +470,7 @@ private void convertDb() {
continue;
}
if (record != null) {
Long temp = Long.parseLong(String.valueOf(record));
long temp = Long.parseLong(String.valueOf(record));
tRecord.startLocation = temp > 0 ? temp : 0;
} else {
tRecord.startLocation = 0;
@@ -100,7 +100,6 @@ protected AbsThreadTask(StateConstance constance, IEventListener listener,
isNotNetRetry = mAridManager.getAppConfig().isNotNetRetry();
}


/**
* 设置线程是否中断
*
@@ -269,6 +268,10 @@ protected boolean checkBlock() {
if (!blockFile.exists() || blockFile.length() != tr.blockLen) {
ALog.i(TAG, String.format("分块【%s】下载错误,即将重新下载该分块,开始位置:%s,结束位置:%s", blockFile.getName(),
tr.startLocation, tr.endLocation));
if (blockFile.exists()) {
blockFile.delete();
ALog.i(TAG, String.format("删除分块【%s】成功", blockFile.getName()));
}
retryThis(isBreak());
return false;
}
@@ -40,7 +40,7 @@
*
* <pre>
* <code>
* package com.arialyy.simple.download;
* package com.arialyy.simple.core.download;
*
* import com.arialyy.aria.core.download.DownloadTask;
* import com.arialyy.aria.core.scheduler.AbsSchedulerListener;
@@ -14,6 +14,7 @@ android {
versionCode 1
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
@@ -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>
@@ -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);
}
}
}
}
@@ -26,7 +26,7 @@
* 通用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 AbsHolder(View itemView) {
}

@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);
Oops, something went wrong.

0 comments on commit 3042d06

Please sign in to comment.
You can’t perform that action at this time.