mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Mobile: Split KEYBOARD_TYPE_NUMBER into KEYBOARD_TYPE_NUMBER and KEYBOARD_TYPE_INTEGER
Only makes a difference on iOS devices though apparently
This commit is contained in:
parent
93aee245a6
commit
7584819595
5 changed files with 13 additions and 10 deletions
|
@ -670,7 +670,8 @@ public class MainActivity extends Activity
|
|||
public int getKeyboardType() {
|
||||
// TYPE_CLASS_TEXT, TYPE_CLASS_NUMBER, TYPE_TEXT_VARIATION_PASSWORD - API level 3
|
||||
if (keyboardType == 2) return InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
|
||||
if (keyboardType == 1) return InputType.TYPE_CLASS_NUMBER;
|
||||
if (keyboardType == 1) return InputType.TYPE_CLASS_NUMBER; // KEYBOARD_TYPE_NUMERIC
|
||||
if (keyboardType == 3) return InputType.TYPE_CLASS_INTEGER; // KEYBOARD_TYPE_INTEGER
|
||||
return InputType.TYPE_CLASS_TEXT;
|
||||
}
|
||||
|
||||
|
|
|
@ -430,7 +430,7 @@ static void ColoursScreen_Init(struct LScreen* s_) {
|
|||
|
||||
for (i = 0; i < 5 * 3; i++) {
|
||||
LInput_Init(s_, &s->iptColours[i], 55, NULL);
|
||||
s->iptColours[i].type = KEYBOARD_TYPE_NUMBER;
|
||||
s->iptColours[i].type = KEYBOARD_TYPE_INTEGER;
|
||||
s->iptColours[i].TextFilter = ColoursScreen_InputFilter;
|
||||
s->iptColours[i].TextChanged = ColoursScreen_TextChanged;
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ static void MFAScreen_Init(struct LScreen* s_) {
|
|||
|
||||
s->btnSignIn.OnClick = MFAScreen_SignIn;
|
||||
s->btnCancel.OnClick = MFAScreen_Cancel;
|
||||
s->iptCode.type = KEYBOARD_TYPE_NUMBER;
|
||||
s->iptCode.type = KEYBOARD_TYPE_INTEGER;
|
||||
}
|
||||
|
||||
static void MFAScreen_Show(struct LScreen* s_) {
|
||||
|
|
10
src/Menus.c
10
src/Menus.c
|
@ -1077,7 +1077,7 @@ static void GenLevelScreen_Make(struct GenLevelScreen* s, int i, int def) {
|
|||
TextWidget_Init(&s->labels[i]);
|
||||
s->labels[i].col = PackedCol_Make(224, 224, 224, 255);
|
||||
/* TODO placeholder */
|
||||
s->inputs[i].onscreenType = KEYBOARD_TYPE_NUMBER;
|
||||
s->inputs[i].onscreenType = KEYBOARD_TYPE_INTEGER;
|
||||
}
|
||||
|
||||
static int GenLevelScreen_KeyDown(void* screen, int key) {
|
||||
|
@ -2121,7 +2121,6 @@ static void MenuInputOverlay_Default(void* screen, void* widget) {
|
|||
|
||||
static void MenuInputOverlay_Init(void* screen) {
|
||||
struct MenuInputOverlay* s = (struct MenuInputOverlay*)screen;
|
||||
cc_bool is_number;
|
||||
s->widgets = menuInput_widgets;
|
||||
s->numWidgets = Array_Elems(menuInput_widgets);
|
||||
s->maxVertices = MENUINPUT_MAX_VERTICES;
|
||||
|
@ -2130,8 +2129,11 @@ static void MenuInputOverlay_Init(void* screen) {
|
|||
ButtonWidget_Init(&s->Default, 200, MenuInputOverlay_Default);
|
||||
ButtonWidget_Init(&s->ok, Input_TouchMode ? 200 : 40, MenuInputOverlay_OK);
|
||||
|
||||
is_number = s->desc->VTABLE == &IntInput_VTABLE || s->desc->VTABLE == &FloatInput_VTABLE;
|
||||
s->input.onscreenType = is_number ? KEYBOARD_TYPE_NUMBER : KEYBOARD_TYPE_TEXT;
|
||||
if (s->desc->VTABLE == &IntInput_VTABLE) {
|
||||
s->input.onscreenType = KEYBOARD_TYPE_INTEGER;
|
||||
} else if (s->desc->VTABLE == &FloatInput_VTABLE) {
|
||||
s->input.onscreenType = KEYBOARD_TYPE_NUMBER;
|
||||
}
|
||||
}
|
||||
|
||||
static void MenuInputOverlay_Update(void* screen, double delta) {
|
||||
|
|
|
@ -34,7 +34,7 @@ struct Bitmap;
|
|||
struct DynamicLibSym;
|
||||
/* The states the window can be in. */
|
||||
enum WindowState { WINDOW_STATE_NORMAL, WINDOW_STATE_FULLSCREEN, WINDOW_STATE_MINIMISED };
|
||||
enum KeyboardType { KEYBOARD_TYPE_TEXT, KEYBOARD_TYPE_NUMBER, KEYBOARD_TYPE_PASSWORD };
|
||||
enum KeyboardType { KEYBOARD_TYPE_TEXT, KEYBOARD_TYPE_NUMBER, KEYBOARD_TYPE_PASSWORD, KEYBOARD_TYPE_INTEGER };
|
||||
enum SoftKeyboard { SOFT_KEYBOARD_NONE, SOFT_KEYBOARD_RESIZE, SOFT_KEYBOARD_SHIFT };
|
||||
/* (can't name these structs Window/Display, as that conflicts with X11's Window/Display typedef) */
|
||||
|
||||
|
|
|
@ -595,10 +595,10 @@ mergeInto(LibraryManager.library, {
|
|||
var elem = window.cc_inputElem;
|
||||
var shown = true;
|
||||
if (!elem) {
|
||||
if (type == 1) {
|
||||
if (type == 1 || type == 3) { // KEYBOARD_TYPE_NUMBER, KEYBOARD_TYPE_INTEGER
|
||||
elem = document.createElement('input');
|
||||
elem.setAttribute('type', 'text')
|
||||
elem.setAttribute('inputmode', 'decimal');
|
||||
elem.setAttribute('inputmode', type == 1 ? 'decimal' : 'numeric');
|
||||
} else {
|
||||
elem = document.createElement('textarea');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue