Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy IntegerKeyboard code into app instead of using NPM package #1449

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions components/keyboards/IntegerKeyboard.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
sub init()
m.top.keyGrid.keyDefinitionUri = "pkg:/components/keyboards/IntegerKeyboardKDF.json"
end sub

function onKeyEvent(key as string, press as boolean) as boolean
if key = "back"
m.top.escape = key
return true
end if

if not press then return false

if key = "left"
if m.top.textEditBox.hasFocus()
m.top.escape = key
return true
else if m.top.focusedChild.keyFocused = "1"
m.top.escape = key
return true
else if m.top.focusedChild.keyFocused = "4"
m.top.escape = key
return true
else if m.top.focusedChild.keyFocused = "7"
m.top.escape = key
return true
else if m.top.focusedChild.keyFocused = "backspace"
m.top.escape = key
return true
end if
end if

if key = "right"
if m.top.textEditBox.hasFocus()
m.top.escape = key
return true
else if m.top.focusedChild.keyFocused = "3"
m.top.escape = key
return true
else if m.top.focusedChild.keyFocused = "6"
m.top.escape = key
return true
else if m.top.focusedChild.keyFocused = "9"
m.top.escape = key
return true
else if m.top.focusedChild.keyFocused = "submit"
m.top.escape = key
return true
end if
end if

if key = "up"
if m.top.textEditBox.hasFocus()
m.top.escape = key
return true
end if
end if

if key = "down"
if m.top.focusedChild.keyFocused = "0"
m.top.escape = key
return true
else if m.top.focusedChild.keyFocused = "backspace"
m.top.escape = key
return true
else if m.top.focusedChild.keyFocused = "submit"
m.top.escape = key
return true
end if
end if

return false
end function

function keySelected(key as string) as boolean
if key = "submit"
m.top.submit = true
return true
end if

return false
end function
9 changes: 9 additions & 0 deletions components/keyboards/IntegerKeyboard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>

<component name="IntegerKeyboard" extends="DynamicCustomKeyboard">
<interface>
<function name="keySelected" />
<field id="submit" type="bool" alwaysNotify="true" />
<field id="escape" type="string" alwaysNotify="true" />
</interface>
</component>
73 changes: 73 additions & 0 deletions components/keyboards/IntegerKeyboardKDF.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"keyboardWidthFHD": 495,
"keyboardHeightFHD": 300,
"keyboardWidthHD": 324,
"keyboardHeightHD": 200,
"sections": [
{
"grids": [
{
"rows": [
{
"keys": [
{
"label": "1"
},
{
"label": "2"
},
{
"label": "3"
}
]
},
{
"keys": [
{
"label": "4"
},
{
"label": "5"
},
{
"label": "6"
}
]
},
{
"keys": [
{
"label": "7"
},
{
"label": "8"
},
{
"label": "9"
}
]
},
{
"keys": [
{
"icon": "theme:DKB_DeleteKeyBitmap",
"focusIcon": "theme:DKB_DeleteKeyFocusBitmap",
"autoRepeat": 1,
"strOut": "backspace"
},
{
"label": "0"
},
{
"icon": "pkg:/images/icons/check_white.png",
"focusIcon": "pkg:/images/icons/check_black.png",
"strOut": "submit"
}
]
}
]
}
]
}
]
}
2 changes: 1 addition & 1 deletion components/settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</ContentNode>
</RadioButtonList>

<intkeyboard_integerKeyboard translation="[1034, 510]" id="integerSetting" maxLength="3" domain="numeric" visible="false" />
<IntegerKeyboard translation="[1034, 510]" id="integerSetting" maxLength="3" domain="numeric" visible="false" />

</children>
</component>
7 changes: 0 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"@rokucommunity/bslib": "0.1.1",
"bgv": "npm:[email protected]",
"brighterscript-formatter": "1.6.34",
"intKeyboard": "npm:[email protected]",
"log": "npm:[email protected]",
"sob": "npm:[email protected]"
},
Expand Down