Search in sources :

Example 1 with UpdateableApp

use of org.fdroid.fdroid.views.updates.items.UpdateableApp in project fdroidclient by f-droid.

the class UpdatesAdapter method onCanUpdateLoadFinished.

private void onCanUpdateLoadFinished(Cursor cursor) {
    updateableApps.clear();
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        updateableApps.add(new UpdateableApp(activity, new App(cursor)));
        cursor.moveToNext();
    }
}
Also used : KnownVulnApp(org.fdroid.fdroid.views.updates.items.KnownVulnApp) UpdateableApp(org.fdroid.fdroid.views.updates.items.UpdateableApp) App(org.fdroid.fdroid.data.App) UpdateableApp(org.fdroid.fdroid.views.updates.items.UpdateableApp)

Example 2 with UpdateableApp

use of org.fdroid.fdroid.views.updates.items.UpdateableApp in project fdroidclient by f-droid.

the class UpdatesAdapter method populateItems.

/**
 * Completely rebuilds the underlying data structure used by this adapter. Note however, that
 * this does not notify the recycler view of any changes. Thus, it is up to other methods which
 * initiate a call to this method to make sure they appropriately notify the recyler view.
 */
private void populateItems() {
    items.clear();
    Set<String> toShowStatusPackageNames = new HashSet<>(appsToShowStatus.size());
    for (AppStatus app : appsToShowStatus) {
        toShowStatusPackageNames.add(app.status.app.packageName);
        items.add(app);
    }
    if (updateableApps != null) {
        // Only count/show apps which are not shown above in the "Apps to show status" list.
        List<UpdateableApp> updateableAppsToShow = new ArrayList<>(updateableApps.size());
        for (UpdateableApp app : updateableApps) {
            if (!toShowStatusPackageNames.contains(app.app.packageName)) {
                updateableAppsToShow.add(app);
            }
        }
        if (updateableAppsToShow.size() > 0) {
            items.add(new UpdateableAppsHeader(activity, this, updateableAppsToShow));
            if (showAllUpdateableApps) {
                items.addAll(updateableAppsToShow);
            }
        }
    }
    items.addAll(knownVulnApps);
}
Also used : AppStatus(org.fdroid.fdroid.views.updates.items.AppStatus) ArrayList(java.util.ArrayList) UpdateableApp(org.fdroid.fdroid.views.updates.items.UpdateableApp) UpdateableAppsHeader(org.fdroid.fdroid.views.updates.items.UpdateableAppsHeader) HashSet(java.util.HashSet)

Aggregations

UpdateableApp (org.fdroid.fdroid.views.updates.items.UpdateableApp)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 App (org.fdroid.fdroid.data.App)1 AppStatus (org.fdroid.fdroid.views.updates.items.AppStatus)1 KnownVulnApp (org.fdroid.fdroid.views.updates.items.KnownVulnApp)1 UpdateableAppsHeader (org.fdroid.fdroid.views.updates.items.UpdateableAppsHeader)1