From b25a1181484cef755622a99fb76558441f7f9861 Mon Sep 17 00:00:00 2001 From: tzugen Date: Fri, 21 May 2021 18:50:57 +0200 Subject: [PATCH] Remove unused context from CacheCleaner --- .../org/moire/ultrasonic/fragment/PlaylistsFragment.java | 2 +- .../ultrasonic/service/MediaPlayerLifecycleSupport.java | 2 +- .../main/java/org/moire/ultrasonic/util/CacheCleaner.java | 7 ++----- .../kotlin/org/moire/ultrasonic/service/DownloadFile.kt | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/fragment/PlaylistsFragment.java b/ultrasonic/src/main/java/org/moire/ultrasonic/fragment/PlaylistsFragment.java index e98e5798..e78777b6 100644 --- a/ultrasonic/src/main/java/org/moire/ultrasonic/fragment/PlaylistsFragment.java +++ b/ultrasonic/src/main/java/org/moire/ultrasonic/fragment/PlaylistsFragment.java @@ -131,7 +131,7 @@ public class PlaylistsFragment extends Fragment { List playlists = musicService.getPlaylists(refresh); if (!ActiveServerProvider.Companion.isOffline()) - new CacheCleaner(getContext()).cleanPlaylists(playlists); + new CacheCleaner().cleanPlaylists(playlists); return playlists; } diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.java b/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.java index 5357b0dd..0203e7a2 100644 --- a/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.java +++ b/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.java @@ -92,7 +92,7 @@ public class MediaPlayerLifecycleSupport } }); - new CacheCleaner(context).clean(); + new CacheCleaner().clean(); created = true; Timber.i("LifecycleSupport created"); } diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/util/CacheCleaner.java b/ultrasonic/src/main/java/org/moire/ultrasonic/util/CacheCleaner.java index a61e0946..6368e001 100644 --- a/ultrasonic/src/main/java/org/moire/ultrasonic/util/CacheCleaner.java +++ b/ultrasonic/src/main/java/org/moire/ultrasonic/util/CacheCleaner.java @@ -1,6 +1,5 @@ package org.moire.ultrasonic.util; -import android.content.Context; import android.os.AsyncTask; import android.os.StatFs; import timber.log.Timber; @@ -31,13 +30,11 @@ public class CacheCleaner { private static final long MIN_FREE_SPACE = 500 * 1024L * 1024L; - private final Context context; private Lazy downloader = inject(Downloader.class); private Lazy activeServerProvider = inject(ActiveServerProvider.class); - public CacheCleaner(Context context) + public CacheCleaner() { - this.context = context; } public void clean() @@ -168,7 +165,7 @@ public class CacheCleaner } } - Timber.i("Deleted : %s", Util.formatBytes(bytesDeleted)); + Timber.i("Deleted: %s", Util.formatBytes(bytesDeleted)); } private static void findCandidatesForDeletion(File file, List files, List dirs) diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/DownloadFile.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/DownloadFile.kt index 3ccdd06c..6e773940 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/DownloadFile.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/DownloadFile.kt @@ -309,7 +309,7 @@ class DownloadFile( Timber.i("Released wake lock %s", wakeLock) } wifiLock?.release() - CacheCleaner(context).cleanSpace() + CacheCleaner().cleanSpace() downloader.value.checkDownloads() } }