aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-08-23 12:00:50 +0200
committersteckbrief <steckbrief@chefmail.de>2016-08-23 12:00:50 +0200
commitc6ed89e4109a3db25d9cae8ad1426a3294e721c3 (patch)
treec8e7facf0ecfca6aff8d544f3d7a1e4d40731c93
parent14e28d1e9afc058526eba4a6096d582f4810ea84 (diff)
Javadoc added and access to xmppConnectionService moved
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/persistance/FileBackend.java5
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/listeners/DeleteFileCallback.java14
2 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/persistance/FileBackend.java b/src/main/java/de/thedevstack/conversationsplus/persistance/FileBackend.java
index 9f7e473e..e5597c3c 100644
--- a/src/main/java/de/thedevstack/conversationsplus/persistance/FileBackend.java
+++ b/src/main/java/de/thedevstack/conversationsplus/persistance/FileBackend.java
@@ -28,6 +28,7 @@ import de.thedevstack.conversationsplus.R;
import de.thedevstack.conversationsplus.entities.DownloadableFile;
import de.thedevstack.conversationsplus.entities.Message;
import de.thedevstack.conversationsplus.services.XmppConnectionService;
+import de.thedevstack.conversationsplus.utils.XmppConnectionServiceAccessor;
public class FileBackend {
private static final SimpleDateFormat imageDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.US);
@@ -90,10 +91,10 @@ public class FileBackend {
}
}
- public static boolean deleteFile(Message message, XmppConnectionService xmppConnectionService) {
+ public static boolean deleteFile(Message message) {
File file = getFile(message);
if (file.delete()) {
- updateMediaScanner(file, xmppConnectionService);
+ updateMediaScanner(file, XmppConnectionServiceAccessor.xmppConnectionService);
return true;
} else {
return false;
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/DeleteFileCallback.java b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/DeleteFileCallback.java
index 3ff7f367..f855a90d 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/DeleteFileCallback.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/DeleteFileCallback.java
@@ -5,10 +5,9 @@ import de.thedevstack.conversationsplus.entities.Transferable;
import de.thedevstack.conversationsplus.entities.TransferablePlaceholder;
import de.thedevstack.conversationsplus.persistance.FileBackend;
import de.thedevstack.conversationsplus.utils.UiUpdateHelper;
-import de.thedevstack.conversationsplus.utils.XmppConnectionServiceAccessor;
/**
- * Created by steckbrief on 23.08.2016.
+ * Callback for the user decision if a file should be deleted or not.
*/
public class DeleteFileCallback implements SimpleUserDecisionCallback {
private final Message message;
@@ -17,18 +16,27 @@ public class DeleteFileCallback implements SimpleUserDecisionCallback {
this.message = message;
}
+ /**
+ * Deletes the file and updates the UI.
+ */
private void deleteFile() {
- if (FileBackend.deleteFile(this.message, XmppConnectionServiceAccessor.xmppConnectionService)) {
+ if (FileBackend.deleteFile(this.message)) {
this.message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
UiUpdateHelper.updateConversationUi();
}
}
+ /**
+ * Deletes the file.
+ */
@Override
public void onYes() {
this.deleteFile();
}
+ /**
+ * Nothing to do in this case.
+ */
@Override
public void onNo() {
// Nothing to do