aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorSam Whited <sam@samwhited.com>2015-01-17 09:10:33 -0500
committerSam Whited <sam@samwhited.com>2015-01-17 09:11:04 -0500
commitdfc1cea882b33c7bf27bca5a349377b6ed966a75 (patch)
tree24198055d980451c6ca15f4d2ca8d1ea944bddc5 /src/main
parentbe169215caa26bce5cf707ea7ce8db79da21f8e1 (diff)
Correct the download file string on notifications
Fixes #896
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/services/NotificationService.java7
-rw-r--r--src/main/java/eu/siacs/conversations/utils/UIHelper.java22
-rw-r--r--src/main/res/values-de/strings.xml1
-rw-r--r--src/main/res/values-es/strings.xml1
-rw-r--r--src/main/res/values-eu/strings.xml1
-rw-r--r--src/main/res/values-fr/strings.xml1
-rw-r--r--src/main/res/values-nl/strings.xml1
-rw-r--r--src/main/res/values/strings.xml8
8 files changed, 18 insertions, 24 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java
index efdd2b60..8c3aff16 100644
--- a/src/main/java/eu/siacs/conversations/services/NotificationService.java
+++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java
@@ -264,11 +264,8 @@ public class NotificationService {
if ((message = getFirstDownloadableMessage(messages)) != null) {
mBuilder.addAction(
R.drawable.ic_action_download,
- mXmppConnectionService.getResources().getString(
- message.getType() == Message.TYPE_IMAGE ?
- R.string.download_image :
- R.string.download_file
- ),
+ mXmppConnectionService.getResources().getString(R.string.download_x_file,
+ UIHelper.getFileDescriptionString(mXmppConnectionService, message)),
createDownloadIntent(message)
);
}
diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
index b00447a4..f468d9ae 100644
--- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
@@ -18,9 +18,9 @@ import android.util.Pair;
public class UIHelper {
private static final int SHORT_DATE_FLAGS = DateUtils.FORMAT_SHOW_DATE
- | DateUtils.FORMAT_NO_YEAR | DateUtils.FORMAT_ABBREV_ALL;
+ | DateUtils.FORMAT_NO_YEAR | DateUtils.FORMAT_ABBREV_ALL;
private static final int FULL_DATE_FLAGS = DateUtils.FORMAT_SHOW_TIME
- | DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_DATE;
+ | DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_DATE;
public static String readableTimeDifference(Context context, long time) {
return readableTimeDifference(context, time, false);
@@ -72,8 +72,8 @@ public class UIHelper {
cal1.setTime(a);
cal2.setTime(b);
return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)
- && cal1.get(Calendar.DAY_OF_YEAR) == cal2
- .get(Calendar.DAY_OF_YEAR);
+ && cal1.get(Calendar.DAY_OF_YEAR) == cal2
+ .get(Calendar.DAY_OF_YEAR);
}
public static String lastseen(Context context, long time) {
@@ -106,8 +106,8 @@ public class UIHelper {
return 0xFF202020;
}
int colors[] = {0xFFe91e63, 0xFF9c27b0, 0xFF673ab7, 0xFF3f51b5,
- 0xFF5677fc, 0xFF03a9f4, 0xFF00bcd4, 0xFF009688, 0xFFff5722,
- 0xFF795548, 0xFF607d8b};
+ 0xFF5677fc, 0xFF03a9f4, 0xFF00bcd4, 0xFF009688, 0xFFff5722,
+ 0xFF795548, 0xFF607d8b};
return colors[(int) ((name.hashCode() & 0xffffffffl) % colors.length)];
}
@@ -120,8 +120,8 @@ public class UIHelper {
case Downloadable.STATUS_DOWNLOADING:
if (message.getType() == Message.TYPE_FILE) {
return new Pair<>(context.getString(R.string.receiving_x_file,
- getFileDescriptionString(context,message),
- d.getProgress()),true);
+ getFileDescriptionString(context,message),
+ d.getProgress()),true);
} else {
return new Pair<>(context.getString(R.string.receiving_image, d.getProgress()),true);
}
@@ -129,7 +129,7 @@ public class UIHelper {
case Downloadable.STATUS_OFFER_CHECK_FILESIZE:
if (message.getType() == Message.TYPE_FILE) {
return new Pair<>(context.getString(R.string.x_file_offered_for_download,
- getFileDescriptionString(context,message)),true);
+ getFileDescriptionString(context,message)),true);
} else {
return new Pair<>(context.getString(R.string.image_offered_for_download),true);
}
@@ -153,7 +153,7 @@ public class UIHelper {
} else if (message.getType() == Message.TYPE_FILE) {
if (message.getStatus() == Message.STATUS_RECEIVED) {
return new Pair<>(context.getString(R.string.received_x_file,
- getFileDescriptionString(context, message)), true);
+ getFileDescriptionString(context, message)), true);
} else {
return new Pair<>(getFileDescriptionString(context,message),true);
}
@@ -183,6 +183,8 @@ public class UIHelper {
return context.getString(R.string.audio);
} else if(mime.startsWith("video/")) {
return context.getString(R.string.video);
+ } else if (mime.startsWith("image/")) {
+ return context.getString(R.string.image);
} else if (mime.contains("pdf")) {
return context.getString(R.string.pdf_document) ;
} else {
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index 1240da79..b81f440d 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -337,7 +337,6 @@
<string name="pref_keep_foreground_service_summary">Verhindert, dass Android die Verbindung unterbricht</string>
<string name="choose_file">Datei auswählen</string>
<string name="receiving_file">Empfange %1$s Datei (%2$d%% heruntergeladen)</string>
- <string name="download_file">Download %s Datei</string>
<string name="open_file">Öffne %s Datei</string>
<string name="sending_file">Sende (%1$d%% gesendet)</string>
<string name="preparing_file">Bereite Datei für die Übertragung vor</string>
diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml
index fba7dbc8..f792b3f7 100644
--- a/src/main/res/values-es/strings.xml
+++ b/src/main/res/values-es/strings.xml
@@ -338,7 +338,6 @@
<string name="pref_keep_foreground_service_summary">Mantener el servicio en primer plano previene que el sistema cierre la conexión</string>
<string name="choose_file">Seleccionar archivo</string>
<string name="receiving_file">Recibiendo archivo %1$s (%2$d%% completado)</string>
- <string name="download_file">Descargar archivo %s</string>
<string name="open_file">Abrir archivo %s</string>
<string name="sending_file">Enviando (%1$d%% completado)</string>
<string name="preparing_file">Preparando transferencia de archivo</string>
diff --git a/src/main/res/values-eu/strings.xml b/src/main/res/values-eu/strings.xml
index 04388f4f..a1218bb2 100644
--- a/src/main/res/values-eu/strings.xml
+++ b/src/main/res/values-eu/strings.xml
@@ -311,7 +311,6 @@
<string name="pref_keep_foreground_service_summary">Sistema eragileak zure konexioa hiltzea galarazten du</string>
<string name="choose_file">Fitxategia aukeratu</string>
<string name="receiving_file">%1$s fitxategia jasotzen (%2$d%% osatua)</string>
- <string name="download_file">%s fitxategia deskargatu</string>
<string name="open_file">%s fitxategia ireki</string>
<string name="sending_file">bidaltzen (%1$d%% osatua)</string>
<string name="preparing_file">Fitxategia transmisiorako prestatzen</string>
diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml
index daae6076..7876ef3e 100644
--- a/src/main/res/values-fr/strings.xml
+++ b/src/main/res/values-fr/strings.xml
@@ -306,7 +306,6 @@
<string name="pref_keep_foreground_service_summary">Evite que le système ferme votre connexion</string>
<string name="choose_file">Choix d\'un fichier</string>
<string name="receiving_file">Réception %1$s fichier (%2$d%% complété)</string>
-<string name="download_file">Télecharger %s fichier</string>
<string name="open_file">Ouvrir %s fichier</string>
<string name="sending_file">envoi (%1$d%% complété)</string>
<string name="preparing_file">Préparation du fichier pour l\'envoi</string>
diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml
index 91484794..965af37a 100644
--- a/src/main/res/values-nl/strings.xml
+++ b/src/main/res/values-nl/strings.xml
@@ -338,7 +338,6 @@
<string name="pref_keep_foreground_service_summary">Belet het besturingssysteem van je verbinding te onderbreken</string>
<string name="choose_file">Kies bestand</string>
<string name="receiving_file">Ontvange van %1$s bestand (%2$d%% voltooid)</string>
- <string name="download_file">Download %s bestand</string>
<string name="open_file">Open %s bestand</string>
<string name="sending_file">versturen (%1$d%% voltooid)</string>
<string name="preparing_file">Bestand klaarmaken voor versturen</string>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index e6776a60..fb6878ce 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -85,7 +85,6 @@
<string name="send_pgp_message">Send OpenPGP encrypted message</string>
<string name="your_nick_has_been_changed">Your nickname has been changed</string>
<string name="download_image">Download Image</string>
- <string name="download_file">Download File</string>
<string name="image_offered_for_download"><i>Image file offered for download</i></string>
<string name="send_unencrypted">Send unencrypted</string>
<string name="decryption_failed">Decryption failed. Maybe you don’t have the proper private key.</string>
@@ -439,9 +438,10 @@
<string name="pref_display_enter_key_summary">Change the emoticons key to an enter key</string>
<string name="audio">audio file</string>
<string name="video">video file</string>
+ <string name="image">image file</string>
<string name="pdf_document">PDF document</string>
<string name="received_x_file">Received %s</string>
- <string name="disable_foreground_service">Disable foreground service</string>
- <string name="touch_to_open_conversations">Touch to open Conversations</string>
- <string name="avatar_has_been_published">Avatar has been published!</string>
+ <string name="disable_foreground_service">Disable foreground service</string>
+ <string name="touch_to_open_conversations">Touch to open Conversations</string>
+ <string name="avatar_has_been_published">Avatar has been published!</string>
</resources>