Skip to content

Commit

Permalink
chore(developer): Merge branch 'master' into test/developer/kmcmplib-…
Browse files Browse the repository at this point in the history
…compiler-unit-tests
  • Loading branch information
markcsinclair committed May 20, 2024
2 parents 474caec + 3d29143 commit 3ed3863
Show file tree
Hide file tree
Showing 213 changed files with 31,250 additions and 16,492 deletions.
38 changes: 38 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Keyman Version History

## 18.0.38 alpha 2024-05-17

* chore(common): Auto-generate minimum-versions.md from min-ver.sh (#11399)
* fix(android): Replace deprecated APIs for Display, Size, Metrics (#11436)
* chore(common): Clear whatsnew help files (#11469)

## 18.0.37 alpha 2024-05-16

* chore(android): update Gradle wrapper version (#11437)
* fix(android/engine): Handle globe key on lock screen (#11458)
* chore(oem/fv/ios): Remove build_keyboards.sh script (#11438)

## 18.0.36 alpha 2024-05-15

* chore: merge beta into master, final (#11445)
* chore(web): updates chai, @types/chai dependencies (#11318)
* chore(web): updates most @types/node dependencies, makes them consistent (#11319)
* chore(web): adds '@web/test-runner' and related packages (#11323)
* chore(web): EventEmitter3, sinon dependency updates (#11402)

## 18.0.35 alpha 2024-05-14

* (#11340)

## 18.0.34 alpha 2024-05-13

* feat(windows): Don't install desktop shortcut for Keyman for windows on installation (#11401)
* feat(common): improve builder parameter passing for child and dep builds (#11410)
* chore: merge 17.0 beta into master A17S2 (#11431)
* chore(android): Update dependencies (#11393)

## 18.0.33 alpha 2024-05-10

* chore(common): Merge beta to master for Sprint A18S1 (part 2) (#11413)
Expand Down Expand Up @@ -144,6 +175,13 @@
* chore(common): move to 18.0 alpha (#10713)
* chore: move to 18.0 alpha

## 17.0.323 beta 2024-05-13

* chore(windows): Update crowdin string for Khmer (#11409)
* fix(android): disable Sentry session tracking (#11419)
* fix(mac): restore OSK keys that became invisible in mac OS 14 Sonoma (#11388)
* chore(android,ios): Add fv_nlakapamuxcheen (#11405)

## 17.0.322 beta 2024-05-10

* fix(web): fixes illegal KMW event state - can't focus a null element (#11385)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.0.34
18.0.39
4 changes: 2 additions & 2 deletions android/KMAPro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0'
classpath 'com.android.tools.build:gradle:7.4.2'
// sentry-android-gradle-plugin 2.1.5+ requires AGP 7.0
classpath 'io.sentry:sentry-android-gradle-plugin:2.1.2'
classpath 'io.sentry:sentry-android-gradle-plugin:4.5.1'
classpath 'name.remal:gradle-plugins:1.5.0'

// From jcenter() which could be sunset in future
Expand Down
2 changes: 1 addition & 1 deletion android/KMAPro/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 5 additions & 5 deletions android/KMAPro/kMAPro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'com.android.application'
id 'io.sentry.android.gradle'
// https://github.com/Triple-T/gradle-play-publisher/issues/947#issuecomment-843634852
id 'com.github.triplet.play' version '3.8.1' apply false
id 'com.github.triplet.play' version '3.9.1' apply false
id 'name.remal.default-plugins'
}

Expand Down Expand Up @@ -150,12 +150,12 @@ repositories {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.6.0-rc01'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.stepstone.stepper:material-stepper:4.3.1'
api(name: 'keyman-engine', ext: 'aar')
implementation 'io.sentry:sentry-android:6.9.2'
implementation 'androidx.preference:preference:1.2.0'
implementation 'io.sentry:sentry-android:7.8.0'
implementation 'androidx.preference:preference:1.2.1'
implementation "com.android.installreferrer:installreferrer:2.2"

// Add dependency for generating QR Codes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ public void onStartInput(EditorInfo attribute, boolean restarting) {
InputConnection ic = getCurrentInputConnection();
if (ic != null) {
ExtractedText icText = ic.getExtractedText(new ExtractedTextRequest(), 0);
if (icText != null) {
/*
We do sometimes receive null `icText.text`, even though
getExtractedText() docs does not list this as a possible
return value, so we test for that as well (#11479)
*/
if (icText != null && icText.text != null) {
boolean didUpdateText = KMManager.updateText(KeyboardType.KEYBOARD_TYPE_SYSTEM, icText.text.toString());
boolean didUpdateSelection = KMManager.updateSelectionRange(KeyboardType.KEYBOARD_TYPE_SYSTEM);
if (!didUpdateText || !didUpdateSelection)
Expand Down Expand Up @@ -218,9 +223,7 @@ public void onComputeInsets(InputMethodService.Insets outInsets) {
super.onComputeInsets(outInsets);

// We should extend the touchable region so that Keyman sub keys menu can receive touch events outside the keyboard frame
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
Point size = new Point(0, 0);
wm.getDefaultDisplay().getSize(size);
Point size = KMManager.getWindowSize(getApplicationContext());

int inputViewHeight = 0;
if (inputView != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public void onClick(DialogInterface dialog, int which) {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
overridePendingTransition(0, android.R.anim.fade_out);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ public boolean onSupportNavigateUp() {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public boolean onSupportNavigateUp() {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,7 @@ public void resizeTextView(boolean isKeyboardVisible) {
if (resourceId > 0)
statusBarHeight = getResources().getDimensionPixelSize(resourceId);

Point size = new Point(0, 0);
getWindowManager().getDefaultDisplay().getSize(size);
Point size = KMManager.getWindowSize(context);
int screenHeight = size.y;
Log.d(TAG, "Main resizeTextView bannerHeight: " + bannerHeight);
textView.setHeight(screenHeight - statusBarHeight - actionBarHeight - bannerHeight - keyboardHeight);
Expand Down Expand Up @@ -867,9 +866,7 @@ public static void cleanupPackageInstall() {
}

public static Drawable getActionBarDrawable(Context context) {
Point size = new Point();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
wm.getDefaultDisplay().getSize(size);
Point size = KMManager.getWindowSize(context);
int width = size.x;

TypedValue outValue = new TypedValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ protected void onNewIntent(Intent intent) {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
overridePendingTransition(0, android.R.anim.fade_out);
}
Expand Down
14 changes: 7 additions & 7 deletions android/KMEA/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ android {

dependencies {
// 1.6.0-rc01 needed to resolve https://issuetracker.google.com/issues/238425626
implementation 'androidx.appcompat:appcompat:1.6.0-rc01' // 1.5.1
implementation 'androidx.appcompat:appcompat:1.6.1'
// material:1.7.0 will need Gradle plugin 7.1.0+
implementation 'com.google.android.material:material:1.6.0'
implementation 'commons-io:commons-io:2.6'
implementation 'io.sentry:sentry-android:6.9.2'
implementation 'androidx.preference:preference:1.2.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'commons-io:commons-io:2.13.0'
implementation 'io.sentry:sentry-android:7.8.0'
implementation 'androidx.preference:preference:1.2.1'

// Robolectric
testImplementation 'androidx.test:core:1.5.0'
testImplementation 'androidx.test.ext:junit:1.1.4'
testImplementation 'org.robolectric:robolectric:4.8.1'
testImplementation 'androidx.test.ext:junit:1.1.5'
testImplementation 'org.robolectric:robolectric:4.10.3'

// Generate QR Codes
implementation ('com.github.kenglxn.QRGen:android:3.0.1') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,10 +907,7 @@ private void showSuggestionLongpress(Context context) {
rotateSuggestions.setClickable(false);

// Compute the actual display position (offset coordinate by actual screen pos of kbd)
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics metrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(metrics);
float density = metrics.density;
float density = KMManager.getWindowDensity(context);

int posX, posY;
if (keyboardType == KeyboardType.KEYBOARD_TYPE_INAPP) {
Expand Down
49 changes: 47 additions & 2 deletions android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,24 @@
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Typeface;
import android.inputmethodservice.InputMethodService;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.IBinder;
import android.text.InputType;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.Display;
import android.view.Surface;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowMetrics;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
Expand Down Expand Up @@ -2005,7 +2009,20 @@ public static void removeKeyboardEventListener(OnKeyboardEventListener listener)
}

public static int getOrientation(Context context) {
Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
Display display;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// https://developer.android.com/reference/android/content/Context#getDisplay()
try {
display = context.getDisplay();
} catch (UnsupportedOperationException e) {
// if the method is called on an instance that is not associated with any display.
return context.getResources().getConfiguration().orientation;
}
} else {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
// Deprecated in API 30
display = wm.getDefaultDisplay();
}
int rotation = display.getRotation();
if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) {
return Configuration.ORIENTATION_PORTRAIT;
Expand Down Expand Up @@ -2052,6 +2069,34 @@ public static void applyKeyboardHeight(Context context, int height) {
}
}

/**
* Get the size of the area the window would occupy.
* API 30+
* https://developer.android.com/reference/android/view/WindowManager#getCurrentWindowMetrics()
* @param context
* @return Point (width, height)
*/
public static Point getWindowSize(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
// Deprecated in API 30
Point size = new Point(0, 0);
wm.getDefaultDisplay().getSize(size);
return size;
}

WindowMetrics windowMetrics = wm.getCurrentWindowMetrics();
return new Point(
windowMetrics.getBounds().width(),
windowMetrics.getBounds().height());
}

public static float getWindowDensity(Context context) {
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
Log.d(TAG, "KMManager: metrics.density " + metrics.density);
return metrics.density;
}

protected static void setPersistentShouldShowHelpBubble(boolean flag) {
SharedPreferences prefs = appContext.getSharedPreferences(appContext.getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
Expand Down Expand Up @@ -2361,7 +2406,7 @@ public static void handleGlobeKeyAction(Context context, boolean globeKeyDown, K
if (KMManager.shouldAllowSetKeyboard()) {
// inKeyguardRestrictedInputMode() deprecated, so check isKeyguardLocked() to determine if screen is locked
if (isLocked()) {
if (keyboardType == KeyboardType.KEYBOARD_TYPE_SYSTEM && globeKeyState == GlobeKeyState.GLOBE_KEY_STATE_UP) {
if (keyboardType == KeyboardType.KEYBOARD_TYPE_SYSTEM && globeKeyState == GlobeKeyState.GLOBE_KEY_STATE_DOWN) {
doGlobeKeyLockscreenAction(context);
}
// clear globeKeyState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.RectF;
import android.graphics.Shader;
import android.util.AttributeSet;
Expand All @@ -31,13 +32,11 @@ final class KMPopoverView extends View {

public KMPopoverView(Context context, AttributeSet attrs) {
super(context, attrs);
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics metrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(metrics);
density = metrics.density;
Point size = KMManager.getWindowSize(context);
density = KMManager.getWindowDensity(context);

viewWidth = metrics.widthPixels;
viewHeight = metrics.heightPixels;
viewWidth = size.x;
viewHeight = size.y;
borderRadius = 6 * density;
strokeWidth = 2.0f;
bgColor = context.getResources().getColor(R.color.popup_bg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ public boolean onSupportNavigateUp() {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ public boolean onSupportNavigateUp() {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}

Expand Down
4 changes: 2 additions & 2 deletions android/KMEA/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0'
classpath 'com.android.tools.build:gradle:7.4.2'
// io.sentry:sentry-android-gradle-plugin not available for library project
classpath 'io.sentry:sentry-android:6.9.2'
classpath 'io.sentry:sentry-android:7.8.0'
classpath 'name.remal:gradle-plugins:1.5.0'
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/KMEA/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 4 additions & 4 deletions android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Keyman Engine for Android library (**keyman-engine.aar**) is now ready to be imp
4. Check that the `android{}` object, includes the following:
```gradle
android {
compileSdkVersion 33
compileSdkVersion 34
// Don't compress kmp files so they can be copied via AssetManager
aaptOptions {
Expand All @@ -154,10 +154,10 @@ repositories {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.6.0-rc01'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.12.0'
api (name:'keyman-engine', ext:'aar')
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.preference:preference:1.2.1'
// Include this if you want to have QR Codes displayed on Keyboard Info
implementation ('com.github.kenglxn.QRGen:android:3.0.1') {
Expand Down
Loading

0 comments on commit 3ed3863

Please sign in to comment.