Skip to content

Commit b74ec59

Browse files
committed
ANDROID: complain when samsum keyboard detected
1 parent 221ec0f commit b74ec59

File tree

8 files changed

+21
-9
lines changed

8 files changed

+21
-9
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2020-05-11 (0.12.19)
2+
ANDROID: complain when samsung keyboard detected
3+
COMMON: fix compile warnings
4+
15
2020-05-11 (0.12.19)
26
FLTK: Fix compile warnings with updated gcc
37

src/common/brun.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ void cmd_chain(void) {
352352
if (var.type == V_STR) {
353353
if (access(var.v.p.ptr, R_OK) == 0) {
354354
// argument is a file name
355-
int h = open(var.v.p.ptr, O_BINARY | O_RDONLY, 0644);
355+
int h = open(var.v.p.ptr, O_BINARY | O_RDONLY);
356356
if (h != -1) {
357357
struct stat st;
358358
if (fstat(h, &st) == 0) {
@@ -1144,7 +1144,7 @@ int brun_create_task(const char *filename, byte *preloaded_bc, int libf) {
11441144
return search_task(fname);
11451145
}
11461146
// open & load
1147-
int h = open(fname, O_RDWR | O_BINARY, 0660);
1147+
int h = open(fname, O_RDWR | O_BINARY);
11481148
if (h == -1) {
11491149
panic("File '%s' not found", fname);
11501150
}

src/common/units.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ int open_unit(const char *file) {
147147
}
148148

149149
// open unit
150-
h = open(unitname, O_RDWR | O_BINARY, 0660);
150+
h = open(unitname, O_RDWR | O_BINARY);
151151
if (h == -1) {
152152
return -1;
153153
}

src/platform/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
22

33
android {
44
// app can use the API features included in this API level and lower.
5-
compileSdkVersion 28
5+
compileSdkVersion 29
66

77
// can override some attributes in main/AndroidManifest.xml
88
defaultConfig {
99
applicationId 'net.sourceforge.smallbasic'
1010
minSdkVersion 16
11-
targetSdkVersion 28
11+
targetSdkVersion 29
1212
versionCode 39
1313
versionName "0.12.17"
1414
resConfigs "en"

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import android.os.Bundle;
2525
import android.os.Environment;
2626
import android.os.Handler;
27+
import android.provider.Settings;
2728
import android.util.Base64;
2829
import android.util.DisplayMetrics;
2930
import android.util.Log;
@@ -82,7 +83,7 @@
8283
/**
8384
* Extends NativeActivity to provide interface methods for runtime.cpp
8485
*
85-
* @author chrisws
86+
* @author Chris Warren-Smith
8687
*/
8788
public class MainActivity extends NativeActivity {
8889
private static final String TAG = "smallbasic";
@@ -586,11 +587,17 @@ public void onClick(DialogInterface dialog, int which) {}
586587
public void showKeypad(final boolean show) {
587588
Log.i(TAG, "showKeypad: " + show);
588589
final View view = getWindow().getDecorView();
590+
final Activity activity = this;
589591
runOnUiThread(new Runnable() {
590592
public void run() {
591593
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
592594
if (imm != null) {
593595
if (show) {
596+
String id = Settings.Secure.getString(activity.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
597+
if ("com.sec.android.inputmethod/.SamsungKeypad".equals(id)) {
598+
String message = getResources().getString(R.string.samsung_keyboard);
599+
Toast.makeText(activity, message, Toast.LENGTH_LONG).show();
600+
}
594601
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
595602
} else {
596603
imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package net.sourceforge.smallbasic;
22

3-
import java.util.Locale;
4-
53
import android.content.Context;
64
import android.speech.tts.TextToSpeech;
75
import android.speech.tts.TextToSpeech.OnInitListener;
86
import android.util.Log;
97

8+
import java.util.Locale;
9+
1010
class TextToSpeechAdapter implements OnInitListener {
1111
private static final String TAG = "smallbasic";
1212
private final TextToSpeech _tts;

src/platform/android/app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<string name="app_name">SmallBASIC</string>
4+
<string name="samsung_keyboard">Samsung keyboard not supported. Please use an alternative keyboard.</string>
45
<style name="SBTheme" parent="android:Theme.Holo.Light">
56
<item name="android:windowActionBar">false</item>
67
<item name="android:windowNoTitle">true</item>

src/ui/system.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ char *System::readSource(const char *fileName) {
594594
} else {
595595
buffer = loadResource(fileName);
596596
if (!buffer) {
597-
int h = open(fileName, O_BINARY | O_RDONLY, 0644);
597+
int h = open(fileName, O_BINARY | O_RDONLY);
598598
if (h != -1) {
599599
struct stat st;
600600
if (fstat(h, &st) == 0) {

0 commit comments

Comments
 (0)