Release cache

pull/594/head
jhengazuki 2 months ago
parent 565447f849
commit 036d286438
  1. 4
      app/build.gradle
  2. 2
      app/src/main/java/com/fongmi/android/tv/player/Players.java
  3. 6
      app/src/main/java/com/fongmi/android/tv/player/exo/CacheManager.java
  4. 2
      build.gradle

@ -99,7 +99,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'androidx.core:core-splashscreen:1.0.1'
implementation 'androidx.media:media:1.7.1'
implementation 'androidx.room:room-runtime:2.8.0'
implementation 'androidx.room:room-runtime:2.8.1'
implementation 'cat.ereza:customactivityoncrash:2.4.0'
implementation 'com.airbnb.android:lottie:6.6.9'
implementation 'com.github.bassaer:materialdesigncolors:1.0.0'
@ -130,7 +130,7 @@ dependencies {
mobileImplementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
mobileImplementation 'com.google.android.flexbox:flexbox:3.0.0'
mobileImplementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
annotationProcessor 'androidx.room:room-compiler:2.8.0'
annotationProcessor 'androidx.room:room-compiler:2.8.1'
annotationProcessor 'com.github.bumptech.glide:compiler:' + glideVersion
annotationProcessor 'org.greenrobot:eventbus-annotation-processor:3.3.1'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.1.5'

@ -47,6 +47,7 @@ import com.fongmi.android.tv.event.PlayerEvent;
import com.fongmi.android.tv.impl.ParseCallback;
import com.fongmi.android.tv.impl.SessionCallback;
import com.fongmi.android.tv.player.danmaku.DanPlayer;
import com.fongmi.android.tv.player.exo.CacheManager;
import com.fongmi.android.tv.player.exo.ExoUtil;
import com.fongmi.android.tv.server.Server;
import com.fongmi.android.tv.utils.FileUtil;
@ -398,6 +399,7 @@ public class Players implements Player.Listener, ParseCallback {
session.release();
removeTimeoutCheck();
Server.get().setPlayer(null);
CacheManager.get().release();
App.execute(() -> Source.get().stop());
}

@ -28,5 +28,11 @@ public class CacheManager {
private void create() {
cache = new SimpleCache(Path.exo(), new NoOpCacheEvictor(), new StandaloneDatabaseProvider(App.get()));
}
public void release() {
if (cache == null) return;
cache.release();
cache = null;
}
}

@ -9,7 +9,7 @@ tasks.register('clean', Delete) {
}
project.ext {
gsonVersion = '2.13.1'
gsonVersion = '2.13.2'
glideVersion = '5.0.5'
media3Version = '1.8.0'
okhttpVersion = '5.1.0'

Loading…
Cancel
Save