[Android] res: Improve the error message of the ringtone
Edward Wang
git at videolan.org
Wed Jan 23 01:24:16 CET 2013
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Tue Jan 22 18:53:15 2013 -0500| [de4f450c08bd5531c28bb7f5cfe42240ef064772] | committer: Edward Wang
res: Improve the error message of the ringtone
Make it a bit clear what failed, and minor orthography correction
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=de4f450c08bd5531c28bb7f5cfe42240ef064772
---
vlc-android/res/values-fr/strings.xml | 4 +---
vlc-android/res/values/strings.xml | 6 ++----
.../src/org/videolan/vlc/gui/audio/AudioUtil.java | 22 ++++++++++----------
3 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/vlc-android/res/values-fr/strings.xml b/vlc-android/res/values-fr/strings.xml
index 8b28a9c..fc32791 100644
--- a/vlc-android/res/values-fr/strings.xml
+++ b/vlc-android/res/values-fr/strings.xml
@@ -27,6 +27,7 @@
<string name="info">Information</string>
<string name="confirm_delete">Supprimer le média \'%1$s\' ?</string>
<string name="ringtone_set"> \'%1$s\' est maintenant votre sonnerie.</string>
+ <string name="ringtone_error">Pendant que la sonnerie s\'est mis, une erreur est survenue.</string>
<string name="pause">Pause</string>
<string name="not_show_again">Ne plus afficher ce message.</string>
<string name="beta_warning">Ceci est une version bêta.\n\nCette version est INSTABLE !\n\nN\'utiliser que si vous êtes sûr de vous.\n\nCela pourrait tuer votre chat ou détruire votre maison !\n\n Amusez-vous bien ;)</string>
@@ -35,9 +36,6 @@
<string name="unknown_album">Album inconnu</string>
<string name="unknown_genre">Genre inconnu</string>
<string name="songs">Chansons</string>
-
- <string name="error_generic">Désolé, une erreur est survenue…</string>
-
<plurals name="songs_quantity">
<item quantity="one">1 chanson</item>
<item quantity="other">%d chansons</item>
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index e21d667..94c1795 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -30,7 +30,8 @@
<string name="set_song">Set as ringtone</string>
<string name="info">Information</string>
<string name="confirm_delete">Delete the file \'%1$s\' ?</string>
- <string name="ringtone_set"> \'%1$s\' is correctly set as your ringtone.</string>
+ <string name="ringtone_set">\'%1$s\' was set as the ringtone.</string>
+ <string name="ringtone_error">An error occurred while setting the ringtone.</string>
<string name="pause">Pause</string>
<string name="not_show_again">"Don't show this message again."</string>
<string name="beta_warning">This is a beta version.\n\nThis version is NOT STABLE!\n\nDo NOT use, unless you know what you are doing.\n\nIt might kill your kitten and destroy your house.\nUse it at your own risk.\n\nHave Fun! :)</string>
@@ -39,9 +40,6 @@
<string name="unknown_album">Unknown Album</string>
<string name="unknown_genre">Unknown Genre</string>
<string name="songs">Songs</string>
-
- <string name="error_generic">Sorry, a error has occurred…</string>
-
<plurals name="songs_quantity">
<item quantity="one">1 song</item>
<item quantity="other">%d songs</item>
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
index 7274a34..bf3ad07 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
@@ -53,7 +53,6 @@ import android.util.Log;
import android.widget.Toast;
public class AudioUtil {
-
public final static String TAG = "VLC/AudioUtil";
public static String CACHE_DIR = null;
@@ -61,8 +60,8 @@ public class AudioUtil {
public static void setRingtone( Media song, Activity activity){
File newringtone = Util.URItoFile(song.getLocation());
- if (!newringtone.exists()) {
- Toast.makeText(activity.getApplicationContext(),activity.getString(R.string.error_generic), Toast.LENGTH_SHORT).show();
+ if(!newringtone.exists()) {
+ Toast.makeText(activity.getApplicationContext(),activity.getString(R.string.ringtone_error), Toast.LENGTH_SHORT).show();
return;
}
@@ -81,17 +80,18 @@ public class AudioUtil {
try {
activity.getContentResolver().delete(uri, MediaStore.MediaColumns.DATA + "=\"" + newringtone.getAbsolutePath() + "\"", null);
newUri = activity.getContentResolver().insert(uri, values);
- } catch (Exception e) {
- e.printStackTrace();
- Toast.makeText(activity.getApplicationContext(),activity.getString(R.string.error_generic), Toast.LENGTH_SHORT).show();
+ RingtoneManager.setActualDefaultRingtoneUri(
+ activity.getApplicationContext(),
+ RingtoneManager.TYPE_RINGTONE,
+ newUri
+ );
+ } catch(Exception e) {
+ Toast.makeText(activity.getApplicationContext(),
+ activity.getString(R.string.ringtone_error),
+ Toast.LENGTH_SHORT).show();
return;
}
- RingtoneManager.setActualDefaultRingtoneUri(
- activity.getApplicationContext(),
- RingtoneManager.TYPE_RINGTONE,
- newUri
- );
Toast.makeText(
activity.getApplicationContext(),
activity.getString(R.string.ringtone_set, song.getTitle()),
More information about the Android
mailing list