Remove unused context from CacheCleaner

This commit is contained in:
tzugen 2021-05-21 18:50:57 +02:00
parent 402fe961ba
commit b25a118148
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
4 changed files with 5 additions and 8 deletions

View File

@ -131,7 +131,7 @@ public class PlaylistsFragment extends Fragment {
List<Playlist> playlists = musicService.getPlaylists(refresh); List<Playlist> playlists = musicService.getPlaylists(refresh);
if (!ActiveServerProvider.Companion.isOffline()) if (!ActiveServerProvider.Companion.isOffline())
new CacheCleaner(getContext()).cleanPlaylists(playlists); new CacheCleaner().cleanPlaylists(playlists);
return playlists; return playlists;
} }

View File

@ -92,7 +92,7 @@ public class MediaPlayerLifecycleSupport
} }
}); });
new CacheCleaner(context).clean(); new CacheCleaner().clean();
created = true; created = true;
Timber.i("LifecycleSupport created"); Timber.i("LifecycleSupport created");
} }

View File

@ -1,6 +1,5 @@
package org.moire.ultrasonic.util; package org.moire.ultrasonic.util;
import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.StatFs; import android.os.StatFs;
import timber.log.Timber; import timber.log.Timber;
@ -31,13 +30,11 @@ public class CacheCleaner
{ {
private static final long MIN_FREE_SPACE = 500 * 1024L * 1024L; private static final long MIN_FREE_SPACE = 500 * 1024L * 1024L;
private final Context context;
private Lazy<Downloader> downloader = inject(Downloader.class); private Lazy<Downloader> downloader = inject(Downloader.class);
private Lazy<ActiveServerProvider> activeServerProvider = inject(ActiveServerProvider.class); private Lazy<ActiveServerProvider> activeServerProvider = inject(ActiveServerProvider.class);
public CacheCleaner(Context context) public CacheCleaner()
{ {
this.context = context;
} }
public void clean() 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<File> files, List<File> dirs) private static void findCandidatesForDeletion(File file, List<File> files, List<File> dirs)

View File

@ -309,7 +309,7 @@ class DownloadFile(
Timber.i("Released wake lock %s", wakeLock) Timber.i("Released wake lock %s", wakeLock)
} }
wifiLock?.release() wifiLock?.release()
CacheCleaner(context).cleanSpace() CacheCleaner().cleanSpace()
downloader.value.checkDownloads() downloader.value.checkDownloads()
} }
} }