mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 05:52:47 +00:00
Merge pull request #573 from Helium314/fix_voice_key
Hide voice input key and disable setting if no voice input available
This commit is contained in:
commit
c71aceaf01
3 changed files with 9 additions and 3 deletions
|
@ -112,7 +112,8 @@ public final class InputAttributes {
|
|||
final boolean noMicrophone = mIsPasswordField
|
||||
|| InputTypeUtils.isEmailVariation(variation)
|
||||
|| InputType.TYPE_TEXT_VARIATION_URI == variation
|
||||
|| hasNoMicrophoneKeyOption();
|
||||
|| hasNoMicrophoneKeyOption()
|
||||
|| !RichInputMethodManager.getInstance().hasShortcutIme();
|
||||
mShouldShowVoiceInputKey = !noMicrophone;
|
||||
|
||||
mDisableGestureFloatingPreviewText = InputAttributes.inPrivateImeOptions(
|
||||
|
|
|
@ -584,6 +584,10 @@ public class RichInputMethodManager {
|
|||
switchToTargetIME(imiId, mShortcutSubtype, context);
|
||||
}
|
||||
|
||||
public boolean hasShortcutIme() {
|
||||
return mShortcutInputMethodInfo != null;
|
||||
}
|
||||
|
||||
private void switchToTargetIME(final String imiId, final InputMethodSubtype subtype,
|
||||
final InputMethodService context) {
|
||||
final IBinder token = context.getWindow().getWindow().getAttributes().token;
|
||||
|
|
|
@ -70,8 +70,9 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
|||
final Preference voiceInputKeyOption = findPreference(Settings.PREF_VOICE_INPUT_KEY);
|
||||
if (voiceInputKeyOption != null) {
|
||||
RichInputMethodManager.getInstance().refreshSubtypeCaches();
|
||||
voiceInputKeyOption.setEnabled(VOICE_IME_ENABLED);
|
||||
voiceInputKeyOption.setSummary(VOICE_IME_ENABLED
|
||||
boolean voiceKeyEnabled = VOICE_IME_ENABLED && RichInputMethodManager.getInstance().hasShortcutIme();
|
||||
voiceInputKeyOption.setEnabled(voiceKeyEnabled);
|
||||
voiceInputKeyOption.setSummary(voiceKeyEnabled
|
||||
? null : getText(R.string.voice_input_disabled_summary));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue