use of org.fdroid.fdroid.AppUpdateStatusManager in project fdroidclient by f-droid.
the class AppStatusListItemController method onDismissApp.
@Override
protected void onDismissApp(@NonNull final App app, final UpdatesAdapter adapter) {
AppUpdateStatus status = getCurrentStatus();
if (status != null) {
final AppUpdateStatusManager manager = AppUpdateStatusManager.getInstance(activity);
final AppUpdateStatus appUpdateStatus = manager.get(status.getCanonicalUrl());
manager.removeApk(status.getCanonicalUrl());
switch(status.status) {
case Downloading:
cancelDownload();
Snackbar.make(itemView, R.string.app_list__dismiss_downloading_app, Snackbar.LENGTH_SHORT).show();
break;
case ReadyToInstall:
if (appUpdateStatus != null) {
Snackbar.make(itemView, R.string.app_list__dismiss_installing_app, Snackbar.LENGTH_LONG).setAction(R.string.undo, new View.OnClickListener() {
@Override
public void onClick(View view) {
manager.addApk(appUpdateStatus.apk, appUpdateStatus.status, appUpdateStatus.intent);
adapter.refreshStatuses();
}
}).show();
break;
}
}
}
adapter.refreshStatuses();
}
Aggregations