Skip to content

Commit 45ebb9e

Browse files
author
Chris Warren-Smith
committed
ANDROID: implemented support for editing with the system keypad
- Fixes for Pixel 9/Android 16
1 parent e536831 commit 45ebb9e

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

src/platform/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ android {
99
applicationId 'net.sourceforge.smallbasic'
1010
minSdkVersion 21
1111
targetSdkVersion 36
12-
versionCode 85
12+
versionCode 87
1313
versionName '12.31'
1414
resourceConfigurations += ['en']
1515
}

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,16 +1084,18 @@ private void setupInsetBaseOnResize() {
10841084
@NonNull
10851085
@Override
10861086
public WindowInsetsCompat onApplyWindowInsets(@NonNull View view, @NonNull WindowInsetsCompat insets) {
1087-
Log.d(TAG, "onApplyWindowInsets");
10881087
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
10891088
Insets navInsets = insets.getInsets(WindowInsetsCompat.Type.navigationBars());
10901089
Insets ime = insets.getInsets(WindowInsetsCompat.Type.ime());
10911090
boolean imeVisible = insets.isVisible(WindowInsetsCompat.Type.ime());
1092-
view.setPadding(0, 0, navInsets.right, navInsets.bottom);
10931091
int bottomInset = Math.max(systemBars.bottom, ime.bottom);
1094-
int width = view.getWidth();
1095-
int height = view.getHeight() - systemBars.top - bottomInset;
1096-
onResize(width, height, imeVisible ? 1 : -1);
1092+
int width = view.getWidth() - navInsets.right;
1093+
int height = view.getHeight() - (systemBars.top + bottomInset);
1094+
view.setPadding(0, 0, navInsets.right, navInsets.bottom);
1095+
if (width > 0 && height > 0) {
1096+
// ignore spurious transitional values
1097+
onResize(width, height, imeVisible ? 1 : -1);
1098+
}
10971099
return insets;
10981100
}
10991101
});

src/platform/android/jni/display.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ bool Canvas::create(int w, int h) {
5353
return result;
5454
}
5555

56-
void Canvas::drawRegion(Canvas *src, const MARect *srcRect, int destX, int destY) {
56+
void Canvas::drawRegion(Canvas *src, const MARect *srcRect, int destX, int destY) const {
5757
int srcH = srcRect->height;
5858
if (srcRect->top + srcRect->height > src->_h) {
5959
srcH = src->_h - srcRect->top;
@@ -65,7 +65,7 @@ void Canvas::drawRegion(Canvas *src, const MARect *srcRect, int destX, int destY
6565
}
6666
}
6767

68-
void Canvas::fillRect(int left, int top, int width, int height, pixel_t drawColor) {
68+
void Canvas::fillRect(int left, int top, int width, int height, pixel_t drawColor) const {
6969
int dtX = x();
7070
int dtY = y();
7171
uint8_t dR, dG, dB;

src/ui/canvas.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ struct Canvas {
4646
virtual ~Canvas();
4747

4848
bool create(int w, int h);
49-
void drawRegion(Canvas *src, const MARect *srcRect, int dstx, int dsty);
50-
void fillRect(int x, int y, int w, int h, pixel_t color);
49+
void drawRegion(Canvas *src, const MARect *srcRect, int dstx, int dsty) const;
50+
void fillRect(int x, int y, int w, int h, pixel_t color) const;
5151
void setClip(int x, int y, int w, int h);
5252
pixel_t *getLine(int y) const { return _pixels + (y * _w); }
5353
int x() const { return _clip ? _clip->left : 0; }

0 commit comments

Comments
 (0)