Show queued upload count only when it is > 1

This commit is contained in:
YuviPanda 2013-01-30 16:31:08 +05:30
parent 31f8aa4888
commit 420ec8061c
4 changed files with 7 additions and 6 deletions

View file

@ -77,8 +77,10 @@ public class UploadService extends IntentService {
RemoteViews curView = curNotification.contentView;
if(!notificationTitleChanged) {
curView.setTextViewText(R.id.uploadNotificationTitle, notificationProgressTitle);
curView.setTextViewText(R.id.uploadNotificationsCount, String.format(getString(R.string.uploads_pending_notification_indicator), toUpload));
Log.d("Commons", String.format("%d uploads left", toUpload));
if(toUpload != 1) {
curView.setTextViewText(R.id.uploadNotificationsCount, String.format(getString(R.string.uploads_pending_notification_indicator), toUpload));
Log.d("Commons", String.format("%d uploads left", toUpload));
}
notificationTitleChanged = true;
Intent mediaUploadStartedEvent = new Intent(INTENT_UPLOAD_STARTED);
mediaUploadStartedEvent.putExtra(EXTRA_MEDIA, media);
@ -156,7 +158,7 @@ public class UploadService extends IntentService {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
toUpload++;
if(curProgressNotification != null) {
if(curProgressNotification != null && toUpload != 1) {
curProgressNotification.contentView.setTextViewText(R.id.uploadNotificationsCount, String.format(getString(R.string.uploads_pending_notification_indicator), toUpload));
Log.d("Commons", String.format("%d uploads left", toUpload));
notificationManager.notify(NOTIFICATION_DOWNLOAD_IN_PROGRESS, curProgressNotification);