1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Android: add Android Studio support, completely redone java part (#9066)

This commit is contained in:
Maksim 2020-04-15 16:27:40 +02:00 committed by GitHub
parent 8ae8c1600a
commit 62ae7adab2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 1129 additions and 2520 deletions

View file

@ -11,12 +11,12 @@
#if defined USE_CMAKE_CONFIG_H
#include "cmake_config.h"
#elif defined (__ANDROID__) || defined (ANDROID)
#elif defined (__ANDROID__)
#define PROJECT_NAME "minetest"
#define PROJECT_NAME_C "Minetest"
#define STATIC_SHAREDIR ""
#include "android_version.h"
#ifdef NDEBUG
#define VERSION_STRING STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_PATCH) STR(VERSION_EXTRA)
#ifdef NDEBUG
#define BUILD_TYPE "Release"
#else
#define BUILD_TYPE "Debug"

View file

@ -457,7 +457,6 @@ static bool create_userdata_path()
} else {
success = true;
}
porting::copyAssets();
#else
// Create user data directory
success = fs::CreateDir(porting::path_user);

View file

@ -69,10 +69,10 @@ void android_main(android_app *app)
/* TODO this doesn't work as expected, no idea why but there's a workaround */
/* for it right now */
extern "C" {
JNIEXPORT void JNICALL Java_net_minetest_MtNativeActivity_putMessageBoxResult(
JNIEXPORT void JNICALL Java_net_minetest_minetest_GameActivity_putMessageBoxResult(
JNIEnv * env, jclass thiz, jstring text)
{
errorstream << "Java_net_minetest_MtNativeActivity_putMessageBoxResult got: "
errorstream << "Java_net_minetest_minetest_GameActivity_putMessageBoxResult got: "
<< std::string((const char*)env->GetStringChars(text,0))
<< std::endl;
}
@ -107,17 +107,6 @@ jclass findClass(std::string classname)
return (jclass) jnienv->CallObjectMethod(cls, findClass, strClassName);
}
void copyAssets()
{
jmethodID assetcopy = jnienv->GetMethodID(nativeActivity,"copyAssets","()V");
if (assetcopy == 0) {
assert("porting::copyAssets unable to find copy assets method" == 0);
}
jnienv->CallVoidMethod(app_global->activity->clazz, assetcopy);
}
void initAndroid()
{
porting::jnienv = NULL;
@ -136,7 +125,7 @@ void initAndroid()
exit(-1);
}
nativeActivity = findClass("net/minetest/minetest/MtNativeActivity");
nativeActivity = findClass("net/minetest/minetest/GameActivity");
if (nativeActivity == 0) {
errorstream <<
"porting::initAndroid unable to find java native activity class" <<

View file

@ -48,11 +48,6 @@ void cleanupAndroid();
*/
void initializePathsAndroid();
/**
* use java function to copy media from assets to external storage
*/
void copyAssets();
/**
* show text input dialog in java
* @param acceptButton text to display on accept button

View file

@ -20,10 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "version.h"
#include "config.h"
#if defined(__ANDROID__)
#include "android_version.h"
#include "android_version_githash.h"
#elif defined(USE_CMAKE_CONFIG_H)
#if USE_CMAKE_CONFIG_H
#include "cmake_config_githash.h"
#endif