src/core/android/SDL_android.c
changeset 11844 8e2ca40e07f3
parent 11823 56d562cbea17
child 11865 af91d564aa40
equal deleted inserted replaced
11843:bbe75e4fc57e 11844:8e2ca40e07f3
   209 /* method signatures */
   209 /* method signatures */
   210 static jmethodID midGetNativeSurface;
   210 static jmethodID midGetNativeSurface;
   211 static jmethodID midSetActivityTitle;
   211 static jmethodID midSetActivityTitle;
   212 static jmethodID midSetOrientation;
   212 static jmethodID midSetOrientation;
   213 static jmethodID midGetContext;
   213 static jmethodID midGetContext;
       
   214 static jmethodID midIsAndroidTV;
   214 static jmethodID midInputGetInputDeviceIds;
   215 static jmethodID midInputGetInputDeviceIds;
   215 static jmethodID midSendMessage;
   216 static jmethodID midSendMessage;
   216 static jmethodID midShowTextInput;
   217 static jmethodID midShowTextInput;
   217 static jmethodID midIsScreenKeyboardShown;
   218 static jmethodID midIsScreenKeyboardShown;
   218 static jmethodID midClipboardSetText;
   219 static jmethodID midClipboardSetText;
   303                                 "setActivityTitle","(Ljava/lang/String;)Z");
   304                                 "setActivityTitle","(Ljava/lang/String;)Z");
   304     midSetOrientation = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   305     midSetOrientation = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   305                                 "setOrientation","(IIZLjava/lang/String;)V");
   306                                 "setOrientation","(IIZLjava/lang/String;)V");
   306     midGetContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   307     midGetContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   307                                 "getContext","()Landroid/content/Context;");
   308                                 "getContext","()Landroid/content/Context;");
       
   309     midIsAndroidTV = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
       
   310                                 "isAndroidTV","()Z");
   308     midInputGetInputDeviceIds = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   311     midInputGetInputDeviceIds = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   309                                 "inputGetInputDeviceIds", "(I)[I");
   312                                 "inputGetInputDeviceIds", "(I)[I");
   310     midSendMessage = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   313     midSendMessage = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   311                                 "sendMessage", "(II)Z");
   314                                 "sendMessage", "(II)Z");
   312     midShowTextInput =  (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   315     midShowTextInput =  (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   324 
   327 
   325     midGetManifestEnvironmentVariables = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   328     midGetManifestEnvironmentVariables = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   326                                 "getManifestEnvironmentVariables", "()Z");
   329                                 "getManifestEnvironmentVariables", "()Z");
   327 
   330 
   328     midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;");
   331     midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;");
       
   332     midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;");
   329 
   333 
   330     if (!midGetNativeSurface ||
   334     if (!midGetNativeSurface ||
   331        !midSetActivityTitle || !midSetOrientation || !midGetContext || !midInputGetInputDeviceIds ||
   335        !midSetActivityTitle || !midSetOrientation || !midGetContext || !midIsAndroidTV || !midInputGetInputDeviceIds ||
   332        !midSendMessage || !midShowTextInput || !midIsScreenKeyboardShown ||
   336        !midSendMessage || !midShowTextInput || !midIsScreenKeyboardShown ||
   333        !midClipboardSetText || !midClipboardGetText || !midClipboardHasText ||
   337        !midClipboardSetText || !midClipboardGetText || !midClipboardHasText ||
   334        !midOpenAPKExpansionInputStream || !midGetManifestEnvironmentVariables|| !midGetDisplayDPI) {
   338        !midOpenAPKExpansionInputStream || !midGetManifestEnvironmentVariables|| !midGetDisplayDPI) {
   335         __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLActivity.java?");
   339         __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLActivity.java?");
   336     }
   340     }
  1991 
  1995 
  1992     /* return SDLActivity.getContext(); */
  1996     /* return SDLActivity.getContext(); */
  1993     return (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext);
  1997     return (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext);
  1994 }
  1998 }
  1995 
  1999 
       
  2000 SDL_bool SDL_IsAndroidTV(void)
       
  2001 {
       
  2002     JNIEnv *env = Android_JNI_GetEnv();
       
  2003     return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsAndroidTV);
       
  2004 }
       
  2005 
  1996 const char * SDL_AndroidGetInternalStoragePath(void)
  2006 const char * SDL_AndroidGetInternalStoragePath(void)
  1997 {
  2007 {
  1998     static char *s_AndroidInternalFilesPath = NULL;
  2008     static char *s_AndroidInternalFilesPath = NULL;
  1999 
  2009 
  2000     if (!s_AndroidInternalFilesPath) {
  2010     if (!s_AndroidInternalFilesPath) {