Merge pull request #5059 from osmandapp/DownloadingNotificationTypesOfMaps

added type of map to the contentText in downloading notification
This commit is contained in:
Alexey 2018-02-27 14:21:21 +03:00 committed by GitHub
commit 0c99915e9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 6 deletions

View file

@ -127,4 +127,8 @@ public abstract class BasicProgressAsyncTask<Tag, Params, Progress, Result> exte
protected void setTag(Tag tag) {
this.tag = tag;
}
public Tag getTag() {
return tag;
}
}

View file

@ -262,11 +262,14 @@ public class DownloadFileHelper {
if(mb == 0) {
mb = 1;
}
String taskName = ctx.getString(R.string.shared_string_downloading) + " " +
StringBuilder taskName = new StringBuilder();
taskName.append(ctx.getString(R.string.shared_string_downloading)).append(": ");
//+ de.baseName /*+ " " + mb + " MB"*/;
FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName);
progress.startTask(taskName, len / 1024);
taskName.append(FileNameTranslationHelper.getFileName(ctx, ctx.getRegions(), de.baseName));
if (de.type != null) {
taskName.append(" ").append(de.type.getString(ctx));
}
progress.startTask(taskName.toString(), len / 1024);
if (!de.zipStream) {
copyFile(de, progress, fin, len, fin, de.fileToDownload);
} else if(de.urlToDownload.contains(".gz")) {

View file

@ -119,11 +119,15 @@ public class DownloadIndexesThread {
}
StringBuilder contentText = new StringBuilder();
List<IndexItem> ii = getCurrentDownloadingItems();
for(IndexItem i : ii) {
if(contentText.length() > 0) {
for (IndexItem i : ii) {
if (!isFinished && task.getTag() == i) {
continue;
}
if (contentText.length() > 0) {
contentText.append(", ");
}
contentText.append(i.getVisibleName(app, app.getRegions()));
contentText.append(" ").append(i.getType().getString(app));
}
bld.setContentTitle(msg).setSmallIcon(android.R.drawable.stat_sys_download)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)