aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaksim <MoNTE48@mail.ua>2020-04-15 16:27:40 +0200
committerGitHub <noreply@github.com>2020-04-15 16:27:40 +0200
commit62ae7adab2bebde04864c12543caefbffab24963 (patch)
tree1cad2b08c94c2de26a39124f3b3dd0d513cbcc99 /src
parent8ae8c1600a66c724565ce7a70e0e5f542f12e38e (diff)
downloadminetest-62ae7adab2bebde04864c12543caefbffab24963.tar.gz
minetest-62ae7adab2bebde04864c12543caefbffab24963.tar.bz2
minetest-62ae7adab2bebde04864c12543caefbffab24963.zip
Android: add Android Studio support, completely redone java part (#9066)
Diffstat (limited to 'src')
-rw-r--r--src/config.h6
-rw-r--r--src/main.cpp1
-rw-r--r--src/porting_android.cpp17
-rw-r--r--src/porting_android.h5
-rw-r--r--src/version.cpp5
5 files changed, 7 insertions, 27 deletions
diff --git a/src/config.h b/src/config.h
index 039100914..9d58a8cc1 100644
--- a/src/config.h
+++ b/src/config.h
@@ -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"
diff --git a/src/main.cpp b/src/main.cpp
index 8df2fe7d3..db020661a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -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);
diff --git a/src/porting_android.cpp b/src/porting_android.cpp
index 7c74f7b5b..4130bdb6d 100644
--- a/src/porting_android.cpp
+++ b/src/porting_android.cpp
@@ -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" <<
diff --git a/src/porting_android.h b/src/porting_android.h
index 0b3f2575e..60eb2a9c0 100644
--- a/src/porting_android.h
+++ b/src/porting_android.h
@@ -49,11 +49,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
* @param hint hint to show
diff --git a/src/version.cpp b/src/version.cpp
index c0c59ee99..ae5ca3412 100644
--- a/src/version.cpp
+++ b/src/version.cpp
@@ -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