use of org.fdroid.fdroid.data.App in project fdroidclient by f-droid.
the class AppUpdateStatusManager method createAppEntry.
private AppUpdateStatus createAppEntry(Apk apk, Status status, PendingIntent intent) {
synchronized (appMapping) {
ContentResolver resolver = context.getContentResolver();
App app = AppProvider.Helper.findSpecificApp(resolver, apk.packageName, apk.repoId);
AppUpdateStatus ret = new AppUpdateStatus(app, apk, status, intent);
appMapping.put(apk.getCanonicalUrl(), ret);
return ret;
}
}
use of org.fdroid.fdroid.data.App in project fdroidclient by f-droid.
the class UpdateService method showAppUpdatesNotification.
private void showAppUpdatesNotification(List<App> canUpdate) {
if (canUpdate.size() > 0) {
List<Apk> apksToUpdate = new ArrayList<>(canUpdate.size());
for (App app : canUpdate) {
apksToUpdate.add(ApkProvider.Helper.findSuggestedApk(this, app));
}
appUpdateStatusManager.addApks(apksToUpdate, AppUpdateStatusManager.Status.UpdateAvailable);
}
}
use of org.fdroid.fdroid.data.App in project fdroidclient by f-droid.
the class UpdateService method autoDownloadUpdates.
/**
* Queues all apps needing update. If this app itself (e.g. F-Droid) needs
* to be updated, it is queued last.
*/
public static void autoDownloadUpdates(Context context) {
List<App> canUpdate = AppProvider.Helper.findCanUpdate(context, Schema.AppMetadataTable.Cols.ALL);
String packageName = context.getPackageName();
App updateLastApp = null;
Apk updateLastApk = null;
for (App app : canUpdate) {
if (TextUtils.equals(packageName, app.packageName)) {
updateLastApp = app;
updateLastApk = ApkProvider.Helper.findSuggestedApk(context, app);
continue;
}
Apk apk = ApkProvider.Helper.findSuggestedApk(context, app);
InstallManagerService.queue(context, app, apk);
}
if (updateLastApp != null && updateLastApk != null) {
InstallManagerService.queue(context, updateLastApp, updateLastApk);
}
}
use of org.fdroid.fdroid.data.App in project fdroidclient by f-droid.
the class NotificationHelper method createInstalledNotification.
private Notification createInstalledNotification(AppUpdateStatusManager.AppUpdateStatus entry) {
App app = entry.app;
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_INSTALLS).setAutoCancel(true).setSmallIcon(R.drawable.ic_notification).setColor(ContextCompat.getColor(context, R.color.fdroid_blue)).setContentTitle(app.name).setContentText(context.getString(R.string.notification_content_single_installed)).setLocalOnly(true).setVisibility(NotificationCompat.VISIBILITY_SECRET).setContentIntent(entry.intent);
if (useStackedNotifications()) {
builder.setGroup(GROUP_INSTALLED);
}
Intent intentDeleted = new Intent(BROADCAST_NOTIFICATIONS_INSTALLED_CLEARED);
intentDeleted.putExtra(org.fdroid.fdroid.net.Downloader.EXTRA_CANONICAL_URL, entry.getCanonicalUrl());
intentDeleted.setClass(context, NotificationBroadcastReceiver.class);
PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setDeleteIntent(piDeleted);
loadLargeIconForEntry(entry, builder, NOTIFY_ID_INSTALLED, entry.getCanonicalUrl());
return builder.build();
}
use of org.fdroid.fdroid.data.App in project fdroidclient by f-droid.
the class WhatsNewAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(AppCardController holder, int position) {
cursor.moveToPosition(position);
holder.bindApp(new App(cursor));
}
Aggregations