From da586885860db5996a7df6ceac61f84f9e68d962 Mon Sep 17 00:00:00 2001 From: Sergei Kozelko Date: Sat, 19 Nov 2022 16:25:38 +0700 Subject: [PATCH] Remove unused download events (#1236) * Remove unused DownloadRedditVideoEvent * Remove unused DownloadMediaEvent --- .../infinityforreddit/events/DownloadMediaEvent.java | 9 --------- .../events/DownloadRedditVideoEvent.java | 9 --------- .../infinityforreddit/services/DownloadMediaService.java | 5 ----- .../services/DownloadRedditVideoService.java | 6 ------ 4 files changed, 29 deletions(-) delete mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/events/DownloadMediaEvent.java delete mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/events/DownloadRedditVideoEvent.java diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/events/DownloadMediaEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/events/DownloadMediaEvent.java deleted file mode 100644 index 6398cf5e..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/events/DownloadMediaEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package ml.docilealligator.infinityforreddit.events; - -public class DownloadMediaEvent { - public boolean isSuccessful; - - public DownloadMediaEvent(boolean isSuccessful) { - this.isSuccessful = isSuccessful; - } -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/events/DownloadRedditVideoEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/events/DownloadRedditVideoEvent.java deleted file mode 100644 index e6b1a9ca..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/events/DownloadRedditVideoEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package ml.docilealligator.infinityforreddit.events; - -public class DownloadRedditVideoEvent { - public boolean isSuccessful; - - public DownloadRedditVideoEvent(boolean isSuccessful) { - this.isSuccessful = isSuccessful; - } -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java index 4f511821..61fe0bea 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java @@ -27,8 +27,6 @@ import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import androidx.documentfile.provider.DocumentFile; -import org.greenrobot.eventbus.EventBus; - import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -45,7 +43,6 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.apis.DownloadFile; import ml.docilealligator.infinityforreddit.broadcastreceivers.DownloadedMediaDeleteActionBroadcastReceiver; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.events.DownloadMediaEvent; import ml.docilealligator.infinityforreddit.utils.APIUtils; import ml.docilealligator.infinityforreddit.utils.NotificationUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; @@ -337,14 +334,12 @@ public class DownloadMediaService extends Service { -1, randomNotificationIdOffset, null, null); break; } - EventBus.getDefault().post(new DownloadMediaEvent(false)); } else { MediaScannerConnection.scanFile( DownloadMediaService.this, new String[]{destinationFileUri.toString()}, null, (path, uri) -> { updateNotification(mediaType, R.string.downloading_media_finished, -1, randomNotificationIdOffset, destinationFileUri, mimeType); - EventBus.getDefault().post(new DownloadMediaEvent(true)); } ); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java index 5fcefa03..43565dd7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java @@ -25,15 +25,12 @@ import android.os.Looper; import android.os.Message; import android.os.Process; import android.provider.MediaStore; -import android.util.Log; import androidx.core.app.NotificationChannelCompat; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import androidx.documentfile.provider.DocumentFile; -import org.greenrobot.eventbus.EventBus; - import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -52,7 +49,6 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.apis.DownloadFile; import ml.docilealligator.infinityforreddit.broadcastreceivers.DownloadedMediaDeleteActionBroadcastReceiver; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.events.DownloadRedditVideoEvent; import ml.docilealligator.infinityforreddit.utils.NotificationUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import okhttp3.OkHttpClient; @@ -594,13 +590,11 @@ public class DownloadRedditVideoService extends Service { randomNotificationIdOffset, null); break; } - EventBus.getDefault().post(new DownloadRedditVideoEvent(false)); } else { MediaScannerConnection.scanFile( this, new String[]{destinationFileUri.toString()}, null, (path, uri) -> { updateNotification(R.string.downloading_reddit_video_finished, -1, randomNotificationIdOffset, destinationFileUri); - EventBus.getDefault().post(new DownloadRedditVideoEvent(true)); } ); }