Luanti 5.15.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
44void setPlayingNowNotification(bool show);
45
46/*
47 * Types of Android input dialog:
48 * 1. Text input (single/multi-line text and password field)
49 * 2. Selection input (combo box)
50 */
52
53/*
54 * WORKAROUND for not working callbacks from Java -> C++
55 * Get the type of the last input dialog
56 */
58
59/*
60 * States of Android input dialog:
61 * 1. The dialog is currently shown.
62 * 2. The dialog has its input sent.
63 * 3. The dialog is canceled/dismissed.
64 */
66
67/*
68 * WORKAROUND for not working callbacks from Java -> C++
69 * Get the state of the input dialog
70 */
72
73/*
74 * WORKAROUND for not working callbacks from Java -> C++
75 * Get the text in the current/last input dialog
76 * This function clears the dialog state (set to canceled). Make sure to save
77 * the dialog state before calling this function.
78 */
79std::string getInputDialogMessage();
80
81/*
82 * WORKAROUND for not working callbacks from Java -> C++
83 * Get the selection 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 */
88
89
91
92float getDisplayDensity();
94
95}
core::vector2d< u32 > v2u32
Definition irr_v2d.h:14
Definition porting.cpp:85
int getInputDialogSelection()
Definition porting_android.cpp:239
void setPlayingNowNotification(bool show)
Shows/hides notification that the game is running.
Definition porting_android.cpp:190
AndroidDialogType getLastInputDialogType()
Definition porting_android.cpp:202
AndroidDialogState
Definition porting_android.h:65
@ DIALOG_SHOWN
Definition porting_android.h:65
@ DIALOG_CANCELED
Definition porting_android.h:65
@ DIALOG_INPUTTED
Definition porting_android.h:65
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:51
@ SELECTION_INPUT
Definition porting_android.h:51
@ TEXT_INPUT
Definition porting_android.h:51
float getDisplayDensity()
Definition porting_android.cpp:249
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:214
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:311
std::string getInputDialogMessage()
Definition porting_android.cpp:226
v2u32 getDisplaySize()
Definition porting_android.cpp:268