consider that voice input key visibility should depend on the text field

This commit is contained in:
Helium314 2025-06-01 19:17:44 +02:00
parent 7499c38e13
commit 0a961a68db
2 changed files with 9 additions and 4 deletions

View file

@ -1028,6 +1028,8 @@ public class LatinIME extends InputMethodService implements
!currentSettingsValues.hasSameOrientation(getResources().getConfiguration())) {
loadSettings();
currentSettingsValues = mSettings.getCurrent();
if (hasSuggestionStripView())
mSuggestionStripView.updateVoiceKey();
}
// ALERT: settings have not been reloaded and there is a chance they may be stale.
// In the practice, if it is, we should have gotten onConfigurationChanged so it should

View file

@ -470,12 +470,15 @@ class SuggestionStripView(context: Context, attrs: AttributeSet?, defStyle: Int)
}
}
fun updateVoiceKey() {
val show = Settings.getValues().mShowsVoiceInputKey
toolbar.findViewWithTag<View>(ToolbarKey.VOICE)?.isVisible = show
pinnedKeys.findViewWithTag<View>(ToolbarKey.VOICE)?.isVisible = show
}
private fun updateKeys() {
updateVoiceKey()
val settingsValues = Settings.getValues()
val toolbarVoiceKey = toolbar.findViewWithTag<View>(ToolbarKey.VOICE)
if (toolbarVoiceKey != null) toolbarVoiceKey.isVisible = settingsValues.mShowsVoiceInputKey
val pinnedVoiceKey = pinnedKeys.findViewWithTag<View>(ToolbarKey.VOICE)
if (pinnedVoiceKey != null) pinnedVoiceKey.isVisible = settingsValues.mShowsVoiceInputKey
val toolbarIsExpandable = settingsValues.mToolbarMode == ToolbarMode.EXPANDABLE
if (settingsValues.mIncognitoModeEnabled) {