2014-04-21 14:10:59 +02:00
|
|
|
/*
|
|
|
|
Minetest
|
|
|
|
Copyright (C) 2014 celeron55, Perttu Ahola <celeron55@gmail.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2017-08-17 22:19:39 +02:00
|
|
|
|
|
|
|
#pragma once
|
2014-04-21 14:10:59 +02:00
|
|
|
|
|
|
|
#ifndef __ANDROID__
|
|
|
|
#error this include has to be included on android port only!
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
#include <android_native_app_glue.h>
|
|
|
|
#include <android/log.h>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace porting {
|
2020-05-06 14:25:57 +02:00
|
|
|
// java app
|
2014-04-21 14:10:59 +02:00
|
|
|
extern android_app *app_global;
|
|
|
|
|
2020-05-06 14:25:57 +02:00
|
|
|
// java <-> c++ interaction interface
|
2014-04-21 14:10:59 +02:00
|
|
|
extern JNIEnv *jnienv;
|
|
|
|
|
2020-05-06 14:25:57 +02:00
|
|
|
// do initialization required on android only
|
2014-04-21 14:10:59 +02:00
|
|
|
void initAndroid();
|
2020-05-06 14:25:57 +02:00
|
|
|
|
2014-04-21 14:10:59 +02:00
|
|
|
void cleanupAndroid();
|
|
|
|
|
|
|
|
/**
|
2015-08-24 23:00:06 +02:00
|
|
|
* Initializes path_* variables for Android
|
2014-04-21 14:10:59 +02:00
|
|
|
*/
|
2015-08-24 23:00:06 +02:00
|
|
|
void initializePathsAndroid();
|
2014-04-21 14:10:59 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* show text input dialog in java
|
|
|
|
* @param acceptButton text to display on accept button
|
|
|
|
* @param hint hint to show
|
|
|
|
* @param current initial value to display
|
|
|
|
* @param editType type of texfield
|
|
|
|
* (1==multiline text input; 2==single line text input; 3=password field)
|
|
|
|
*/
|
2020-05-06 14:25:57 +02:00
|
|
|
void showInputDialog(const std::string &acceptButton,
|
|
|
|
const std::string &hint, const std::string ¤t, int editType);
|
2014-04-21 14:10:59 +02:00
|
|
|
|
2020-12-19 14:27:15 +01:00
|
|
|
void openURIAndroid(const std::string &url);
|
2020-05-17 20:09:10 +02:00
|
|
|
|
2022-06-05 18:42:09 +02:00
|
|
|
/**
|
|
|
|
* Opens a share intent to the file at path
|
|
|
|
*
|
|
|
|
* @param path
|
|
|
|
*/
|
|
|
|
void shareFileAndroid(const std::string &path);
|
|
|
|
|
2014-04-21 14:10:59 +02:00
|
|
|
/**
|
|
|
|
* WORKAROUND for not working callbacks from java -> c++
|
|
|
|
* get current state of input dialog
|
|
|
|
*/
|
|
|
|
int getInputDialogState();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WORKAROUND for not working callbacks from java -> c++
|
|
|
|
* get text in current input dialog
|
|
|
|
*/
|
|
|
|
std::string getInputDialogValue();
|
|
|
|
|
2017-12-06 21:36:29 +01:00
|
|
|
#ifndef SERVER
|
|
|
|
float getDisplayDensity();
|
|
|
|
v2u32 getDisplaySize();
|
|
|
|
#endif
|
2023-06-05 12:02:10 +02:00
|
|
|
|
|
|
|
std::string getLanguageAndroid();
|
2014-04-21 14:10:59 +02:00
|
|
|
}
|