Skip to content

Commit

Permalink
Merge branch 'change/ios/defer-font-registration' into refactor/ios/o…
Browse files Browse the repository at this point in the history
…ptimize-font-registration
  • Loading branch information
Joshua Horton committed Aug 23, 2024
2 parents c712d35 + 5c3772f commit de6550b
Show file tree
Hide file tree
Showing 358 changed files with 2,681 additions and 1,389 deletions.
47 changes: 47 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,52 @@
# Keyman Version History

## 18.0.95 alpha 2024-08-22

* chore(common): allow build agents to automatically select emsdk version, and enable support for 3.1.60+ (#12243)

## 18.0.94 alpha 2024-08-21

* fix(core): look for `emcc` instead of `emcc.py` (#12235)
* fix(web): improve tokenization output when wordbreaker breaks spec for span properties in output (#12229)
* chore(android): Use RTL-aware alignment and padding for layouts (#12225)
* fix(web): disable fat-finger data use when mayCorrect = false (#12220)
* fix(android): Auto-mirror back and forward arrows for RTL support (#12227)
* feat(android): Add localization for Arabic (#12228)
* fix(android): Auto-mirror increment and decrement arrows for RTL support (#12230)

## 18.0.93 alpha 2024-08-20

* (#12188)
* fix(web): fix malformed reversion display strings (#12201)
* feat(android): Add menu to specify long-press delay (#12170)
* feat(android): Pass longpress delay to KeymanWeb (#12185)
* (#12223)

## 18.0.92 alpha 2024-08-19

* chore(deps-dev): bump @75lb/deep-merge from 1.1.1 to 1.1.2 (#12118)
* chore(deps): bump semver from 7.5.4 to 7.6.0 (#12119)
* fix(windows): "Keyman" is not localized in UI strings (#12162)
* feat(android): Enhance how ENTER key is handled in apps (#12125)
* refactor(web): move `lm-worker``worker-thread` (#12150)
* fix(developer): remove redundant check in LdmlKeyboardCompiler.validate() (#11858)

## 18.0.91 alpha 2024-08-16

* refactor(web): move `predictive-text``worker-main` (#12146)
* fix(web): restore flick functionality (#12187)
* refactor(web): move `lm-message-types``predictive-text/types` (#12149)
* fix(developer): enforce presence of kps Info.Description field in info compilers (#12204)
* fix(developer): enforce presence of Version field when FollowKeyboardVersion is not set, in package compiler (#12205)

## 18.0.90 alpha 2024-08-15

* refactor(web): move parts of `keyboard-processor``js-processor` (#12111)
* fix(web): allow `lm-worker` to build on Linux (#12181)
* refactor(web): move remaining parts of `keyboard-processor``keyboard` (#12131)
* docs: update .kmx documentation around bitmaps, modifier state (#12183)
* refactor(web): rename `package-cache``keyboard-storage` (#12135)

## 18.0.89 alpha 2024-08-14

* feat(web): test skipped prediction round handling (#12169)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.0.90
18.0.96
5 changes: 5 additions & 0 deletions android/KMAPro/kMAPro/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@
android:configChanges="orientation"
android:label="@string/app_name"
android:theme="@style/AppTheme.Base" />
<activity
android:name=".AdjustLongpressDelayActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:theme="@style/AppTheme.Base" />

<!-- Put other WebViewActivities in a separate process so the Keyboard WebView doesn't lag.
Ref https://stackoverflow.com/questions/40650643/timed-out-waiting-on-iinputcontextcallback-with-custom-keyboard-on-android -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package com.keyman.android;

import com.tavultesoft.kmapro.AdjustLongpressDelayActivity;
import com.tavultesoft.kmapro.BuildConfig;
import com.tavultesoft.kmapro.DefaultLanguageResource;
import com.tavultesoft.kmapro.KeymanSettingsActivity;
Expand Down Expand Up @@ -175,6 +176,9 @@ public void onStartInput(EditorInfo attribute, boolean restarting) {
}
}

// Determine special handling for ENTER key
KMManager.setEnterMode(attribute.imeOptions, inputType);

InputConnection ic = getCurrentInputConnection();
if (ic != null) {
ExtractedText icText = ic.getExtractedText(new ExtractedTextRequest(), 0);
Expand Down Expand Up @@ -244,6 +248,8 @@ public void onKeyboardLoaded(KeyboardType keyboardType) {
if (exText != null)
exText = null;
}
// Initialize keyboard options
KMManager.sendOptionsToKeyboard();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
* Keyman is copyright (C) SIL International. MIT License.
*
* (Optional description of this file)
*/
package com.tavultesoft.kmapro;

import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;

import com.keyman.engine.BaseActivity;
import com.keyman.engine.KMManager;

/**
* Settings menu for adjusting the longpress delay time. The value for the current longpress delay time
* is saved in shared preferences as an integer (milliseconds).
*/
public class AdjustLongpressDelayActivity extends BaseActivity {
private static final String TAG = "AdjustLongpressDelay";
public static final String adjustLongpressDelayKey = "AdjustLongpressDelay";

// Keeps track of the adjusted longpress delay time for saving.
// Internally use milliseconds, but GUI displays seconds
private static int currentDelayTimeMS = KMManager.KMDefault_LongpressDelay; // ms
private static int minLongpressTime = 300; // ms
private static int maxLongpressTime = 1500; // ms
private static int delayTimeIncrement = 200; // ms

/**
* Convert currentDelayTimeMS to progress
* @return int
*/
private int delayTimeToProgress() {
return (currentDelayTimeMS / delayTimeIncrement) - 1;
}

/**
* Convert progress to currentDelayTimeMS
* @param progress
* @return int (milliseconds)
*/
private int progressToDelayTime(int progress) {
return (progress + 1) * delayTimeIncrement + 100;
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

final Context context = this;

setContentView(R.layout.activity_adjust_longpress_delay);
Toolbar toolbar = (Toolbar) findViewById(R.id.titlebar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(null);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, R.color.keyman_blue)));
}

TextView adjustLongpressDelayActivityTitle = (TextView) findViewById(R.id.bar_title);

String titleStr = getString(R.string.adjust_longpress_delay);
adjustLongpressDelayActivityTitle.setTextColor(ContextCompat.getColor(this, R.color.ms_white));
adjustLongpressDelayActivityTitle.setText(titleStr);

currentDelayTimeMS = KMManager.getLongpressDelay();

TextView adjustLongpressDelayText = (TextView) findViewById(R.id.delayTimeText);
String longpressDelayTextSeconds = String.format(getString(R.string.longpress_delay_time), (float)(currentDelayTimeMS/1000.0));
adjustLongpressDelayText.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
adjustLongpressDelayText.setText(longpressDelayTextSeconds);

final SeekBar seekBar = (SeekBar) findViewById(R.id.seekBar);
seekBar.setProgress(delayTimeToProgress());
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// Do nothing
}

@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// Do nothing
}

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
// Update the text field.
// The keyboard options will be saved and sent to KeymanWeb when exiting the menu
currentDelayTimeMS = progressToDelayTime(progress);
String longpressDelayTextSeconds = String.format(getString(R.string.longpress_delay_time), (float)(currentDelayTimeMS/1000.0));
adjustLongpressDelayText.setText(longpressDelayTextSeconds);
}
});

findViewById(R.id.delayTimeDownButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (currentDelayTimeMS > minLongpressTime) {
currentDelayTimeMS -= delayTimeIncrement;
seekBar.setProgress(delayTimeToProgress());
}
}
});

findViewById(R.id.delayTimeUpButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (currentDelayTimeMS < maxLongpressTime) {
currentDelayTimeMS += delayTimeIncrement;
seekBar.setProgress(delayTimeToProgress());
}
}
});
}

@Override
public void onBackPressed() {
// Store the longpress delay as a reference
// and then update KeymanWeb with the longpress delay
KMManager.setLongpressDelay(currentDelayTimeMS);
KMManager.sendOptionsToKeyboard();

super.onBackPressed();
}

@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void onCreate(Bundle savedInstanceState) {
hashMap = new HashMap<>();
final String customHelpLink = kbd.getHelpLink();
// Check if app declared FileProvider
icon = String.valueOf(R.drawable.ic_arrow_forward);
icon = String.valueOf(R.drawable.ic_action_forward);
// Don't show help link arrow if File Provider unavailable, or custom help doesn't exist
if ( (customHelpLink != null && !FileProviderUtils.exists(context)) ||
(customHelpLink == null && !packageID.equals(KMManager.KMDefault_UndefinedPackageID)) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class KeymanSettingsFragment extends PreferenceFragmentCompat {
private static Context context;

private Preference languagesPreference, installKeyboardOrDictionary, displayLanguagePreference,
adjustKeyboardHeight;
adjustKeyboardHeight, adjustLongpressDelay;
private ListPreference spacebarTextPreference;
private CheckBoxPreference setSystemKeyboardPreference;
private CheckBoxPreference setDefaultKeyboardPreference;
Expand Down Expand Up @@ -99,13 +99,21 @@ public boolean onPreferenceClick(Preference preference) {
});

setDefaultKeyboardPreference.setOnPreferenceChangeListener(checkBlocker);

adjustKeyboardHeight = new Preference(context);
adjustKeyboardHeight.setKey(AdjustKeyboardHeightActivity.adjustKeyboardHeightKey);
adjustKeyboardHeight.setTitle(getString(R.string.adjust_keyboard_height));
adjustKeyboardHeight.setWidgetLayoutResource(R.layout.preference_height_icon_layout);
Intent adjustKeyboardHeightIntent = new Intent(context, AdjustKeyboardHeightActivity.class);
adjustKeyboardHeight.setIntent(adjustKeyboardHeightIntent);

adjustLongpressDelay = new Preference(context);
adjustLongpressDelay.setKey(AdjustLongpressDelayActivity.adjustLongpressDelayKey);
adjustLongpressDelay.setTitle(getString(R.string.adjust_longpress_delay));
adjustLongpressDelay.setWidgetLayoutResource(R.layout.preference_duration_icon_layout);
Intent adjustLongpressDelayIntent = new Intent(context, AdjustLongpressDelayActivity.class);
adjustLongpressDelay.setIntent(adjustLongpressDelayIntent);

/* Spacebar Caption Preference */

spacebarTextPreference = new ListPreference(context);
Expand Down Expand Up @@ -188,15 +196,14 @@ as part of the default onClick() used by SwitchPreference.
sendCrashReportPreference.setSummaryOff(getString(R.string.show_send_crash_report_off));
sendCrashReportPreference.setDefaultValue(true);



screen.addPreference(languagesPreference);
screen.addPreference(installKeyboardOrDictionary);
screen.addPreference(displayLanguagePreference);
screen.addPreference(setSystemKeyboardPreference);
screen.addPreference(setDefaultKeyboardPreference);

screen.addPreference(adjustKeyboardHeight);
screen.addPreference(adjustLongpressDelay);
screen.addPreference(spacebarTextPreference);

screen.addPreference(hapticFeedbackPreference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void onCreate(Bundle savedInstanceState) {
updateActiveLexicalModel();

ImageView imageView = (ImageView) layout.findViewById(R.id.image1);
imageView.setImageResource(R.drawable.ic_arrow_forward);
imageView.setImageResource(R.drawable.ic_action_forward);
layout.setEnabled(true);
layout.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -198,7 +198,7 @@ public void onClick(View v) {
* textView = (TextView) layout.findViewById(R.id.text1);
* textView.setText(getString(R.string.manage_dictionary));
* imageView = (ImageView) layout.findViewById(R.id.image1);
* imageView.setImageResource(R.drawable.ic_arrow_forward);
* imageView.setImageResource(R.drawable.ic_action_forward);
*/

listView.setAdapter(adapter);
Expand Down Expand Up @@ -346,7 +346,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

holder.text.setText(kbd.getResourceName());
holder.img.setImageResource(R.drawable.ic_arrow_forward);
holder.img.setImageResource(R.drawable.ic_action_forward);

return convertView;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

holder.textLang.setText(data.name);
holder.img.setImageResource(R.drawable.ic_arrow_forward);
holder.img.setImageResource(R.drawable.ic_action_forward);

holder.textCount.setText(getContext().getResources().getQuantityString(R.plurals.keyboard_count, data.keyboards.size(), data.keyboards.size()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ public boolean onKeyUp(int keycode, KeyEvent e) {

@Override
public void onKeyboardLoaded(KeyboardType keyboardType) {
// Do nothing
// Initialize keyboard options
KMManager.sendOptionsToKeyboard();
}

@Override
Expand Down Expand Up @@ -646,7 +647,7 @@ private void showTextSizeDialog() {
final View textSizeController = inflater.inflate(R.layout.text_size_controller, null);
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MainActivity.this);
dialogBuilder.setIcon(R.drawable.ic_light_action_textsize);
dialogBuilder.setTitle(String.format(getString(R.string.text_size), textSize));
dialogBuilder.setTitle(getTextSizeString());
dialogBuilder.setView(textSizeController);
dialogBuilder.setPositiveButton(getString(R.string.label_ok), new DialogInterface.OnClickListener() {
@Override
Expand Down Expand Up @@ -677,7 +678,7 @@ public void onStartTrackingTouch(SeekBar seekBar) {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
textSize = progress + minTextSize;
textView.setTextSize((float) textSize);
dialog.setTitle(String.format(getString(R.string.text_size), textSize));
dialog.setTitle(getTextSizeString());
}
});

Expand All @@ -702,6 +703,16 @@ public void onClick(View v) {
});
}

/**
* Combine a localized string for "Text Size" plus Arabic numerals
* @return String
*/
private String getTextSizeString() {
// Instead of formatting the number, will truncate formatting and concat the actual textSize
String label = getString(R.string.text_size).replace("%1$d", "");
return label + KMString.format(" %d", textSize);
}

private void showClearTextDialog() {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MainActivity.this);
dialogBuilder.setIcon(R.drawable.ic_light_action_trash);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void onCreate(Bundle savedInstanceState) {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put(titleKey, keyboardName);
hashMap.put(subtitleKey, pkgID);
String icon = String.valueOf(R.drawable.ic_arrow_forward);
String icon = String.valueOf(R.drawable.ic_action_forward);
hashMap.put(iconKey, icon);
list.add(hashMap);
}
Expand Down

This file was deleted.

Loading

0 comments on commit de6550b

Please sign in to comment.