Report progress correctly

Was previously sending an indeterminate progress event, when we actually knew
how long was remaining.
This commit is contained in:
Peter Serwylo 2017-07-03 09:03:28 +10:00
parent b7a20bbf01
commit 3d195c9dc0

View File

@ -537,12 +537,12 @@ public class UpdateService extends IntentService {
*/ */
public static void reportProcessingAppsProgress(Context context, RepoUpdater updater, int appsSaved, int totalApps) { public static void reportProcessingAppsProgress(Context context, RepoUpdater updater, int appsSaved, int totalApps) {
Utils.debugLog(TAG, "Committing " + updater.indexUrl + "(" + appsSaved + "/" + totalApps + ")"); Utils.debugLog(TAG, "Committing " + updater.indexUrl + "(" + appsSaved + "/" + totalApps + ")");
String message;
if (totalApps > 0) { if (totalApps > 0) {
message = context.getString(R.string.status_inserting_x_apps, appsSaved, totalApps, updater.indexUrl); String message = context.getString(R.string.status_inserting_x_apps, appsSaved, totalApps, updater.indexUrl);
sendStatus(context, STATUS_INFO, message, (int) ((double) appsSaved / totalApps * 100));
} else { } else {
message = context.getString(R.string.status_inserting_apps); String message = context.getString(R.string.status_inserting_apps);
}
sendStatus(context, STATUS_INFO, message); sendStatus(context, STATUS_INFO, message);
} }
}
} }