Make updates/installed final to slightly simplify code.
This commit is contained in:
parent
a2997747af
commit
ef7d8dfce9
@ -53,8 +53,8 @@ class NotificationHelper {
|
|||||||
private final NotificationManagerCompat notificationManager;
|
private final NotificationManagerCompat notificationManager;
|
||||||
private final AppUpdateStatusManager appUpdateStatusManager;
|
private final AppUpdateStatusManager appUpdateStatusManager;
|
||||||
private final DisplayImageOptions displayImageOptions;
|
private final DisplayImageOptions displayImageOptions;
|
||||||
private ArrayList<AppUpdateStatusManager.AppUpdateStatus> updates;
|
private final ArrayList<AppUpdateStatusManager.AppUpdateStatus> updates = new ArrayList<>();
|
||||||
private ArrayList<AppUpdateStatusManager.AppUpdateStatus> installed;
|
private final ArrayList<AppUpdateStatusManager.AppUpdateStatus> installed = new ArrayList<>();
|
||||||
|
|
||||||
NotificationHelper(Context context) {
|
NotificationHelper(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
@ -151,22 +151,18 @@ class NotificationHelper {
|
|||||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
|
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populate {@link NotificationHelper#updates} and {@link NotificationHelper#installed} with
|
||||||
|
* the relevant status entries from the {@link AppUpdateStatusManager}.
|
||||||
|
*/
|
||||||
private void updateStatusLists() {
|
private void updateStatusLists() {
|
||||||
if (!notificationManager.areNotificationsEnabled()) {
|
if (!notificationManager.areNotificationsEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the list of updates and installed available
|
updates.clear();
|
||||||
if (updates == null) {
|
installed.clear();
|
||||||
updates = new ArrayList<>();
|
|
||||||
} else {
|
|
||||||
updates.clear();
|
|
||||||
}
|
|
||||||
if (installed == null) {
|
|
||||||
installed = new ArrayList<>();
|
|
||||||
} else {
|
|
||||||
installed.clear();
|
|
||||||
}
|
|
||||||
for (AppUpdateStatusManager.AppUpdateStatus entry : appUpdateStatusManager.getAll()) {
|
for (AppUpdateStatusManager.AppUpdateStatus entry : appUpdateStatusManager.getAll()) {
|
||||||
if (entry.status == AppUpdateStatusManager.Status.Installed) {
|
if (entry.status == AppUpdateStatusManager.Status.Installed) {
|
||||||
installed.add(entry);
|
installed.add(entry);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user