Delete remote file - confirmation dialog added
[pub/Android/ownCloud.git] / src / eu / alefzero / owncloud / ui / fragment / FileDetailFragment.java
index 9b41093..96ed209 100644 (file)
@@ -42,6 +42,8 @@ import org.json.JSONObject;
 \r
 import android.accounts.Account;\r
 import android.accounts.AccountManager;\r
+import android.app.AlertDialog;\r
+import android.app.Dialog;\r
 import android.content.ActivityNotFoundException;\r
 import android.content.BroadcastReceiver;\r
 import android.content.Context;\r
@@ -94,7 +96,7 @@ import eu.alefzero.webdav.WebdavClient;
  * \r
  */\r
 public class FileDetailFragment extends SherlockFragment implements\r
-        OnClickListener {\r
+        OnClickListener, ConfirmationDialogFragment.ConfirmationDialogFragmentListener {\r
 \r
     public static final String EXTRA_FILE = "FILE";\r
     public static final String EXTRA_ACCOUNT = "ACCOUNT";\r
@@ -222,6 +224,12 @@ public class FileDetailFragment extends SherlockFragment implements
                 dialog.show(getFragmentManager(), "nameeditdialog");\r
                 dialog.setOnDismissListener(this);\r
                 break;\r
+            }   \r
+            case R.id.fdRemoveBtn: {\r
+                ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance("remove " + mFile.getFileName());\r
+                confDialog.setOnConfirmationListener(this);\r
+                confDialog.show(getFragmentManager(), "REMOVE_CONFIRMATION_FRAGMENT");\r
+                break;\r
             }\r
             default:\r
                 Log.e(TAG, "Incorrect view clicked!");\r
@@ -232,8 +240,16 @@ public class FileDetailFragment extends SherlockFragment implements
             t.start();\r
         }*/\r
     }\r
-\r
-\r
+    \r
+    \r
+    @Override\r
+    public void onConfirmation(boolean confirmation, String callerTag) {\r
+        if (confirmation && callerTag.equals("REMOVE_CONFIRMATION_FRAGMENT")) {\r
+            // TODO remove in a separated thread\r
+        }\r
+    }\r
+    \r
+    \r
     /**\r
      * Check if the fragment was created with an empty layout. An empty fragment can't show file details, must be replaced.\r
      * \r
@@ -502,7 +518,7 @@ public class FileDetailFragment extends SherlockFragment implements
         \r
     }\r
     \r
-    // this is a temporary class for sharing purposes, it need to be replacead in transfer service\r
+    // this is a temporary class for sharing purposes, it need to be replaced in transfer service\r
     private class ShareRunnable implements Runnable {\r
         private String mPath;\r
 \r
@@ -772,4 +788,5 @@ public class FileDetailFragment extends SherlockFragment implements
         }\r
         \r
     }\r
+\r
 }\r