Skip to content

Commit 34a9b3e

Browse files
committed
ANDROID: Hide keypad on run.
Show keypad for INPUT, then re-hide on completion.
1 parent d2f7f26 commit 34a9b3e

File tree

9 files changed

+29
-12
lines changed

9 files changed

+29
-12
lines changed

src/lib/maapi.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,12 @@ int maGetMilliSecondCount(void);
292292
/**
293293
* Shows the virtual keyboard.
294294
*/
295-
int maShowVirtualKeyboard(void);
295+
void maShowVirtualKeyboard(void);
296+
297+
/**
298+
* Hides the virtual keyboard.
299+
*/
300+
void maHideVirtualKeyboard(void);
296301

297302
/**
298303
* There is a FIFO buffer that contains up to #EVENT_BUFFER_SIZE events.
@@ -317,7 +322,7 @@ int maShowVirtualKeyboard(void);
317322
*
318323
* \returns \> 0 on success, or zero if the buffer is empty.
319324
*/
320-
int maGetEvent(MAEvent* event);
325+
int maGetEvent(MAEvent *event);
321326

322327
/**
323328
* Suspends execution until there is an event in the buffer,

src/lib/miniaudio

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import android.os.Bundle;
2626
import android.os.Environment;
2727
import android.os.Handler;
28-
import android.provider.Settings;
2928
import android.util.Base64;
3029
import android.util.DisplayMetrics;
3130
import android.util.Log;

src/platform/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
mavenCentral()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:4.2.1'
8+
classpath 'com.android.tools.build:gradle:7.0.0'
99
}
1010
}
1111

src/platform/android/jni/runtime.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,7 @@ void System::editSource(strlib::String loadPath, bool restoreOnExit) {
11481148
if (!_output->removeInput(editWidget)) {
11491149
trace("Failed to remove editor input");
11501150
}
1151+
runtime->showKeypad(false);
11511152
_editor = editWidget;
11521153
_editor->setFocus(false);
11531154
} else {
@@ -1183,9 +1184,12 @@ void maWait(int timeout) {
11831184
runtime->pause(timeout);
11841185
}
11851186

1186-
int maShowVirtualKeyboard(void) {
1187+
void maShowVirtualKeyboard(void) {
11871188
runtime->showKeypad(true);
1188-
return 0;
1189+
}
1190+
1191+
void maHideVirtualKeyboard(void) {
1192+
runtime->showKeypad(false);
11891193
}
11901194

11911195
//

src/platform/fltk/display.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,10 @@ void maUpdateScreen(void) {
478478
((::GraphicsWidget *)graphics)->redraw();
479479
}
480480

481-
int maShowVirtualKeyboard(void) {
482-
return 0;
481+
void maShowVirtualKeyboard(void) {
482+
// not implemented
483+
}
484+
485+
void maHideVirtualKeyboard(void) {
486+
// not implemented
483487
}

src/platform/sdl/display.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ void maUpdateScreen(void) {
191191
((::Graphics *)graphics)->redraw();
192192
}
193193

194-
int maShowVirtualKeyboard(void) {
195-
return 0;
194+
void maShowVirtualKeyboard(void) {
195+
// not implemented
196+
}
197+
198+
void maHideVirtualKeyboard(void) {
199+
// not implemented
196200
}

src/ui/system.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ char *System::getText(char *dest, int maxSize) {
322322
_output->print(dest);
323323
}
324324

325+
maHideVirtualKeyboard();
325326
showCursor(kArrow);
326327
_output->removeInput(widget);
327328
delete widget;

0 commit comments

Comments
 (0)