From 420ec8061c5ebe15ca50b35fbb5f0194347820c7 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Wed, 30 Jan 2013 16:31:08 +0530 Subject: [PATCH] Show queued upload count only when it is > 1 --- commons/res/layout/layout_upload_progress.xml | 1 - commons/res/values/strings.xml | 2 +- commons/res/values/styles.xml | 2 +- .../main/java/org/wikimedia/commons/UploadService.java | 8 +++++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/commons/res/layout/layout_upload_progress.xml b/commons/res/layout/layout_upload_progress.xml index 73510b593..37d244233 100644 --- a/commons/res/layout/layout_upload_progress.xml +++ b/commons/res/layout/layout_upload_progress.xml @@ -51,7 +51,6 @@ android:layout_width="wrap_content" android:singleLine="true" android:focusable="true" - android:text="1 left" android:focusableInTouchMode="true" style="@style/NotificationText" android:layout_marginLeft="8dp" diff --git a/commons/res/values/strings.xml b/commons/res/values/strings.xml index 924c7cdc6..7daa773e0 100644 --- a/commons/res/values/strings.xml +++ b/commons/res/values/strings.xml @@ -28,7 +28,7 @@ Finishing uploading %1$s Uploading %1$s failed Tap to retry - %d + %d left Starting %1$s Transcoding Transcoding %1$s diff --git a/commons/res/values/styles.xml b/commons/res/values/styles.xml index 786419252..bdfd308eb 100644 --- a/commons/res/values/styles.xml +++ b/commons/res/values/styles.xml @@ -6,7 +6,7 @@ true - diff --git a/commons/src/main/java/org/wikimedia/commons/UploadService.java b/commons/src/main/java/org/wikimedia/commons/UploadService.java index f8b4cb97e..bbf2a2169 100644 --- a/commons/src/main/java/org/wikimedia/commons/UploadService.java +++ b/commons/src/main/java/org/wikimedia/commons/UploadService.java @@ -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);