
org.robolectric.shadows.ShadowSoundPool Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of framework Show documentation
Show all versions of framework Show documentation
An alternative Android testing framework.
The newest version!
package org.robolectric.shadows;
import android.media.SoundPool;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.RealObject;
import org.robolectric.util.ReflectionHelpers;
import android.media.AudioAttributes;
import static android.os.Build.VERSION_CODES.M;
import static org.robolectric.RuntimeEnvironment.getApiLevel;
import static org.robolectric.shadow.api.Shadow.invokeConstructor;
import static org.robolectric.util.ReflectionHelpers.ClassParameter.from;
@Implements(SoundPool.class)
public class ShadowSoundPool {
@RealObject
SoundPool realObject;
@Implementation(minSdk = M)
public void __constructor__(int maxStreams, AudioAttributes attributes) {
if (getApiLevel() >= M) {
ReflectionHelpers.setField(realObject, "mLock", new Object());
} else {
invokeConstructor(SoundPool.class, realObject,
from(int.class, maxStreams),
from(AudioAttributes.class, attributes));
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy