Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge master into linux-mcompile 🐘 #10187

Merged
merged 117 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
cff93be
fix(web): accidental suggestion-banner retoggle when turning predicti…
jahorton Nov 16, 2023
55c0c6f
fix(developer): projects 2.0 internal path enumeration
mcdurdin Nov 16, 2023
38f9b29
fix(developer): show relative path in Distribution tab
mcdurdin Nov 16, 2023
df43d63
fix(android): drops full-page reload from picker interactions. Fixes…
jahorton Nov 16, 2023
6cc35c1
change(android): JS queue flattening - concats all pending calls when…
jahorton Nov 16, 2023
a29599d
change(android): eliminates a redundant setLayoutParams
jahorton Nov 16, 2023
33c6996
change(android): drops redundant setLayoutParams call
jahorton Nov 16, 2023
c5b3baf
change(android): host-page init now retrieves current stub before KMW…
jahorton Nov 17, 2023
7c9061e
chore(android): remove fixed TODO
jahorton Nov 17, 2023
eebb886
feat(developer): refactor a little bit to give a postValidate() phase
srl295 Nov 17, 2023
3a417ad
feat(common): PUA and illegal unicode analysis 🙀
srl295 Nov 17, 2023
c426154
feat(developer): err/hint on illegal/pua 🙀
srl295 Nov 17, 2023
94a9e91
fix(developer): generate version 2.0 keyboard project
mcdurdin Nov 21, 2023
e124fa7
Merge branch 'fix/core-9961-optional-startContext-epic-ldml' into fea…
srl295 Nov 22, 2023
57b52d8
change(android): drops JS-queue 'pause'
jahorton Nov 22, 2023
701bdb8
fix(android): forgot the 'KMManager' entries
jahorton Nov 22, 2023
804cecf
fix(android): ...and the resetContext calls, which used true instead …
jahorton Nov 22, 2023
ff90431
chore(android): Merge branch 'master' into change/android/flishy-flas…
jahorton Nov 22, 2023
fb347bb
chore(linux): Update debian changelog
ermshiperete Nov 22, 2023
aa87bdf
Merge branch 'fix/core-9961-optional-startContext-epic-ldml' into fea…
srl295 Nov 22, 2023
5bfb328
feat(developer): ldml improve bad character code 🙀
srl295 Nov 22, 2023
57ec523
Merge branch 'master' into feat/developer-9446-bad-unicode-epic-ldml
srl295 Nov 22, 2023
76d05cd
fix(web): memory/handler leak when swapping pred-text on and off repe…
jahorton Nov 23, 2023
b689b6f
chore(android): Merge branch 'master' into change/android/flishy-flas…
jahorton Nov 23, 2023
7754427
fix(android): banner event loop on model change
jahorton Nov 23, 2023
a2c30b9
change(android): drops the 'change=' fragment
jahorton Nov 23, 2023
ad0ed37
chore(android): restores removed conditional
jahorton Nov 23, 2023
e983818
feat(developer): warn on usage of virtual keys in rule output
mcdurdin Nov 23, 2023
b3b2825
fix(developer): path separator for kmc-package
mcdurdin Nov 23, 2023
4480a05
chore(windows): removed cached context windows engine
rc-swag Nov 23, 2023
fb7c19f
chore(core): Add test keyboard for text selection tests
ermshiperete Nov 17, 2023
2dbad87
chore(windows): add comments ReadContext
rc-swag Nov 23, 2023
ef8b988
chore(web): Update touch layout
ermshiperete Nov 23, 2023
f56033f
chore(web): Add TAB output to test keyboard
ermshiperete Nov 23, 2023
08b3764
chore(windows): review comments
rc-swag Nov 23, 2023
23da871
chore(windows): remove res from PR change resetcontext
rc-swag Nov 23, 2023
7ec4832
fix(core): memory management of options in action struct
mcdurdin Nov 23, 2023
a47137b
Merge pull request #10062 from keymanapp/feat/developer/warn-on-vk-in…
mcdurdin Nov 24, 2023
7b6c57d
Merge pull request #10073 from keymanapp/fix/core/10067-actions-optio…
mcdurdin Nov 24, 2023
b861eff
chore(android): restores picker onPause behavior when kbd is deleted …
jahorton Nov 24, 2023
da39948
chore(android): JSQueueEntry -> String
jahorton Nov 24, 2023
6543170
Merge pull request #10047 from keymanapp/chore/linux/cherry-pick/chan…
ermshiperete Nov 24, 2023
20c3614
Merge pull request #10026 from keymanapp/chore/testkeyboard
ermshiperete Nov 24, 2023
d0b23c9
auto: increment master version to 17.0.218
keyman-server Nov 24, 2023
32b728e
Merge pull request #10081 from keymanapp/auto/version-master-17.0.218
keyman-server Nov 24, 2023
e5da0aa
chore(developer): fixup test fixture
mcdurdin Nov 24, 2023
11ae17c
chore(developer): require project file to exist
mcdurdin Nov 25, 2023
bb63ba8
Apply suggestions from code review
srl295 Nov 25, 2023
d18134f
feat(common): ldml improve bad character code 🙀
srl295 Nov 25, 2023
02c8db9
Merge branch 'master' into feat/developer-9446-bad-unicode-epic-ldml
srl295 Nov 25, 2023
e0c4f4f
fix(web): Fix attachment-api tests
ermshiperete Nov 27, 2023
994cb4f
Merge pull request #10029 from keymanapp/feat/developer-9446-bad-unic…
srl295 Nov 27, 2023
6707ab8
auto: increment master version to 17.0.219
keyman-server Nov 27, 2023
d695526
Merge pull request #10087 from keymanapp/auto/version-master-17.0.219
keyman-server Nov 27, 2023
7e47fa2
fix(web): Also move source map
ermshiperete Nov 28, 2023
458385f
Merge pull request #10064 from keymanapp/fix/developer/10027-path-sep…
mcdurdin Nov 29, 2023
3ef4dc7
Merge pull request #10016 from keymanapp/fix/developer/project-intern…
mcdurdin Nov 29, 2023
57b20ac
Merge pull request #10085 from keymanapp/fix/web/tests
ermshiperete Nov 29, 2023
de2fb3a
Merge pull request #10089 from keymanapp/chore/web/sourcemap
ermshiperete Nov 29, 2023
2023360
fix(web): Don't throw errors after detach
ermshiperete Nov 27, 2023
5b17b05
auto: increment master version to 17.0.220
keyman-server Nov 29, 2023
d084538
Merge pull request #10094 from keymanapp/auto/version-master-17.0.220
keyman-server Nov 29, 2023
8ff64d0
chore(android): simple host-page force-reset after kbd updates
jahorton Nov 30, 2023
63e4371
chore(windows): fix argument passed into to km_core_state_context_set…
rc-swag Nov 30, 2023
6820f36
fix(core): set_if_needed updates a empty cached context
rc-swag Nov 30, 2023
9e1f735
fix(core): review comments
rc-swag Nov 30, 2023
5351abb
Merge pull request #10098 from keymanapp/fix/core/set-if-needed-handl…
rc-swag Nov 30, 2023
3506407
chore(windows): Merge branch 'master' into chore/windows/10052/remove…
rc-swag Nov 30, 2023
d5963e0
fix: check for null termination
rc-swag Nov 30, 2023
0f18844
Merge pull request #10101 from keymanapp/fix/check-empty-string-all-c…
rc-swag Nov 30, 2023
51a462c
chore(windows): Merge branch 'master' into chore/windows/10052/remove…
rc-swag Nov 30, 2023
688f9f3
chore(linux): Add support for loong64 architecture
ermshiperete Nov 30, 2023
396170d
auto: increment master version to 17.0.221
keyman-server Nov 30, 2023
d53ff43
Merge pull request #10110 from keymanapp/auto/version-master-17.0.221
keyman-server Nov 30, 2023
8875dff
fix(web): Properly detach from events during detach
ermshiperete Nov 30, 2023
864f378
Merge pull request #10065 from keymanapp/chore/windows/10052/remove-c…
rc-swag Nov 30, 2023
f7f5952
Merge pull request #10017 from keymanapp/change/android/flishy-flashy…
jahorton Dec 1, 2023
19d3d7c
Merge pull request #10022 from keymanapp/change/android/flishy-flashy…
jahorton Dec 1, 2023
8e272d8
Merge pull request #10061 from keymanapp/fix/android/banner-event-loop
jahorton Dec 1, 2023
39b7c88
feat(developer): Multi-process model for projects 🦕
mcdurdin Dec 1, 2023
915510b
chore(developer): remove obsolete files
mcdurdin Dec 1, 2023
0bc426c
Merge pull request #10092 from keymanapp/fix/developer/project-intern…
mcdurdin Dec 1, 2023
31e1b36
Merge pull request #10109 from keymanapp/chore/linux/cherry-pick/loong64
ermshiperete Dec 1, 2023
662ed0e
fix(common): publish @keymanapp/developer-utils as npm module
mcdurdin Dec 1, 2023
742ae53
chore(linux): Update debian changelog
ermshiperete Dec 1, 2023
00ab53e
Merge pull request #10086 from keymanapp/fix/web/detachFromControl
ermshiperete Dec 1, 2023
58e75a2
auto: increment master version to 17.0.222
keyman-server Dec 1, 2023
5e512fc
Merge pull request #10123 from keymanapp/auto/version-master-17.0.222
keyman-server Dec 1, 2023
91fb28f
chore(web): Add option to create test coverage report
ermshiperete Dec 1, 2023
c520918
chore(developer): support publish and pack in build.sh
mcdurdin Dec 1, 2023
4f9f71d
chore(developer): add build.sh dep
mcdurdin Dec 1, 2023
9cc8b40
Merge pull request #10118 from keymanapp/fix/common/10111-developer-u…
mcdurdin Dec 2, 2023
e9be1d2
auto: increment master version to 17.0.223
keyman-server Dec 2, 2023
ed5d572
Merge pull request #10125 from keymanapp/auto/version-master-17.0.223
keyman-server Dec 2, 2023
ff5a366
feat(developer): Open files in per-project instances
mcdurdin Dec 4, 2023
cd72449
Apply suggestions from code review
ermshiperete Dec 4, 2023
d4fcc8f
Merge pull request #10124 from keymanapp/chore/web/coverage
ermshiperete Dec 4, 2023
19162d1
auto: increment master version to 17.0.224
keyman-server Dec 4, 2023
baad2e8
Merge pull request #10128 from keymanapp/auto/version-master-17.0.224
keyman-server Dec 4, 2023
4641684
fix(developer): prevent opening .kpj in multiple processes
mcdurdin Dec 5, 2023
5a8f68a
Merge pull request #10121 from keymanapp/chore/linux/cherry-pick/chan…
ermshiperete Dec 5, 2023
b58dcbc
fix(web): Fix null error with legacy keyboards
ermshiperete Dec 5, 2023
8e48a30
auto: increment master version to 17.0.225
keyman-server Dec 5, 2023
86af296
Merge pull request #10142 from keymanapp/auto/version-master-17.0.225
keyman-server Dec 5, 2023
56d5f37
Merge pull request #10114 from keymanapp/feat/developer/multi-process…
mcdurdin Dec 5, 2023
4c7b799
Merge pull request #10137 from keymanapp/fix/developer/10003-opening-…
mcdurdin Dec 6, 2023
5917b84
fix(android/app): InfoActivity pass external links to browser
darcywong00 Dec 6, 2023
e0d7a80
Merge pull request #10153 from keymanapp/fix/android/external-links
darcywong00 Dec 6, 2023
38c7839
fix(web): Fix null error with legacy keyboards
ermshiperete Dec 6, 2023
3c6a51b
auto: increment master version to 17.0.226
keyman-server Dec 6, 2023
e81b18f
Merge pull request #10160 from keymanapp/auto/version-master-17.0.226
keyman-server Dec 6, 2023
ef901a5
Merge pull request #10014 from keymanapp/fix/web/unwanted-banner-reto…
jahorton Dec 7, 2023
42a089a
fix(windows): debug includes libcmtd vs libcmt.dll
rc-swag Dec 7, 2023
289e075
Merge pull request #10141 from keymanapp/fix/web/10099_null-property
ermshiperete Dec 7, 2023
4b71f78
auto: increment master version to 17.0.227
keyman-server Dec 7, 2023
baf8acb
Merge pull request #10179 from keymanapp/auto/version-master-17.0.227
keyman-server Dec 7, 2023
21c0122
Merge pull request #10176 from keymanapp/fix/windows/keyman64-dll-deb…
rc-swag Dec 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
# Keyman Version History

## 17.0.226 alpha 2023-12-07

* fix(web): accidental suggestion-banner retoggle when disabling predictions (#10014)
* fix(web): Fix null error with legacy keyboards (#10141)

## 17.0.225 alpha 2023-12-06

* feat(developer): Multi-process model for projects (#10114)
* fix(developer): prevent opening .kpj in multiple processes (#10137)
* fix(android/app): InfoActivity pass external links to browser (#10153)

## 17.0.224 alpha 2023-12-05

* chore(linux): Update debian changelog (#10121)

## 17.0.223 alpha 2023-12-04

* chore(web): Add option to create test coverage report file (#10124)

## 17.0.222 alpha 2023-12-02

* fix(common): publish @keymanapp/developer-utils as npm module (#10118)

## 17.0.221 alpha 2023-12-01

* chore(windows): removed cached context windows engine (#10065)
* change(android): flishy flashy mitigation, round 1 (#10017)
* change(android): smoother keyboard initialization (#10022)
* fix(android): no suggestions available when swapping pred-text target language (#10061)
* chore(developer): require project file to exist (#10092)
* chore(linux): Add support for loong64 architecture (#10109)
* fix(web): Don't throw errors after detach (#10086)

## 17.0.220 alpha 2023-11-30

* fix(core): set_if_needed updates an empty cached context (#10098)
* fix(core): check for null termination (#10101)

## 17.0.219 alpha 2023-11-29

* fix(developer): path separator for kmc-package (#10064)
* fix(developer): projects 2.0 internal path enumeration (#10016)
* fix(web): Fix attachment-api tests (#10085)
* fix(web): Also move source map (#10089)

## 17.0.218 alpha 2023-11-27

* feat(developer): ldml: err/hint on illegal/pua chars (#10029)

## 17.0.217 alpha 2023-11-24

* feat(developer): warn on usage of virtual keys in rule output (#10062)
* fix(core): memory management of options in action struct (#10073)
* chore(linux): Update debian changelog (#10047)
* chore(core): Add test keyboard for text selection tests (#10026)

## 17.0.216 alpha 2023-11-23

* fix(common): kmx struct alignment (#9977)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.0.217
17.0.227
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import com.keyman.engine.BaseActivity;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
Expand Down Expand Up @@ -87,9 +89,20 @@ public void onReceivedError(WebView view, int errorCode, String description, Str

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url != null && !url.toLowerCase().equals("about:blank")) {
String lowerURL = url.toLowerCase();
if (lowerURL.equals("about:blank")) {
return true; // never load a blank page, e.g. when the component initializes
}

Uri uri = Uri.parse(url);

// All links that aren't internal Keyman help links open in user's browser
if (!url.contains(htmlPath)) {
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
} else {
view.loadUrl(url);
}
}

return true;
}
Expand Down
10 changes: 7 additions & 3 deletions android/KMEA/app/src/main/assets/android-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ function init() {
keyman.getOskHeight = getOskHeight;
keyman.getOskWidth = getOskWidth;
keyman.beepKeyboard = beepKeyboard;

// Readies the keyboard stub for instant loading during the init process.
KeymanWeb.registerStub(JSON.parse(jsInterface.initialKeyboard()));

keyman.init({
'embeddingApp':device,
'fonts':'packages/',
Expand Down Expand Up @@ -102,7 +106,7 @@ function setBannerHeight(h) {

if (keyman.osk) {
keyman.osk.bannerView.activeBannerHeight = bannerHeight;
}
}
}

// Refresh KMW's OSK
Expand Down Expand Up @@ -149,8 +153,8 @@ function onStateChange(change) {
keyman.refreshOskLayout();

fragmentToggle = (fragmentToggle + 1) % 100;
if(change != 'configured') { // doesn't change the display; only initiates suggestions.
window.location.hash = 'refreshBannerHeight-'+fragmentToggle+'+change='+change;
if(change != 'configured') {
window.location.hash = 'refreshBannerHeight-'+fragmentToggle;
}
}

Expand Down
30 changes: 17 additions & 13 deletions android/KMEA/app/src/main/java/com/keyman/engine/KMKeyboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ final class KMKeyboard extends WebView {
private boolean shouldIgnoreSelectionChange = false;

protected KeyboardType keyboardType = KeyboardType.KEYBOARD_TYPE_UNDEFINED;
protected ArrayList<String> javascriptAfterLoad = new ArrayList<String>();
protected ArrayList<String> javascriptAfterLoad = new ArrayList<>();

private static String currentKeyboard = null;

Expand Down Expand Up @@ -214,10 +214,8 @@ public boolean onConsoleMessage(ConsoleMessage cm) {
}

// Send console errors to Sentry in case they're missed by KMW sentryManager
// (Ignoring spurious message "No keyboard stubs exist = ...")
// TODO: Fix base error rather than trying to ignore it "No keyboard stubs exist"

if ((cm.messageLevel() == ConsoleMessage.MessageLevel.ERROR) && (!cm.message().startsWith("No keyboard stubs exist"))) {
if (cm.messageLevel() == ConsoleMessage.MessageLevel.ERROR) {
// Make Toast notification of error and send log about falling back to default keyboard (ignore language ID)
// Sanitize sourceId info
String NAVIGATION_PATTERN = "^(.*)?(keyboard\\.html#[^-]+)-.*$";
Expand Down Expand Up @@ -302,15 +300,21 @@ public void callJavascriptAfterLoad() {
this.postDelayed(new Runnable() {
@Override
public void run() {
if(javascriptAfterLoad.size() > 0) {
loadUrl("javascript:" + javascriptAfterLoad.get(0));
javascriptAfterLoad.remove(0);
// Make sure we didn't reset the page in the middle of the queue!
if(keyboardSet) {
if (javascriptAfterLoad.size() > 0) {
callJavascriptAfterLoad();
}
}
StringBuilder allCalls = new StringBuilder();
if(javascriptAfterLoad.size() == 0) {
return;
}

while(javascriptAfterLoad.size() > 0) {
String entry = javascriptAfterLoad.remove(0);
allCalls.append(entry);
allCalls.append(";");
}

loadUrl("javascript:" + allCalls.toString());

if(javascriptAfterLoad.size() > 0 && keyboardSet) {
callJavascriptAfterLoad();
}
}
}, 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.keyman.engine;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
Expand All @@ -20,6 +21,7 @@
import static android.content.Context.VIBRATOR_SERVICE;

import com.keyman.engine.KMManager.KeyboardType;
import com.keyman.engine.data.Keyboard;
import com.keyman.engine.util.CharSequenceUtil;
import com.keyman.engine.util.KMLog;

Expand Down Expand Up @@ -62,6 +64,21 @@ public int getKeyboardWidth() {
return kbWidth;
}

@JavascriptInterface
public String initialKeyboard() {
// Note: KMManager.getCurrentKeyboard() (and similar) will throw errors until the host-page is first fully
// loaded and has set a keyboard. To allow the host-page to have earlier access, we instead get the stored
// keyboard index directly.
SharedPreferences prefs = context.getSharedPreferences(context.getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
int index = prefs.getInt(KMManager.KMKey_UserKeyboardIndex, 0);
if (index < 0) {
index = 0;
}

Keyboard kbd = KMManager.getKeyboardInfo(this.context, index);
return kbd.toStub(context);
}

// This annotation is required in Jelly Bean and later:
@JavascriptInterface
public void beepKeyboard() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,13 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
// for the rest of the lifetime of this keyboard instance.
kmKeyboard.setShouldShowHelpBubble(false);
} else if (url.indexOf("refreshBannerHeight") >= 0) {
int start = url.indexOf("change=") + 7;
String change = url.substring(start);
boolean isModelActive = change.equals("active");
// appContext instead of context?
SharedPreferences prefs = context.getSharedPreferences(context.getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
boolean modelPredictionPref = false;
if (KMManager.currentLexicalModel != null) {
modelPredictionPref = prefs.getBoolean(KMManager.getLanguagePredictionPreferenceKey(KMManager.currentLexicalModel.get(KMManager.KMKey_LanguageID)), true);
}
KMManager.setBannerOptions(isModelActive && modelPredictionPref);
KMManager.setBannerOptions(modelPredictionPref);
RelativeLayout.LayoutParams params = KMManager.getKeyboardLayoutParams();
kmKeyboard.setLayoutParams(params);
} else if (url.indexOf("suggestPopup") >= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,12 +776,10 @@ public static void onConfigurationChanged(Configuration newConfig) {
// KMKeyboard
if (InAppKeyboard != null) {
RelativeLayout.LayoutParams params = getKeyboardLayoutParams();
InAppKeyboard.setLayoutParams(params);
InAppKeyboard.onConfigurationChanged(newConfig);
}
if (SystemKeyboard != null) {
RelativeLayout.LayoutParams params = getKeyboardLayoutParams();
SystemKeyboard.setLayoutParams(params);
SystemKeyboard.onConfigurationChanged(newConfig);
}
}
Expand Down Expand Up @@ -1386,12 +1384,14 @@ public static boolean registerLexicalModel(HashMap<String, String> lexicalModelI
RelativeLayout.LayoutParams params;
if (isKeyboardLoaded(KeyboardType.KEYBOARD_TYPE_INAPP) && !InAppKeyboard.shouldIgnoreTextChange() && modelFileExists) {
params = getKeyboardLayoutParams();
InAppKeyboard.setLayoutParams(params);

// Do NOT re-layout here; it'll be triggered once the banner loads.
InAppKeyboard.loadJavascript(KMString.format("enableSuggestions(%s, %s, %s)", model, mayPredict, mayCorrect));
}
if (isKeyboardLoaded(KeyboardType.KEYBOARD_TYPE_SYSTEM) && !SystemKeyboard.shouldIgnoreTextChange() && modelFileExists) {
params = getKeyboardLayoutParams();
SystemKeyboard.setLayoutParams(params);

// Do NOT re-layout here; it'll be triggered once the banner loads.
SystemKeyboard.loadJavascript(KMString.format("enableSuggestions(%s, %s, %s)", model, mayPredict, mayCorrect));
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import androidx.appcompat.widget.Toolbar;

public final class KeyboardPickerActivity extends BaseActivity {
private boolean hasDeleted = false;

//TODO: view instances should not be static
private static Toolbar toolbar = null;
Expand Down Expand Up @@ -123,7 +124,7 @@ public void onCreate(Bundle savedInstanceState) {
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switchKeyboard(position,dismissOnSelect && ! KMManager.isTestMode());
switchKeyboard(position);
if (dismissOnSelect)
finish();
}
Expand All @@ -140,6 +141,7 @@ public boolean onItemLongClick(AdapterView<?> parent, View view, final int posit
public boolean onMenuItemClick(MenuItem item) {
if (item.getItemId() == R.id.popup_delete) {
deleteKeyboard(context, position);
KeyboardPickerActivity.this.hasDeleted = true;
return true;
} else {
return false;
Expand Down Expand Up @@ -267,11 +269,16 @@ protected void onResume() {
protected void onPause() {
super.onPause();

if (KMManager.InAppKeyboard != null) {
KMManager.InAppKeyboard.loadKeyboard();
}
if (KMManager.SystemKeyboard != null) {
KMManager.SystemKeyboard.loadKeyboard();
if (this.hasDeleted) {
this.hasDeleted = false;

if (KMManager.InAppKeyboard != null) {
KMManager.InAppKeyboard.loadKeyboard();
}

if (KMManager.SystemKeyboard != null) {
KMManager.SystemKeyboard.loadKeyboard();
}
}
}

Expand Down Expand Up @@ -335,7 +342,7 @@ private static void setSelection(int position) {
* @param position the keyboard index in list
* @param aPrepareOnly prepare switch, it is executed on keyboard reload
*/
private static void switchKeyboard(int position, boolean aPrepareOnly) {
private static void switchKeyboard(int position) {
setSelection(position);
int size = KeyboardController.getInstance().get().size();
int listPosition = (position >= size) ? size-1 : position;
Expand All @@ -344,10 +351,7 @@ private static void switchKeyboard(int position, boolean aPrepareOnly) {
String kbId = kbInfo.getKeyboardID();
String langId = kbInfo.getLanguageID();
String kbName = kbInfo.getKeyboardName();
if(aPrepareOnly)
KMManager.prepareKeyboardSwitch(pkgId, kbId, langId, kbName);
else
KMManager.setKeyboard(kbInfo);
KMManager.setKeyboard(kbInfo);
}

protected static boolean addKeyboard(Context context, Keyboard keyboardInfo) {
Expand Down Expand Up @@ -449,7 +453,7 @@ protected static void deleteKeyboard(Context context, int position) {
adapter.notifyDataSetChanged();
}
if (position == curKbPos) {
switchKeyboard(0,false);
switchKeyboard(0);
} else if(listView != null) { // A bit of a hack, since LanguageSettingsActivity calls this method too.
curKbPos = KeyboardController.getInstance().getKeyboardIndex(KMKeyboard.currentKeyboard());
setSelection(curKbPos);
Expand Down
Loading