1.4.0608 增加爱优读
This commit is contained in:
@@ -230,8 +230,8 @@ public class GuardService extends Service {
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.e(TAG, "onStartCommand: ");
|
||||
Aria.init(this);
|
||||
Aria.download(this).register();
|
||||
Aria.download(this).resumeAllTask();
|
||||
// 绑定建立链接
|
||||
bindService(new Intent(this, StepService.class), mServiceConnection, Context.BIND_IMPORTANT);
|
||||
return START_STICKY;
|
||||
@@ -849,15 +849,20 @@ public class GuardService extends Service {
|
||||
//在这里处理任务执行中的状态,如进度进度条的刷新
|
||||
@Download.onTaskRunning
|
||||
protected void running(DownloadTask task) {
|
||||
String jsonString = task.getExtendField();
|
||||
Gson gson = new Gson();
|
||||
Type listType = new TypeToken<DownloadTaskInfo>() {
|
||||
}.getType();
|
||||
DownloadTaskInfo downloadTaskInfo = gson.fromJson(jsonString, listType);
|
||||
String app_name = downloadTaskInfo.getApp_name();
|
||||
String app_package = downloadTaskInfo.getApp_package();
|
||||
Log.e("aria", "正在下载:" + task.getPercent() + ":" + task.getExtendField());
|
||||
Toaster.show("正在下载:" + app_name + "-" + task.getPercent() + "%" + "\t" + Formatter.formatFileSize(GuardService.this, task.getSpeed()) + "/s");
|
||||
String filepath = task.getFilePath();
|
||||
if (filepath.endsWith("apk")) {
|
||||
String jsonString = task.getExtendField();
|
||||
Gson gson = new Gson();
|
||||
Type listType = new TypeToken<DownloadTaskInfo>() {
|
||||
}.getType();
|
||||
DownloadTaskInfo downloadTaskInfo = gson.fromJson(jsonString, listType);
|
||||
String app_name = downloadTaskInfo.getApp_name();
|
||||
String app_package = downloadTaskInfo.getApp_package();
|
||||
Log.e("aria", "正在下载:" + task.getPercent() + ":" + task.getExtendField());
|
||||
Toaster.show("下载启动:" + app_name + "\t" + task.getPercent() + "%");
|
||||
} else if (filepath.endsWith(".zip")) {
|
||||
Toaster.show("下载开机动画启动:" + "\t" + task.getPercent() + " % ");
|
||||
}
|
||||
}
|
||||
|
||||
@Download.onTaskComplete
|
||||
@@ -884,7 +889,7 @@ public class GuardService extends Service {
|
||||
new Thread(() -> ApkUtils.installApp(GuardService.this, filepath)).start();
|
||||
}
|
||||
} else if (filepath.endsWith(".zip")) {
|
||||
Log.e("taskComplete", "下载完成:" + task.getPercent() + ":" + task.getExtendField());
|
||||
Log.e("taskComplete", "开机动画下载完成:" + task.getPercent() + ":" + task.getExtendField());
|
||||
JGYUtils.getInstance().setBootanimationG10J(task.getFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user