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;
|
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
|
if (path.endsWith("/")) { // directory
|
||||||
try (JarFile apk = new JarFile(Context.this_application.getPackageCodePath())) {
|
try (JarFile apk = new JarFile(Context.this_application.getPackageCodePath())) {
|
||||||
Enumeration<JarEntry> entries = apk.entries();
|
Enumeration<JarEntry> entries = apk.entries();
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package android.media;
|
package android.media;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import android.content.res.AssetFileDescriptor;
|
import android.content.res.AssetFileDescriptor;
|
||||||
|
import android.content.res.AssetManager;
|
||||||
|
|
||||||
public class SoundPool {
|
public class SoundPool {
|
||||||
|
|
||||||
@@ -21,8 +24,9 @@ public class SoundPool {
|
|||||||
nativePool = native_constructor();
|
nativePool = native_constructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int load(AssetFileDescriptor afd, int priority) {
|
public int load(AssetFileDescriptor afd, int priority) throws IOException {
|
||||||
return nativeLoad(nativePool, android.os.Environment.getExternalStorageDirectory().getPath() + afd.fileName);
|
AssetManager.extractFromAPK(afd.fileName, afd.fileName);
|
||||||
|
return nativeLoad(nativePool, android.os.Environment.getExternalStorageDirectory().getPath() + "/" + afd.fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user