forked from upstream-mirrors/OpenTracks
Add double convert in SendFusionTablesAsyncTask and SendMapsAsyncTask, to make
the computation of update percentage is right.
This commit is contained in:
+1
-1
@@ -454,7 +454,7 @@ public class SendFusionTablesAsyncTask extends AbstractSendAsyncTask {
|
|||||||
* @param total the number of total locations
|
* @param total the number of total locations
|
||||||
*/
|
*/
|
||||||
private void updateProgress(int uploaded, int total) {
|
private void updateProgress(int uploaded, int total) {
|
||||||
double totalPercentage = uploaded / total;
|
double totalPercentage = (double) uploaded / total;
|
||||||
double scaledPercentage = totalPercentage
|
double scaledPercentage = totalPercentage
|
||||||
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
|
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
|
||||||
publishProgress((int) scaledPercentage);
|
publishProgress((int) scaledPercentage);
|
||||||
|
|||||||
@@ -472,8 +472,8 @@ public class SendMapsAsyncTask extends AbstractSendAsyncTask {
|
|||||||
* @param total the number of total locations
|
* @param total the number of total locations
|
||||||
*/
|
*/
|
||||||
private void updateProgress(int uploaded, int total) {
|
private void updateProgress(int uploaded, int total) {
|
||||||
double totalPercentage = uploaded / total;
|
double totalPercentage = (double) uploaded / total;
|
||||||
double scaledPercentage = totalPercentage
|
double scaledPercentage = totalPercentage
|
||||||
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
|
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
|
||||||
publishProgress((int) scaledPercentage);
|
publishProgress((int) scaledPercentage);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user