Mozc is a Japanese Input Method Editor (IME) designed for multi-platform such
as Chromium OS, Android, Windows, Mac and Linux. This open-source project
originates from Google Japanese Input.
/** * Sends mozcKeyEvent and/or Request to mozc server. * * This skips to send request if the given keyboard specification is * same as before. */booleansendKeyWithKeyboardSpecification(...
/** * Sends {@code SEND_KEY} command to the server asynchronously. */publicvoidsendKey(ProtoCommands.KeyEventmozcKeyEvent,KeyEventInterfacetriggeringKeyEvent,List<?extendsTouchEvent>touchEventList,EvaluationCallbackcallback){...evaluateAsynchronously(inputBuilder,triggeringKeyEvent,callback);}
/** * A core implementation of evaluation executing process. * * <p>This class takes messages from the UI thread. By using {@link SessionHandler}, * it evaluates the {@link Input} in a message, and then returns the result with notifying * the UI thread if necessary. * All evaluations should be done with this class in order to keep evaluation in the incoming * order. * Package private for testing purpose. */staticclassExecutorMainCallbackimplementsHandler.Callback{...@OverridepublicbooleanhandleMessage(Messagemessage){// Dispatch the message.switch(message.what){caseINITIALIZE_SESSION_HANDLER:sessionHandler.initialize(Context.class.cast(message.obj));break;caseDELETE_SESSION:deleteSession();break;caseEVALUATE_ASYNCHRONOUSLY:caseEVALUATE_KEYEVENT_ASYNCHRONOUSLY:evaluateAsynchronously(AsynchronousEvaluationContext.class.cast(message.obj),message.getTarget());...
@OverridepublicCommandevalCommand(Commandcommand){byte[]inBytes=command.toByteArray();byte[]outBytes=null;outBytes=MozcJNI.evalCommand(inBytes);try{returnCommand.parseFrom(outBytes);}catch(InvalidProtocolBufferExceptione){MozcLog.w("InvalidProtocolBufferException is thrown."+"We can do nothing so just return default instance.");MozcLog.w(e.toString());returnCommand.getDefaultInstance();}}