mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Update progressbar less often
This commit is contained in:
parent
6b40125982
commit
d59b1700c8
1 changed files with 7 additions and 4 deletions
|
|
@ -36,16 +36,19 @@ public class UploadService extends IntentService {
|
||||||
private class NotificationUpdateProgressListener implements ProgressListener {
|
private class NotificationUpdateProgressListener implements ProgressListener {
|
||||||
|
|
||||||
Notification curNotification;
|
Notification curNotification;
|
||||||
|
private int lastPercent = 0;
|
||||||
public NotificationUpdateProgressListener(Notification curNotification) {
|
public NotificationUpdateProgressListener(Notification curNotification) {
|
||||||
Log.d("Commons", "Fuckity");
|
Log.d("Commons", "Fuckity");
|
||||||
this.curNotification = curNotification;
|
this.curNotification = curNotification;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onProgress(long transferred, long total) {
|
public void onProgress(long transferred, long total) {
|
||||||
double percent = (double)transferred / (double)total * 100;
|
int percent =(int) ((double)transferred / (double)total * 100);
|
||||||
Log.d("Commons", "Uploaded " + percent + "% (" + transferred + " of " + total + ")");
|
if(percent > lastPercent) {
|
||||||
curNotification.contentView.setProgressBar(R.id.uploadNotificationProgress, 100, (int)percent, false);
|
curNotification.contentView.setProgressBar(R.id.uploadNotificationProgress, 100, percent, false);
|
||||||
notificationManager.notify(NOTIFICATION_DOWNLOAD_IN_PROGRESS, curNotification);
|
notificationManager.notify(NOTIFICATION_DOWNLOAD_IN_PROGRESS, curNotification);
|
||||||
|
lastPercent = percent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue