Fixed confirmation dialog for deletion
authorDavid A. Velasco <dvelasco@solidgear.es>
Thu, 12 Jul 2012 08:55:47 +0000 (10:55 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Thu, 12 Jul 2012 08:55:47 +0000 (10:55 +0200)
res/values/strings.xml
src/eu/alefzero/owncloud/ui/fragment/ConfirmationDialogFragment.java
src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java

index e4a2483..ca3eb89 100644 (file)
     <string name="common_rename">Rename</string>
     <string name="common_remove">Remove</string>
     
     <string name="common_rename">Rename</string>
     <string name="common_remove">Remove</string>
     
-    <string name="confirmation_alert_prefix">Do you really want </string>
+    <string name="confirmation_alert_prefix">"Do you really want "</string>
     <string name="confirmation_alert_suffix">"?"</string>
 </resources>
     <string name="confirmation_alert_suffix">"?"</string>
 </resources>
index c323a69..a509860 100644 (file)
@@ -29,11 +29,13 @@ public class ConfirmationDialogFragment extends SherlockDialogFragment {
 
     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState) {
 
     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState) {
-        int confirmationTarget = getArguments().getInt(ARG_CONF_TARGET);
+        String confirmationTarget = getArguments().getString(ARG_CONF_TARGET);
+        if (confirmationTarget == null)
+            confirmationTarget = "";
 
         return new AlertDialog.Builder(getActivity())
                 .setIcon(android.R.drawable.ic_dialog_alert)
 
         return new AlertDialog.Builder(getActivity())
                 .setIcon(android.R.drawable.ic_dialog_alert)
-                .setMessage(R.string.confirmation_alert_prefix + confirmationTarget + R.string.confirmation_alert_suffix )
+                .setMessage(getString(R.string.confirmation_alert_prefix) + confirmationTarget + getString(R.string.confirmation_alert_suffix))
                 .setPositiveButton(R.string.common_ok,
                     new DialogInterface.OnClickListener() {
                         public void onClick(DialogInterface dialog, int whichButton) {
                 .setPositiveButton(R.string.common_ok,
                     new DialogInterface.OnClickListener() {
                         public void onClick(DialogInterface dialog, int whichButton) {
index dca06c7..381d4d8 100644 (file)
@@ -157,6 +157,13 @@ public class FileDetailFragment extends SherlockFragment implements
         view = inflater.inflate(mLayout, container, false);\r
         mView = view;\r
         \r
         view = inflater.inflate(mLayout, container, false);\r
         mView = view;\r
         \r
+        if (mLayout == R.layout.file_details_fragment) {\r
+            getView().findViewById(R.id.fdKeepInSync).setOnClickListener(this);\r
+            //getView().findViewById(R.id.fdShareBtn).setOnClickListener(this);\r
+            getView().findViewById(R.id.fdRenameBtn).setOnClickListener(this);\r
+            getView().findViewById(R.id.fdRemoveBtn).setOnClickListener(this);\r
+        }\r
+        \r
         updateFileDetails();\r
         return view;\r
     }\r
         updateFileDetails();\r
         return view;\r
     }\r
@@ -226,7 +233,7 @@ public class FileDetailFragment extends SherlockFragment implements
                 break;\r
             }   \r
             case R.id.fdRemoveBtn: {\r
                 break;\r
             }   \r
             case R.id.fdRemoveBtn: {\r
-                ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance("remove " + mFile.getFileName());\r
+                ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance("to remove " + mFile.getFileName());\r
                 confDialog.setOnConfirmationListener(this);\r
                 confDialog.show(getFragmentManager(), "REMOVE_CONFIRMATION_FRAGMENT");\r
                 break;\r
                 confDialog.setOnConfirmationListener(this);\r
                 confDialog.show(getFragmentManager(), "REMOVE_CONFIRMATION_FRAGMENT");\r
                 break;\r
@@ -301,9 +308,6 @@ public class FileDetailFragment extends SherlockFragment implements
             \r
             CheckBox cb = (CheckBox)getView().findViewById(R.id.fdKeepInSync);\r
             cb.setChecked(mFile.keepInSync());\r
             \r
             CheckBox cb = (CheckBox)getView().findViewById(R.id.fdKeepInSync);\r
             cb.setChecked(mFile.keepInSync());\r
-            cb.setOnClickListener(this);\r
-            //getView().findViewById(R.id.fdShareBtn).setOnClickListener(this);\r
-            getView().findViewById(R.id.fdRenameBtn).setOnClickListener(this);\r
             \r
             if (mFile.getStoragePath() != null) {\r
                 // Update preview\r
             \r
             if (mFile.getStoragePath() != null) {\r
                 // Update preview\r