Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
porting_android.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2014 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#ifndef __ANDROID__
8#error This header has to be included on Android port only!
9#endif
10
12#include <string>
13
14namespace porting {
22void showTextInputDialog(const std::string &hint, const std::string &current, int editType);
23
30void showComboBoxDialog(const std::string *optionList, s32 listSize, s32 selectedIdx);
31
37void shareFileAndroid(const std::string &path);
38
39/*
40 * Types of Android input dialog:
41 * 1. Text input (single/multi-line text and password field)
42 * 2. Selection input (combo box)
43 */
45
46/*
47 * WORKAROUND for not working callbacks from Java -> C++
48 * Get the type of the last input dialog
49 */
51
52/*
53 * States of Android input dialog:
54 * 1. The dialog is currently shown.
55 * 2. The dialog has its input sent.
56 * 3. The dialog is canceled/dismissed.
57 */
59
60/*
61 * WORKAROUND for not working callbacks from Java -> C++
62 * Get the state of the input dialog
63 */
65
66/*
67 * WORKAROUND for not working callbacks from Java -> C++
68 * Get the text in the current/last input dialog
69 * This function clears the dialog state (set to canceled). Make sure to save
70 * the dialog state before calling this function.
71 */
72std::string getInputDialogMessage();
73
74/*
75 * WORKAROUND for not working callbacks from Java -> C++
76 * Get the selection in the current/last input dialog
77 * This function clears the dialog state (set to canceled). Make sure to save
78 * the dialog state before calling this function.
79 */
81
82
84
85float getDisplayDensity();
87
88}
core::vector2d< u32 > v2u32
Definition irr_v2d.h:14
Definition porting.cpp:78
int getInputDialogSelection()
Definition porting_android.cpp:227
AndroidDialogType getLastInputDialogType()
Definition porting_android.cpp:190
AndroidDialogState
Definition porting_android.h:58
@ DIALOG_SHOWN
Definition porting_android.h:58
@ DIALOG_CANCELED
Definition porting_android.h:58
@ DIALOG_INPUTTED
Definition porting_android.h:58
void shareFileAndroid(const std::string &path)
Opens a share intent to the file at path.
Definition porting_android.cpp:178
AndroidDialogType
Definition porting_android.h:44
@ SELECTION_INPUT
Definition porting_android.h:44
@ TEXT_INPUT
Definition porting_android.h:44
float getDisplayDensity()
Definition porting_android.cpp:237
void showTextInputDialog(const std::string &hint, const std::string &current, int editType)
Show a text input dialog in Java.
Definition porting_android.cpp:129
AndroidDialogState getInputDialogState()
Definition porting_android.cpp:202
void showComboBoxDialog(const std::string *optionList, s32 listSize, s32 selectedIdx)
Show a selection dialog in Java.
Definition porting_android.cpp:145
bool hasPhysicalKeyboardAndroid()
Definition porting_android.cpp:299
std::string getInputDialogMessage()
Definition porting_android.cpp:214
v2u32 getDisplaySize()
Definition porting_android.cpp:256