(Android) Don't use JELLY_BEAN_MR1 constant as it wasn't available on

prior Android versions - use int keycode instead - also implemented
stub onTrimMemory/onLowMemory inside NativeActivity wrapper class
This commit is contained in:
twinaphex 2013-07-18 13:27:30 +02:00
parent c54af19076
commit a4850c1b57
3 changed files with 11 additions and 5 deletions

View File

@ -13,7 +13,8 @@
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
android:label="@string/app_name"
android:hasCode="true">
<activity android:name="org.retroarch.browser.RetroArch">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -35,7 +36,7 @@
<activity android:name="org.retroarch.browser.StateDirActivity"></activity>
<activity android:name="org.retroarch.browser.SystemDirActivity"></activity>
<activity android:name="org.retroarch.browser.RetroActivity" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
<activity android:name="org.retroarch.browser.RetroActivity" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<meta-data android:name="android.app.lib_name" android:value="retroarch-activity" />
<meta-data android:name="android.app.func_name" android:value="ANativeActivity_onCreate" />
</activity>

View File

@ -2,7 +2,6 @@ package org.retroarch.browser;
import android.app.NativeActivity;
import android.os.Bundle;
import android.widget.Toast;
public class RetroActivity extends NativeActivity
{
@ -21,4 +20,8 @@ public class RetroActivity extends NativeActivity
public void onLowMemory()
{
}
@Override
public void onTrimMemory(int level) {
}
}

View File

@ -22,6 +22,8 @@ import android.view.ContextMenu.ContextMenuInfo;
import android.view.inputmethod.*;
import android.graphics.drawable.*;
// JELLY_BEAN_MR1 = 17
class ModuleWrapper implements IconAdapterItem {
public final File file;
private ConfigFile config;
@ -352,7 +354,7 @@ public class RetroArch extends Activity implements
return "/mnt/sd/retroarch.cfg";
}
@TargetApi(android.os.Build.VERSION_CODES.JELLY_BEAN_MR1)
@TargetApi(17)
private int getLowLatencyOptimalSamplingRate() {
AudioManager manager = (AudioManager)getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
return Integer.parseInt(manager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE));
@ -360,7 +362,7 @@ public class RetroArch extends Activity implements
private int getOptimalSamplingRate() {
int ret;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1)
if (android.os.Build.VERSION.SDK_INT >= 17)
ret = getLowLatencyOptimalSamplingRate();
else
ret = AudioTrack.getNativeOutputSampleRate(AudioManager.STREAM_MUSIC);