Send an event when update are canceled
This allows to properly update the status of the application. In particular, when an update is deleted: - Cancel the associated notification, if any. - Remove the entry from the controller if the update is no longer available online. - Disable the resume button if download is partially downloaded and is no longer available online.
This commit is contained in:
@@ -81,6 +81,9 @@ public class UpdatesActivity extends AppCompatActivity {
|
||||
UpdaterController.ACTION_INSTALL_PROGRESS.equals(intent.getAction())) {
|
||||
String downloadId = intent.getStringExtra(UpdaterController.EXTRA_DOWNLOAD_ID);
|
||||
mAdapter.notifyItemChanged(downloadId);
|
||||
} else if (UpdaterController.ACTION_UPDATE_REMOVED.equals(intent.getAction())) {
|
||||
String downloadId = intent.getStringExtra(UpdaterController.EXTRA_DOWNLOAD_ID);
|
||||
mAdapter.removeItem(downloadId);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -99,6 +102,7 @@ public class UpdatesActivity extends AppCompatActivity {
|
||||
intentFilter.addAction(UpdaterController.ACTION_UPDATE_STATUS);
|
||||
intentFilter.addAction(UpdaterController.ACTION_DOWNLOAD_PROGRESS);
|
||||
intentFilter.addAction(UpdaterController.ACTION_INSTALL_PROGRESS);
|
||||
intentFilter.addAction(UpdaterController.ACTION_UPDATE_REMOVED);
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, intentFilter);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user