Added the ability to set SDL hints from AndroidManifest.xml (thanks Rachel!)
This is especially useful for things like the accelerometer hint which could be needed before application main().
This commit is contained in:
parent
6cba336d1c
commit
b985a686f1
5 changed files with 88 additions and 2 deletions
|
@ -24,6 +24,8 @@ import android.graphics.*;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.hardware.*;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
|
||||
/**
|
||||
SDL Activity
|
||||
|
@ -613,6 +615,29 @@ public class SDLActivity extends Activity {
|
|||
return SDL.getContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called by SDL using JNI.
|
||||
*/
|
||||
public static String getManifestEnvironmentVariable(String variableName) {
|
||||
try {
|
||||
ApplicationInfo applicationInfo = getContext().getPackageManager().getApplicationInfo(getContext().getPackageName(), PackageManager.GET_META_DATA);
|
||||
if (applicationInfo.metaData == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String key = "SDL_ENV." + variableName;
|
||||
if (!applicationInfo.metaData.containsKey(key)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return applicationInfo.metaData.get(key).toString();
|
||||
}
|
||||
catch (PackageManager.NameNotFoundException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static class ShowTextInputTask implements Runnable {
|
||||
/*
|
||||
* This is used to regulate the pan&scan method to have some offset from
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue