Add "App X successfully installed" to updates tab.
This notification is kind of weird, because the only ways it can be dismissed is by: * Swiping a notification away from the notification drawer. * Closing and reopening F-Droid. However I think the UX is still pretty nice: * Tells the user that it worked. * Allows them to navigate to it if desired.
This commit is contained in:
parent
b179aaecff
commit
b9c429d22d
@ -253,6 +253,18 @@ public class AppListItemController extends RecyclerView.ViewHolder {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries the {@link AppUpdateStatusManager} and asks if the app was just successfully installed.
|
||||
*/
|
||||
private boolean wasSuccessfullyInstalled(@NonNull App app) {
|
||||
for (AppUpdateStatusManager.AppUpdateStatus appStatus : AppUpdateStatusManager.getInstance(activity).getByPackageName(app.packageName)) {
|
||||
if (appStatus.status == AppUpdateStatusManager.Status.Installed) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The app name {@link TextView} is used for a few reasons:
|
||||
* * Display name + summary of the app (most common).
|
||||
@ -276,6 +288,8 @@ public class AppListItemController extends RecyclerView.ViewHolder {
|
||||
}
|
||||
} else if (isDownloading(app)) {
|
||||
name.setText(activity.getString(R.string.app_list__name__downloading_in_progress, app.name));
|
||||
} else if (wasSuccessfullyInstalled(app)) {
|
||||
name.setText(activity.getString(R.string.app_list__name__successfully_installed, app.name));
|
||||
} else {
|
||||
name.setText(Utils.formatAppNameAndSummary(app.name, app.summary));
|
||||
}
|
||||
|
@ -92,8 +92,7 @@ public class UpdatesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||
|
||||
/**
|
||||
* There are some statuses managed by {@link AppUpdateStatusManager} which we don't care about
|
||||
* for the "Updates" view. For example {@link org.fdroid.fdroid.AppUpdateStatusManager.Status#Installed}
|
||||
* apps are not interesting in the Updates" view at this point in time. Also, although this
|
||||
* for the "Updates" view. For example Also, although this
|
||||
* adapter does know about apps with updates availble, it does so by querying the database not
|
||||
* by querying the app update status manager. As such, apps with the status
|
||||
* {@link org.fdroid.fdroid.AppUpdateStatusManager.Status#UpdateAvailable} are not interesting here.
|
||||
@ -101,6 +100,7 @@ public class UpdatesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||
private boolean shouldShowStatus(AppUpdateStatusManager.AppUpdateStatus status) {
|
||||
return status.status == AppUpdateStatusManager.Status.Unknown ||
|
||||
status.status == AppUpdateStatusManager.Status.Downloading ||
|
||||
status.status == AppUpdateStatusManager.Status.Installed ||
|
||||
status.status == AppUpdateStatusManager.Status.ReadyToInstall;
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,7 @@
|
||||
<string name="app_list__name__downloaded_and_ready_to_update">Update %1$s</string>
|
||||
<string name="app_list__name__downloaded_and_ready_to_install">Install %1$s</string>
|
||||
<string name="app_list__name__downloading_in_progress">Downloading %1$s</string>
|
||||
<string name="app_list__name__successfully_installed">%1$s successfully installed</string>
|
||||
<plurals name="app_list__age__released_x_days_ago">
|
||||
<item quantity="one">Released %1$d day ago</item>
|
||||
<item quantity="other">Released %1$d days ago</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user