src/core/android/SDL_android.c
branchapk
changeset 8896 d931167c375a
parent 8149 681eb46b8ac4
child 8897 fff9c0b9f1fb
equal deleted inserted replaced
8697:abf45e1abfe3 8896:d931167c375a
   383     SDL_SendEditingText(utftext, 0, 0);
   383     SDL_SendEditingText(utftext, 0, 0);
   384 
   384 
   385     (*env)->ReleaseStringUTFChars(env, text, utftext);
   385     (*env)->ReleaseStringUTFChars(env, text, utftext);
   386 }
   386 }
   387 
   387 
   388 
   388 jstring Java_org_libsdl_app_SDLActivity_getHint(JNIEnv* env, jclass cls, jstring name) {
       
   389     const char *utfname = (*env)->GetStringUTFChars(env, name, NULL);
       
   390     const char *hint = SDL_GetHint(utfname);
       
   391 
       
   392     jstring result = (*env)->NewStringUTF(env, hint);
       
   393     (*env)->ReleaseStringUTFChars(env, name, utfname);
       
   394 
       
   395     return result;
       
   396 }
   389 
   397 
   390 /*******************************************************************************
   398 /*******************************************************************************
   391              Functions called by SDL into Java
   399              Functions called by SDL into Java
   392 *******************************************************************************/
   400 *******************************************************************************/
   393 
   401 
   756         /* inputStream = assetManager.open(<filename>); */
   764         /* inputStream = assetManager.open(<filename>); */
   757         mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, assetManager),
   765         mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, assetManager),
   758                 "open", "(Ljava/lang/String;I)Ljava/io/InputStream;");
   766                 "open", "(Ljava/lang/String;I)Ljava/io/InputStream;");
   759         inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */);
   767         inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */);
   760         if (Android_JNI_ExceptionOccurred(false)) {
   768         if (Android_JNI_ExceptionOccurred(false)) {
   761             goto failure;
   769             // Try fallback to APK Extension files
       
   770             mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context),
       
   771                 "openAPKExtensionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
       
   772             inputStream = (*mEnv)->CallObjectMethod(mEnv, context, mid, fileNameJString);
       
   773 
       
   774             if (Android_JNI_ExceptionOccurred(false)) {
       
   775                 goto failure;
       
   776             }
   762         }
   777         }
   763 
   778 
   764         ctx->hidden.androidio.inputStreamRef = (*mEnv)->NewGlobalRef(mEnv, inputStream);
   779         ctx->hidden.androidio.inputStreamRef = (*mEnv)->NewGlobalRef(mEnv, inputStream);
   765 
   780 
   766         /* Despite all the visible documentation on [Asset]InputStream claiming
   781         /* Despite all the visible documentation on [Asset]InputStream claiming