InputConnection clearMetaKeyStates - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for InputConnection clearMetaKeyStates method.

This code example shows how to use the following methods:clearMetaKeyStates, commitText
     * @param caps 
     * @param ic 
     */ 
    private void handleAccentKey(KeyEvent event, CharSequence smallCaps, CharSequence caps, InputConnection ic)
    { 
		ic.clearMetaKeyStates(event.getMetaState());
		if(shiftInactive) {
			ic.commitText(smallCaps, 1);			
		} else if (shiftActive) {
			ic.commitText(caps, 1);
			 
			/* 
			 * Next two lines of code have to clear Shift for the purose of other processes which take part in input handling. 
			 * When Shift is on, we properly handle it but if do not explicitly send a KeyEvent to the InputConnection, Shift stays turned on 
			 * (There is probably some other process with its own MetaKeyListener). Then the next inserted letter (which we do not handle) handles the Shift 
			 * and becomes capital letter. This behaviour is undesirable of course. That is why we use this workaround. We send two events indicating  
			 * Shift key press. The first causes CAPS LOCK (SHIFT LOCKED) and the second an entire Shift clearing. 
			 *  
			 * If we respond to an event and CAPS LOCK (SHIFT LOCKED) is on (see if statement above), we do not change the Shift state, so  
			 * nothing has to be done.  

5
CodeRank
This code example shows how to use the following methods:clearMetaKeyStates
    return baseConnection.beginBatchEdit();
  } 
 
  @Override 
  public boolean clearMetaKeyStates(int states) {
    return baseConnection.clearMetaKeyStates(states);
  } 
 
  @Override 
  public boolean commitCompletion(CompletionInfo text) {
    return baseConnection.commitCompletion(text);
  } 
 
  @TargetApi(11) 
  @Override 
  public boolean commitCorrection(CorrectionInfo correctionInfo) {
    return baseConnection.commitCorrection(correctionInfo);
  } 
 
  @Override 
5
CodeRank
clearMetaKeyStates Method Overview
Clear the given meta key pressed states in the given input connection.
See Code Examples for other Android InputConnection Methods: