Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
porting_android.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2014 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation; either version 2.1 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public License along
16with this program; if not, write to the Free Software Foundation, Inc.,
1751 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*/
19
20#pragma once
21
22#ifndef __ANDROID__
23#error This header has to be included on Android port only!
24#endif
25
27#include <string>
28
29namespace porting {
37void showTextInputDialog(const std::string &hint, const std::string &current, int editType);
38
45void showComboBoxDialog(const std::string optionList[], s32 listSize, s32 selectedIdx);
46
52void shareFileAndroid(const std::string &path);
53
54/*
55 * Types of Android input dialog:
56 * 1. Text input (single/multi-line text and password field)
57 * 2. Selection input (combo box)
58 */
60
61/*
62 * WORKAROUND for not working callbacks from Java -> C++
63 * Get the type of the last input dialog
64 */
66
67/*
68 * States of Android input dialog:
69 * 1. The dialog is currently shown.
70 * 2. The dialog has its input sent.
71 * 3. The dialog is canceled/dismissed.
72 */
74
75/*
76 * WORKAROUND for not working callbacks from Java -> C++
77 * Get the state of the input dialog
78 */
80
81/*
82 * WORKAROUND for not working callbacks from Java -> C++
83 * Get the text in the current/last input dialog
84 * This function clears the dialog state (set to canceled). Make sure to save
85 * the dialog state before calling this function.
86 */
87std::string getInputDialogMessage();
88
89/*
90 * WORKAROUND for not working callbacks from Java -> C++
91 * Get the selection in the current/last input dialog
92 * This function clears the dialog state (set to canceled). Make sure to save
93 * the dialog state before calling this function.
94 */
96
97
99
100#ifndef SERVER
101float getDisplayDensity();
103#endif
104
105}
core::vector2d< u32 > v2u32
Definition: irr_v2d.h:29
Definition: porting.cpp:86
void showComboBoxDialog(const std::string optionList[], s32 listSize, s32 selectedIdx)
Show a selection dialog in Java.
Definition: porting_android.cpp:160
int getInputDialogSelection()
Definition: porting_android.cpp:242
AndroidDialogType getLastInputDialogType()
Definition: porting_android.cpp:205
AndroidDialogState
Definition: porting_android.h:73
@ DIALOG_SHOWN
Definition: porting_android.h:73
@ DIALOG_CANCELED
Definition: porting_android.h:73
@ DIALOG_INPUTTED
Definition: porting_android.h:73
void shareFileAndroid(const std::string &path)
Opens a share intent to the file at path.
Definition: porting_android.cpp:193
AndroidDialogType
Definition: porting_android.h:59
@ SELECTION_INPUT
Definition: porting_android.h:59
@ TEXT_INPUT
Definition: porting_android.h:59
float getDisplayDensity()
Definition: porting_android.cpp:253
void showTextInputDialog(const std::string &hint, const std::string &current, int editType)
Show a text input dialog in Java.
Definition: porting_android.cpp:144
AndroidDialogState getInputDialogState()
Definition: porting_android.cpp:217
bool hasPhysicalKeyboardAndroid()
Definition: porting_android.cpp:315
std::string getInputDialogMessage()
Definition: porting_android.cpp:229
v2u32 getDisplaySize()
Definition: porting_android.cpp:272