mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
[Android] Do not hardcode java const values (JNI)
This commit is contained in:
parent
ed7c80f6bb
commit
d73418261b
@ -440,8 +440,15 @@ void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_
|
||||
jobject objectDecorView = lJNIEnv->CallObjectMethod(objectWindow, methodGetDecorView);
|
||||
|
||||
jclass classView = lJNIEnv->FindClass("android/view/View");
|
||||
|
||||
jfieldID FieldSYSTEM_UI_FLAG_HIDE_NAVIGATION = lJNIEnv->GetStaticFieldID(classView, "SYSTEM_UI_FLAG_HIDE_NAVIGATION", "I");
|
||||
jint SYSTEM_UI_FLAG_HIDE_NAVIGATION = lJNIEnv->GetStaticIntField(classView, FieldSYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
|
||||
jfieldID FieldSYSTEM_UI_FLAG_FULLSCREEN = lJNIEnv->GetStaticFieldID(classView, "SYSTEM_UI_FLAG_FULLSCREEN", "I");
|
||||
jint SYSTEM_UI_FLAG_FULLSCREEN = lJNIEnv->GetStaticIntField(classView, FieldSYSTEM_UI_FLAG_FULLSCREEN);
|
||||
|
||||
jmethodID methodsetSystemUiVisibility = lJNIEnv->GetMethodID(classView, "setSystemUiVisibility", "(I)V");
|
||||
lJNIEnv->CallVoidMethod(objectDecorView, methodsetSystemUiVisibility, (jint)(2 | 4));
|
||||
lJNIEnv->CallVoidMethod(objectDecorView, methodsetSystemUiVisibility, SYSTEM_UI_FLAG_HIDE_NAVIGATION | SYSTEM_UI_FLAG_FULLSCREEN);
|
||||
|
||||
// Initialize the display
|
||||
eglInitialize(states->display, NULL, NULL);
|
||||
|
@ -152,13 +152,11 @@ void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_
|
||||
|
||||
jclass ClassPackageManager = lJNIEnv->FindClass("android/content/pm/PackageManager");
|
||||
|
||||
//jfieldID FieldGET_META_DATA = lJNIEnv->GetStaticFieldID(ClassPackageManager, "GET_META_DATA", "L");
|
||||
//jobject GET_META_DATA = lJNIEnv->GetStaticObjectField(ClassPackageManager, FieldGET_META_DATA);
|
||||
// getActivityInfo(getIntent().getComponent(), PackageManager.GET_META_DATA) -> ActivityInfo object
|
||||
jmethodID MethodGetActivityInfo = lJNIEnv->GetMethodID(ClassPackageManager, "getActivityInfo", "(Landroid/content/ComponentName;I)Landroid/content/pm/ActivityInfo;");
|
||||
jfieldID FieldGET_META_DATA = lJNIEnv->GetStaticFieldID(ClassPackageManager, "GET_META_DATA", "I");
|
||||
jint GET_META_DATA = lJNIEnv->GetStaticIntField(ClassPackageManager, FieldGET_META_DATA);
|
||||
|
||||
// todo: do not hardcode the GET_META_DATA integer value but retrieve it instead
|
||||
jobject ObjectActivityInfo = lJNIEnv->CallObjectMethod(ObjectPackageManager, MethodGetActivityInfo, ObjectComponentName, (jint)128);
|
||||
jmethodID MethodGetActivityInfo = lJNIEnv->GetMethodID(ClassPackageManager, "getActivityInfo", "(Landroid/content/ComponentName;I)Landroid/content/pm/ActivityInfo;");
|
||||
jobject ObjectActivityInfo = lJNIEnv->CallObjectMethod(ObjectPackageManager, MethodGetActivityInfo, ObjectComponentName, GET_META_DATA);
|
||||
|
||||
// Load our libraries in reverse order
|
||||
loadLibrary("c++_shared", lJNIEnv, ObjectActivityInfo);
|
||||
|
Loading…
Reference in New Issue
Block a user