[CHAR LIMIT=25] -->
<string name="button_start_now">Start now</string>
- <!-- Short representation of download progress percentage. [CHAR LIMIT=8] -->
- <string name="download_percent"><xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g></string>
-
<!-- Title summarizing active downloads. [CHAR LIMIT=32] -->
<plurals name="notif_summary_active">
<item quantity="one">1 file downloading</item>
<string name="download_error">Unsuccessful</string>
<!-- Representation of download progress percentage when running. [CHAR LIMIT=24] -->
- <string name="download_running_percent">In progress, <xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g></string>
+ <string name="download_running_percent">In progress, <xliff:g id="percentage" example="50%">%s</xliff:g></string>
</resources>
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
+import java.text.NumberFormat;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
}
if (total > 0) {
- final int percent = (int) ((current * 100) / total);
- percentText = res.getString(R.string.download_percent, percent);
+ percentText =
+ NumberFormat.getPercentInstance().format((double) current / total);
if (speed > 0) {
final long remainingMillis = ((total - current) * 1000) / speed;
DateUtils.formatDuration(remainingMillis));
}
+ final int percent = (int) ((current * 100) / total);
builder.setProgress(100, percent, false);
} else {
builder.setProgress(100, 0, true);
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.text.NumberFormat;
/**
* Presents a {@link DocumentsContract} view of {@link DownloadManager}
final long progress = cursor.getLong(cursor.getColumnIndexOrThrow(
DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
if (size != null) {
- final long percent = progress * 100 / size;
+ String percent =
+ NumberFormat.getPercentInstance().format((double) progress / size);
summary = getContext().getString(R.string.download_running_percent, percent);
} else {
summary = getContext().getString(R.string.download_running);