[Android] Show filename in delete alert dialog

Sébastien Toque git at videolan.org
Sat Aug 18 09:51:15 CEST 2012


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sat Aug 18 08:32:04 2012 +0200| [9aa28be11bcac0a4b5e9d5519dcc249b82f272d7] | committer: Sébastien Toque

Show filename in delete alert dialog

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=9aa28be11bcac0a4b5e9d5519dcc249b82f272d7
---

 vlc-android/res/values-fr/strings.xml              |    2 +-
 vlc-android/res/values/strings.xml                 |    2 +-
 .../src/org/videolan/vlc/gui/CommonDialogs.java    |   21 ++++++++++----------
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/vlc-android/res/values-fr/strings.xml b/vlc-android/res/values-fr/strings.xml
index 5eb6d7b..a0f55e5 100644
--- a/vlc-android/res/values-fr/strings.xml
+++ b/vlc-android/res/values-fr/strings.xml
@@ -23,7 +23,7 @@
     <string name="append_all">Lire tout à la suite</string>
     <string name="delete">Supprimer</string>
     <string name="info">Information</string>
-    <string name="confirm_delete">Supprimer ce média ?</string>
+    <string name="confirm_delete">Supprimer le média \'%1$s\' ?</string>
     <string name="pause">Pause</string>
     <string name="close">Fermer</string>
     <string name="not_show_again">Ne plus afficher ce message.</string>
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index e575f34..9fe52f3 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -25,7 +25,7 @@
     <string name="append_all">Append all</string>
     <string name="delete">Delete</string>
     <string name="info">Information</string>
-    <string name="confirm_delete">Delete this file?</string>
+    <string name="confirm_delete">Delete the file \'%1$s\' ?</string>
     <string name="pause">Pause</string>
     <string name="close">Close</string>
     <string name="not_show_again">"Don't show this message again."</string>
diff --git a/vlc-android/src/org/videolan/vlc/gui/CommonDialogs.java b/vlc-android/src/org/videolan/vlc/gui/CommonDialogs.java
index 1395bf5..2a387a4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/CommonDialogs.java
+++ b/vlc-android/src/org/videolan/vlc/gui/CommonDialogs.java
@@ -34,21 +34,22 @@ public class CommonDialogs {
     public final static String TAG = "VLC/CommonDialogs";
 
     public static AlertDialog deleteMedia( final Context context, final String addressMedia, final VLCCallbackTask task ) {
+        URI adressMediaUri = null;
+        try {
+            adressMediaUri = new URI (addressMedia);
+        } catch (URISyntaxException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        final File fileMedia = new File(adressMediaUri);
+
         AlertDialog alertDialog = new AlertDialog.Builder(context)
-        .setTitle(R.string.confirm_delete)
-        .setMessage(R.string.validation)
+        .setTitle(R.string.validation)
+        .setMessage(context.getResources().getString(R.string.confirm_delete, fileMedia.getName()))
         .setIcon(android.R.drawable.ic_dialog_alert)
         .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int whichButton) {
-                URI adressMediaUri = null;
-                try {
-                    adressMediaUri = new URI (addressMedia);
-                } catch (URISyntaxException e) {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
-                }
-                File fileMedia = new File(adressMediaUri);
                 fileMedia.delete();
                 if(task != null)
                     task.run();



More information about the Android mailing list