You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
SoundPool: explicitly extract soundfile asset
With the recent changes assets are no longer extracted by default
This commit is contained in:
@@ -610,7 +610,7 @@ public final class AssetManager {
|
||||
return cookies;
|
||||
}
|
||||
|
||||
private static void extractFromAPK(String path, String target) throws IOException {
|
||||
public static void extractFromAPK(String path, String target) throws IOException {
|
||||
if (path.endsWith("/")) { // directory
|
||||
try (JarFile apk = new JarFile(Context.this_application.getPackageCodePath())) {
|
||||
Enumeration<JarEntry> entries = apk.entries();
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package android.media;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.content.res.AssetManager;
|
||||
|
||||
public class SoundPool {
|
||||
|
||||
@@ -21,8 +24,9 @@ public class SoundPool {
|
||||
nativePool = native_constructor();
|
||||
}
|
||||
|
||||
public int load(AssetFileDescriptor afd, int priority) {
|
||||
return nativeLoad(nativePool, android.os.Environment.getExternalStorageDirectory().getPath() + afd.fileName);
|
||||
public int load(AssetFileDescriptor afd, int priority) throws IOException {
|
||||
AssetManager.extractFromAPK(afd.fileName, afd.fileName);
|
||||
return nativeLoad(nativePool, android.os.Environment.getExternalStorageDirectory().getPath() + "/" + afd.fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user