Skip to content

Commit a5c4401

Browse files
author
Chris Warren-Smith
committed
ANDROID: fix back key handling on < android 16
1 parent 0c8b7bd commit a5c4401

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/platform/android/app/src/main/java/net/sourceforge/smallbasic/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public int getWindowHeight() {
430430
}
431431

432432
public boolean isPredictiveBack() {
433-
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU;
433+
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA;
434434
}
435435

436436
public boolean loadModules() {

src/ui/keypad.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "keypad.h"
1616

1717
// the size at which the tablet layout is selected
18-
constexpr int WIDE_LAYOUT = 600;
18+
constexpr int WIDE_LAYOUT = 1100;
1919

2020
// the size of PNGs as defined in keypad/build.sh
2121
constexpr int IMAGE_SIZE = 30;
@@ -222,10 +222,10 @@ namespace TabletKeypadLayout {
222222
{
223223
{K_LINE_UP, K_PAGE_UP, K_LINE_UP, K_PAGE_UP},
224224
{K_LINE_DOWN, K_PAGE_DOWN, K_LINE_DOWN, K_PAGE_DOWN},
225+
{K_LEFT, K_LEFT, K_LEFT, K_LEFT},
225226
{K_LPAREN, K_SLASH, K_COMMA, K_LBRACKET},
226227
{K_SPACE, K_SPACE, K_SPACE, K_SPACE},
227228
{K_RPAREN, K_HASH, K_EQUALS, K_RBRACKET},
228-
{K_LEFT, K_LEFT, K_LEFT, K_LEFT},
229229
{K_RIGHT, K_RIGHT, K_RIGHT, K_RIGHT},
230230
{K_ENTER, K_ENTER, K_ENTER, K_ENTER},
231231
{K_NULL},
@@ -602,7 +602,7 @@ void Key::onClick(KeypadDrawContext *context) const {
602602
event->key = SB_KEY_RIGHT;
603603
break;
604604
default:
605-
event->key = (unsigned char)context->getKey(_key);
605+
event->key = static_cast<unsigned char>(context->getKey(_key));
606606
context->onClick(_key);
607607
break;
608608
}
@@ -692,7 +692,7 @@ void Keypad::layout(int x, int y, int w, int h) {
692692
} else if (isArrow(key->_key._lower)) {
693693
keyWidth = static_cast<int>(keyWidth * 1.2);
694694
} else if (!key->_printable && key->_key._lower != K_TAG) {
695-
const int numKeys = 2;
695+
constexpr int numKeys = 2;
696696
keyWidth = (_width - ((cols - numKeys) * keyW)) / numKeys;
697697
} else if (key->_key._lower == K_SPACE) {
698698
keyWidth = (_layout->getSpaceCols() * keyW);
@@ -726,7 +726,7 @@ int Keypad::layoutHeight(int screenHeight) {
726726
}
727727

728728
void Keypad::clicked(int x, int y, bool pressed) {
729-
Key *down = _pressed;
729+
const Key *down = _pressed;
730730
_pressed = nullptr;
731731
for (const auto key : _keys) {
732732
if (key->inside(x, y)) {

0 commit comments

Comments
 (0)