enable contact suggestions

This commit is contained in:
Helium314 2023-06-29 10:56:17 +02:00
parent c468732ca2
commit 5b3ddaaadd
4 changed files with 9 additions and 3 deletions

View file

@ -27,6 +27,7 @@ Changes:
* Remove suggestions by long pressing on suggestion strip while the more suggestions popup is open, https://github.com/openboard-team/openboard/issues/106 * Remove suggestions by long pressing on suggestion strip while the more suggestions popup is open, https://github.com/openboard-team/openboard/issues/106
* suggestions get re-added if they are entered again * suggestions get re-added if they are entered again
* Optionally add typed words to system personal dictionary * Optionally add typed words to system personal dictionary
* Allow using contacts for suggestions (enable in spell checker settings), https://github.com/openboard-team/openboard/issues/374
Plan / to do: Plan / to do:
* ~upgrade dependencies~ * ~upgrade dependencies~
@ -52,6 +53,7 @@ Plan / to do:
* ~gesture typing, https://github.com/openboard-team/openboard/issues/3~ * ~gesture typing, https://github.com/openboard-team/openboard/issues/3~
* ~license issues, require using an external library~ * ~license issues, require using an external library~
* re-consider preferring lowercase word for typed history in some cases (DictionaryFacilitatorImpl.addWordToUserHistory) * re-consider preferring lowercase word for typed history in some cases (DictionaryFacilitatorImpl.addWordToUserHistory)
* move _use contacts_ setting from well hidden spell checker settings to _text correction_ settings
----- -----

View file

@ -21,6 +21,7 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" /> <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!-- A signature-protected permission to ask AOSP Keyboard to close the software keyboard. <!-- A signature-protected permission to ask AOSP Keyboard to close the software keyboard.
To use this, add the following line into calling application's AndroidManifest.xml To use this, add the following line into calling application's AndroidManifest.xml

View file

@ -737,7 +737,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void resetDictionaryFacilitator(final Locale locale) { private void resetDictionaryFacilitator(final Locale locale) {
final SettingsValues settingsValues = mSettings.getCurrent(); final SettingsValues settingsValues = mSettings.getCurrent();
mDictionaryFacilitator.resetDictionaries(this /* context */, locale, mDictionaryFacilitator.resetDictionaries(this /* context */, locale,
false, settingsValues.mUsePersonalizedDicts, settingsValues.mUseContactsDictionary, settingsValues.mUsePersonalizedDicts,
false /* forceReloadMainDictionary */, false /* forceReloadMainDictionary */,
settingsValues.mAccount, "" /* dictNamePrefix */, settingsValues.mAccount, "" /* dictNamePrefix */,
this /* DictionaryInitializationListener */); this /* DictionaryInitializationListener */);
@ -754,7 +754,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
/* package private */ void resetSuggestMainDict() { /* package private */ void resetSuggestMainDict() {
final SettingsValues settingsValues = mSettings.getCurrent(); final SettingsValues settingsValues = mSettings.getCurrent();
mDictionaryFacilitator.resetDictionaries(this /* context */, mDictionaryFacilitator.resetDictionaries(this /* context */,
mDictionaryFacilitator.getLocale(), false, mDictionaryFacilitator.getLocale(), settingsValues.mUseContactsDictionary,
settingsValues.mUsePersonalizedDicts, settingsValues.mUsePersonalizedDicts,
true /* forceReloadMainDictionary */, true /* forceReloadMainDictionary */,
settingsValues.mAccount, "" /* dictNamePrefix */, settingsValues.mAccount, "" /* dictNamePrefix */,
@ -1945,7 +1945,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
void replaceDictionariesForTest(final Locale locale) { void replaceDictionariesForTest(final Locale locale) {
final SettingsValues settingsValues = mSettings.getCurrent(); final SettingsValues settingsValues = mSettings.getCurrent();
mDictionaryFacilitator.resetDictionaries(this, locale, mDictionaryFacilitator.resetDictionaries(this, locale,
false, settingsValues.mUsePersonalizedDicts, settingsValues.mUseContactsDictionary, settingsValues.mUsePersonalizedDicts,
false /* forceReloadMainDictionary */, false /* forceReloadMainDictionary */,
settingsValues.mAccount, "", /* dictionaryNamePrefix */ settingsValues.mAccount, "", /* dictionaryNamePrefix */
this /* DictionaryInitializationListener */); this /* DictionaryInitializationListener */);

View file

@ -34,6 +34,7 @@ import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme;
import org.dslul.openboard.inputmethod.latin.InputAttributes; import org.dslul.openboard.inputmethod.latin.InputAttributes;
import org.dslul.openboard.inputmethod.latin.R; import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.RichInputMethodManager; import org.dslul.openboard.inputmethod.latin.RichInputMethodManager;
import org.dslul.openboard.inputmethod.latin.spellcheck.AndroidSpellCheckerService;
import org.dslul.openboard.inputmethod.latin.utils.AsyncResultHolder; import org.dslul.openboard.inputmethod.latin.utils.AsyncResultHolder;
import org.dslul.openboard.inputmethod.latin.utils.ResourceUtils; import org.dslul.openboard.inputmethod.latin.utils.ResourceUtils;
import org.dslul.openboard.inputmethod.latin.utils.ScriptUtils; import org.dslul.openboard.inputmethod.latin.utils.ScriptUtils;
@ -109,6 +110,7 @@ public class SettingsValues {
public final boolean mIsSplitKeyboardEnabled; public final boolean mIsSplitKeyboardEnabled;
public final int mScreenMetrics; public final int mScreenMetrics;
public final boolean mAddToPersonalDictionary; public final boolean mAddToPersonalDictionary;
public final boolean mUseContactsDictionary;
// From the input box // From the input box
@Nonnull @Nonnull
@ -282,6 +284,7 @@ public class SettingsValues {
mBackgroundColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(mBackgroundColor, BlendModeCompat.MODULATE); mBackgroundColorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(mBackgroundColor, BlendModeCompat.MODULATE);
mAddToPersonalDictionary = prefs.getBoolean(Settings.PREF_ADD_TO_PERSONAL_DICTIONARY, false); mAddToPersonalDictionary = prefs.getBoolean(Settings.PREF_ADD_TO_PERSONAL_DICTIONARY, false);
mUseContactsDictionary = prefs.getBoolean(AndroidSpellCheckerService.PREF_USE_CONTACTS_KEY, false);
} }
public boolean isMetricsLoggingEnabled() { public boolean isMetricsLoggingEnabled() {