misc improvements, update todo

This commit is contained in:
Helium314 2023-12-10 15:52:10 +01:00
parent f471cf81ed
commit c5f3d4bfcf
4 changed files with 15 additions and 11 deletions

View file

@ -67,10 +67,7 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
return this
// todo: further plan
// make split layout work for emoji keyboard
// more settings for localized number row, so it can be different in shift or symbols
// setting which moreKeys to prefer (default: symbol or important language, always symbol, always language)
// setting whether to show duplicate moreKeys (describe properly what it actually does)
// re-check the LayoutInfos, they should really to the right things!
// some keyboard_layout_set have supportedScript that is enum synced with script id in ScriptUtils
// that's one more reason for using language tags...
// currently it's still read from xml outside the keyboard parser, but should still go to some other place
@ -106,7 +103,7 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
// allow users to import layouts, which essentially just fills the text from a file
// add setting to use moreKeys from symbol layout (always, never, only if none defined)
// should also have sth related to hint, because hint and start morekey maybe should stay
// option to add extra keys for all layouts?
// option to add language extra keys for all layouts?
// labelFlags should be set correctly
// alignHintLabelToBottom: on lxx and rounded themes, but did not find what it actually does...

View file

@ -876,7 +876,7 @@ public final class InputLogic {
|| mWordComposer.isComposingWord() // emoji will be part of the word in this case, better do nothing
|| !settingsValues.mBigramPredictionEnabled // this is only for next word suggestions, so they need to be enabled
|| settingsValues.mIncognitoModeEnabled
|| settingsValues.mInputAttributes.mInputTypeNoAutoCorrect // see comment in performAdditionToUserHistoryDictionary
|| settingsValues.mInputAttributes.mShouldShowSuggestions // see comment in performAdditionToUserHistoryDictionary
|| !StringUtilsKt.isEmoji(text)
) return;
if (mConnection.hasSlowInputConnection()) {
@ -1556,7 +1556,8 @@ public final class InputLogic {
// If correction is not enabled, we don't add words to the user history dictionary.
// That's to avoid unintended additions in some sensitive fields, or fields that
// expect to receive non-words.
if (settingsValues.mInputAttributes.mInputTypeNoAutoCorrect || settingsValues.mIncognitoModeEnabled)
// mInputTypeNoAutoCorrect changed to !mShouldShowSuggestions because this was cancelling learning way too often
if (!settingsValues.mInputAttributes.mShouldShowSuggestions || settingsValues.mIncognitoModeEnabled)
return;
if (mConnection.hasSlowInputConnection()) {
// Since we don't unlearn when the user backspaces on a slow InputConnection,

View file

@ -56,6 +56,7 @@ public final class DebugSettingsFragment extends SubScreenFragment
mServiceNeedsRestart = false;
mDebugMode = findPreference(DebugSettings.PREF_DEBUG_MODE);
findPreference(DebugSettings.PREF_SHOW_SUGGESTION_INFOS).setVisible(mDebugMode.isChecked());
updateDebugMode();
}
@ -95,7 +96,9 @@ public final class DebugSettingsFragment extends SubScreenFragment
@Override
public void onSharedPreferenceChanged(final SharedPreferences prefs, final String key) {
if (key.equals(DebugSettings.PREF_DEBUG_MODE) && mDebugMode != null) {
mDebugMode.setChecked(prefs.getBoolean(DebugSettings.PREF_DEBUG_MODE, false));
final boolean enabled = prefs.getBoolean(DebugSettings.PREF_DEBUG_MODE, false);
mDebugMode.setChecked(enabled);
findPreference(DebugSettings.PREF_SHOW_SUGGESTION_INFOS).setVisible(enabled);
mServiceNeedsRestart = true;
} else if (key.equals(DebugSettings.PREF_FORCE_NON_DISTINCT_MULTITOUCH)) {
mServiceNeedsRestart = true;

View file

@ -162,6 +162,8 @@ class LanguageSettingsDialog(
addSecondaryLocaleView(locale)
di.dismiss()
reloadSetting()
reloadDictionaries()
KeyboardLayoutSet.onSystemLocaleChanged()
}
.setNegativeButton(android.R.string.cancel, null)
.show()
@ -183,11 +185,11 @@ class LanguageSettingsDialog(
Settings.setSecondaryLocales(prefs, mainLocaleString, localeStrings - locale.toString())
binding.secondaryLocales.removeView(rowBinding.root)
reloadSetting()
reloadDictionaries()
KeyboardLayoutSet.onSystemLocaleChanged()
}
}
binding.secondaryLocales.addView(rowBinding.root)
KeyboardLayoutSet.onSystemLocaleChanged()
}
private fun fillDictionariesView() {
@ -268,8 +270,7 @@ class LanguageSettingsDialog(
dictFile.delete()
if (parent?.list()?.isEmpty() == true)
parent.delete()
val newDictBroadcast = Intent(DictionaryPackConstants.NEW_DICTIONARY_INTENT_ACTION)
fragment?.activity?.sendBroadcast(newDictBroadcast)
reloadDictionaries()
binding.dictionaries.removeView(rowBinding.root)
if (binding.dictionaries.size < 2) { // first view is "Dictionaries"
infos.forEach { it.hasDictionary = false }
@ -284,6 +285,8 @@ class LanguageSettingsDialog(
}
binding.dictionaries.addView(rowBinding.root)
}
private fun reloadDictionaries() = fragment?.activity?.sendBroadcast(Intent(DictionaryPackConstants.NEW_DICTIONARY_INTENT_ACTION))
}
/** @return list of user dictionary files and whether an internal dictionary exists */