Add double convert in SendFusionTablesAsyncTask and SendMapsAsyncTask, to make

the computation of update percentage is right.
This commit is contained in:
youtaol
2012-03-06 11:40:49 +08:00
parent c8e184d29c
commit b951a16364
2 changed files with 3 additions and 3 deletions
@@ -454,7 +454,7 @@ public class SendFusionTablesAsyncTask extends AbstractSendAsyncTask {
* @param total the number of total locations
*/
private void updateProgress(int uploaded, int total) {
double totalPercentage = uploaded / total;
double totalPercentage = (double) uploaded / total;
double scaledPercentage = totalPercentage
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
publishProgress((int) scaledPercentage);
@@ -472,8 +472,8 @@ public class SendMapsAsyncTask extends AbstractSendAsyncTask {
* @param total the number of total locations
*/
private void updateProgress(int uploaded, int total) {
double totalPercentage = uploaded / total;
double scaledPercentage = totalPercentage
double totalPercentage = (double) uploaded / total;
double scaledPercentage = totalPercentage
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
publishProgress((int) scaledPercentage);
}