forked from extern/Unexpected-Keyboard
Bring the voice IME chooser with a long press
This commit is contained in:
parent
51a41ec90a
commit
4a5a125aea
@ -245,6 +245,7 @@ final class Config
|
||||
case SWITCH_BACKWARD:
|
||||
return (layouts.size() > 2) ? key : null;
|
||||
case SWITCH_VOICE_TYPING:
|
||||
case SWITCH_VOICE_TYPING_CHOOSER:
|
||||
return shouldOfferVoiceTyping ? key : null;
|
||||
}
|
||||
break;
|
||||
|
@ -77,6 +77,8 @@ class KeyModifier
|
||||
{
|
||||
case CHANGE_METHOD_PREV:
|
||||
return KeyValue.getKeyByName("change_method");
|
||||
case SWITCH_VOICE_TYPING:
|
||||
return KeyValue.getKeyByName("voice_typing_chooser");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ final class KeyValue
|
||||
SWITCH_GREEKMATH,
|
||||
CAPS_LOCK,
|
||||
SWITCH_VOICE_TYPING,
|
||||
SWITCH_VOICE_TYPING_CHOOSER,
|
||||
}
|
||||
|
||||
// Must be evaluated in the reverse order of their values.
|
||||
@ -369,6 +370,7 @@ final class KeyValue
|
||||
case "action": return eventKey("Action", Event.ACTION, FLAG_SMALLER_FONT); // Will always be replaced
|
||||
case "capslock": return eventKey(0xE012, Event.CAPS_LOCK, 0);
|
||||
case "voice_typing": return eventKey(0xE015, Event.SWITCH_VOICE_TYPING, FLAG_SMALLER_FONT);
|
||||
case "voice_typing_chooser": return eventKey(0xE015, Event.SWITCH_VOICE_TYPING_CHOOSER, FLAG_SMALLER_FONT);
|
||||
|
||||
/* Key events */
|
||||
case "esc": return keyeventKey("Esc", KeyEvent.KEYCODE_ESCAPE, FLAG_SMALLER_FONT);
|
||||
|
@ -423,6 +423,11 @@ public class Keyboard2 extends InputMethodService
|
||||
Config.globalPrefs()))
|
||||
_config.shouldOfferVoiceTyping = false;
|
||||
break;
|
||||
|
||||
case SWITCH_VOICE_TYPING_CHOOSER:
|
||||
VoiceImeSwitcher.choose_voice_ime(Keyboard2.this, get_imm(),
|
||||
Config.globalPrefs());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,16 @@ class VoiceImeSwitcher
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean choose_voice_ime(InputMethodService ims,
|
||||
InputMethodManager imm, SharedPreferences prefs)
|
||||
{
|
||||
if (VERSION.SDK_INT < 11) // Due to InputMethodSubtype
|
||||
return false;
|
||||
List<IME> imes = get_voice_ime_list(imm);
|
||||
choose_voice_ime_and_update_prefs(ims, prefs, imes);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Show the voice IME chooser popup and switch to the selected IME.
|
||||
Preferences are updated so that future calls to [switch_to_voice_ime]
|
||||
switch to the newly selected IME. */
|
||||
|
Loading…
Reference in New Issue
Block a user