From 8e369117bf4d903301ae7e183a8506a069ec4cd7 Mon Sep 17 00:00:00 2001 From: Gabriele M Date: Thu, 30 Nov 2017 23:41:00 +0100 Subject: [PATCH] Allow to cancel ongoing installations Change-Id: I46884b42b6e3f87fbee99a23f538cec990b3b873 --- res/drawable/ic_cancel.xml | 9 ++++++ res/values/strings.xml | 3 ++ .../lineageos/updater/UpdatesListAdapter.java | 32 ++++++++++++++++++- .../updater/controller/ABUpdateInstaller.java | 21 ++++++++++++ .../updater/controller/UpdaterService.java | 7 ++++ 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 res/drawable/ic_cancel.xml diff --git a/res/drawable/ic_cancel.xml b/res/drawable/ic_cancel.xml new file mode 100644 index 00000000..7d2b57eb --- /dev/null +++ b/res/drawable/ic_cancel.xml @@ -0,0 +1,9 @@ + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index ac154651..1171c645 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -89,6 +89,7 @@ Install update Show information Delete update + Cancel installation Delete file Delete the selected update file? @@ -97,6 +98,8 @@ You are about to upgrade to %1$s.\n\nIf you press %2$s, the device will restart itself in recovery mode to install the update.\n\nNote: This feature requires a compatible Recovery or updates will need to be installed manually. You are about to upgrade to %1$s.\n\nIf you press %2$s, the device will begin installing in the background.\n\nOnce completed, you will be prompted to reboot. + Cancel the installation? + Download URL URL Copied diff --git a/src/org/lineageos/updater/UpdatesListAdapter.java b/src/org/lineageos/updater/UpdatesListAdapter.java index 38669726..eed3b3b5 100644 --- a/src/org/lineageos/updater/UpdatesListAdapter.java +++ b/src/org/lineageos/updater/UpdatesListAdapter.java @@ -41,6 +41,7 @@ import android.widget.ProgressBar; import android.widget.TextView; import org.lineageos.updater.controller.Controller; +import org.lineageos.updater.controller.UpdaterService; import org.lineageos.updater.misc.BuildInfoUtils; import org.lineageos.updater.misc.Constants; import org.lineageos.updater.misc.PermissionsUtils; @@ -74,6 +75,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter