Search in sources :

Example 1 with ExoDatabaseProvider

use of com.google.android.exoplayer2.database.ExoDatabaseProvider in project Slide by ccrama.

the class Reddit method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    mApplication = this;
    // LeakCanary.install(this);
    if (ProcessPhoenix.isPhoenixProcess(this)) {
        return;
    }
    final File dir;
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) && getExternalCacheDir() != null) {
        dir = new File(getExternalCacheDir() + File.separator + "video-cache");
    } else {
        dir = new File(getCacheDir() + File.separator + "video-cache");
    }
    LeastRecentlyUsedCacheEvictor evictor = new LeastRecentlyUsedCacheEvictor(256 * 1024 * 1024);
    DatabaseProvider databaseProvider = new ExoDatabaseProvider(getAppContext());
    // 256MB
    videoCache = new SimpleCache(dir, evictor, databaseProvider);
    UpgradeUtil.upgrade(getApplicationContext());
    doMainStuff();
}
Also used : DatabaseProvider(com.google.android.exoplayer2.database.DatabaseProvider) ExoDatabaseProvider(com.google.android.exoplayer2.database.ExoDatabaseProvider) SimpleCache(com.google.android.exoplayer2.upstream.cache.SimpleCache) LeastRecentlyUsedCacheEvictor(com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor) ExoDatabaseProvider(com.google.android.exoplayer2.database.ExoDatabaseProvider) File(java.io.File)

Aggregations

DatabaseProvider (com.google.android.exoplayer2.database.DatabaseProvider)1 ExoDatabaseProvider (com.google.android.exoplayer2.database.ExoDatabaseProvider)1 LeastRecentlyUsedCacheEvictor (com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor)1 SimpleCache (com.google.android.exoplayer2.upstream.cache.SimpleCache)1 File (java.io.File)1