|
|
@@ -416,10 +416,6 @@ public class DownloadService extends Service {
|
|
|
Intent din = new Intent(SheepApp.getInstance(), DownloadService.class).putExtra("download_id", id).putExtra("download_url", task.getUrl());
|
|
|
PendingIntent delIntent = PendingIntent.getService(SheepApp.getInstance(), 0, din, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
view.setOnClickPendingIntent(R.id.delete_btn, delIntent);
|
|
|
-
|
|
|
- Intent iin = new Intent(SheepApp.getInstance(), DownloadService.class).putExtra("install_path", task.getFile().getAbsolutePath()).putExtra("download_url", task.getUrl());
|
|
|
- PendingIntent installIntent = PendingIntent.getService(SheepApp.getInstance(), 0, iin, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
- view.setOnClickPendingIntent(R.id.body_view, installIntent);
|
|
|
}
|
|
|
|
|
|
public void refreshProgress(long offset) {
|
|
|
@@ -428,6 +424,9 @@ public class DownloadService extends Service {
|
|
|
if (progress == 100) {
|
|
|
view.setTextViewText(R.id.title_view, SheepApp.getInstance().getString(R.string.app_name) + "下载完成");
|
|
|
completed = true;
|
|
|
+ Intent iin = new Intent(SheepApp.getInstance(), DownloadService.class).putExtra("install_path", task.getFile().getAbsolutePath()).putExtra("download_url", task.getUrl());
|
|
|
+ PendingIntent installIntent = PendingIntent.getService(SheepApp.getInstance(), 0, iin, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
+ view.setOnClickPendingIntent(R.id.title_view, installIntent);
|
|
|
}
|
|
|
notificationManager.notify(id, notification);
|
|
|
}
|
|
|
@@ -440,6 +439,7 @@ public class DownloadService extends Service {
|
|
|
}
|
|
|
|
|
|
public static void install(String url, String path) {
|
|
|
+ LogUtil.logE("Download install path: " + path);
|
|
|
DownloadNotification notification = notificationMap.get(url);
|
|
|
if (notification != null && notification.completed) {
|
|
|
notificationMap.remove(url);
|
|
|
@@ -448,21 +448,24 @@ public class DownloadService extends Service {
|
|
|
if (nMgr != null) {
|
|
|
nMgr.cancel(notification.id);
|
|
|
}
|
|
|
- LogUtil.logE("Download install path: " + path);
|
|
|
ApkUtils.installApk(SheepApp.getInstance(), path);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static void delete(String url) {
|
|
|
+ LogUtil.logE("Download delete url: " + url);
|
|
|
DownloadNotification notification = notificationMap.get(url);
|
|
|
if (notification != null) {
|
|
|
+ LogUtil.logE("Download delete entity");
|
|
|
notificationMap.remove(url);
|
|
|
notification.task.cancel();
|
|
|
if (notification.task.getFile().exists()) {
|
|
|
+ LogUtil.logE("Download delete file");
|
|
|
notification.task.getFile().delete();
|
|
|
}
|
|
|
NotificationManager nMgr = (NotificationManager) SheepApp.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
|
|
|
if (nMgr != null) {
|
|
|
+ LogUtil.logE("Download delete notification");
|
|
|
nMgr.cancel(notification.id);
|
|
|
}
|
|
|
}
|