private int mUploadType;
private Notification mNotification;
private int mTotalDataToSend, mSendData;
- private int mCurrentIndexUpload;
+ private int mCurrentIndexUpload, mPreviousPercent;
@Override
public IBinder onBind(Intent arg0) {
mAccount.name.lastIndexOf('@'));
String password = mAccountManager.getPassword(mAccount);
- mTotalDataToSend = mSendData = 0;
+ mTotalDataToSend = mSendData = mPreviousPercent = 0;
mNotification = new Notification(
eu.alefzero.owncloud.R.drawable.icon, "Uploading...",
public void OnUploadProgress(long currentProgress) {
mSendData += currentProgress;
int percent = (int)(100*mSendData/mTotalDataToSend);
- String text = String.format("%d%% Uploading %s file", percent, new File(mLocalPaths[mCurrentIndexUpload]).getName());
- mNotification.contentView.setProgressBar(R.id.status_progress, 100, percent, false);
- mNotification.contentView.setTextViewText(R.id.status_text, text);
- mNotificationManager.notify(42, mNotification);
+ if (percent != mPreviousPercent) {
+ String text = String.format("%d%% Uploading %s file", percent, new File(mLocalPaths[mCurrentIndexUpload]).getName());
+ mNotification.contentView.setProgressBar(R.id.status_progress, 100, percent, false);
+ mNotification.contentView.setTextViewText(R.id.status_text, text);
+ mNotificationManager.notify(42, mNotification);
+ }
+ mPreviousPercent = percent;
}
}