fix int overflow
This commit is contained in:
parent
d80f589b01
commit
216695285a
@ -387,12 +387,12 @@ public class AppDetailsRecyclerViewAdapter
|
|||||||
progressLabel.setContentDescription(context.getString(R.string.downloading));
|
progressLabel.setContentDescription(context.getString(R.string.downloading));
|
||||||
progressPercent.setText("");
|
progressPercent.setText("");
|
||||||
} else if (totalBytes > 0 && bytesDownloaded >= 0) {
|
} else if (totalBytes > 0 && bytesDownloaded >= 0) {
|
||||||
float percent = bytesDownloaded * 100 / totalBytes;
|
float percent = (float) bytesDownloaded / totalBytes;
|
||||||
progressLabel.setText(Utils.getFriendlySize(bytesDownloaded) + " / " + Utils.getFriendlySize(totalBytes));
|
progressLabel.setText(Utils.getFriendlySize(bytesDownloaded) + " / " + Utils.getFriendlySize(totalBytes));
|
||||||
progressLabel.setContentDescription(context.getString(R.string.app__tts__downloading_progress, (int) percent));
|
progressLabel.setContentDescription(context.getString(R.string.app__tts__downloading_progress, (int) percent));
|
||||||
NumberFormat format = NumberFormat.getPercentInstance();
|
NumberFormat format = NumberFormat.getPercentInstance();
|
||||||
format.setMaximumFractionDigits(0);
|
format.setMaximumFractionDigits(0);
|
||||||
progressPercent.setText(format.format(percent / 100));
|
progressPercent.setText(format.format(percent));
|
||||||
} else if (bytesDownloaded >= 0) {
|
} else if (bytesDownloaded >= 0) {
|
||||||
progressLabel.setText(Utils.getFriendlySize(bytesDownloaded));
|
progressLabel.setText(Utils.getFriendlySize(bytesDownloaded));
|
||||||
progressLabel.setContentDescription(context.getString(R.string.downloading));
|
progressLabel.setContentDescription(context.getString(R.string.downloading));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user