X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/fa64d9eeec2752a3f2eca21d5f2345cca1498998..0cced280a4c6711229da3a3ab692b0971654a191:/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java diff --git a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java index aa59a5c2..d7fb886f 100644 --- a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java +++ b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java @@ -273,7 +273,12 @@ public class FileDetailFragment extends SherlockFragment implements break; } case R.id.fdRemoveBtn: { - ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance(R.string.confirmation_remove_alert, new String[]{mFile.getFileName()}); + ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance( + R.string.confirmation_remove_alert, + new String[]{mFile.getFileName()}, + mFile.isDown() ? R.string.confirmation_remove_remote_and_local : R.string.confirmation_remove_remote, + mFile.isDown() ? R.string.confirmation_remove_local : -1, + R.string.common_cancel); confDialog.setOnConfirmationListener(this); confDialog.show(getFragmentManager(), FTAG_CONFIRMATION); break; @@ -331,14 +336,31 @@ public class FileDetailFragment extends SherlockFragment implements @Override - public void onConfirmation(boolean confirmation, String callerTag) { - if (confirmation && callerTag.equals(FTAG_CONFIRMATION)) { + public void onConfirmation(String callerTag) { + if (callerTag.equals(FTAG_CONFIRMATION)) { Log.e("ASD","onConfirmation"); FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getContentResolver()); if (fdsm.getFileById(mFile.getFileId()) != null) { new Thread(new RemoveRunnable(mFile, mAccount, new Handler())).start(); } - } else if (!confirmation) Log.d(TAG, "REMOVAL CANCELED"); + } + } + + @Override + public void onNeutral(String callerTag) { + FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getContentResolver()); + File f = null; + if (mFile.isDown() && (f = new File(mFile.getStoragePath())).exists()) { + f.delete(); + mFile.setStoragePath(null); + fdsm.saveFile(mFile); + updateFileDetails(mFile, mAccount); + } + } + + @Override + public void onCancel(String callerTag) { + Log.d(TAG, "REMOVAL CANCELED"); }