Android Open Source - MYKey_SoftKeyboard Buffer






From Project

Back to project page MYKey_SoftKeyboard.

License

The source code is released under:

Apache License

If you think the Android project MYKey_SoftKeyboard listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package key_process;
//ww w.  j  a v a  2 s . co  m
import java.util.ArrayList;

import com.android.mykey.*;

import android.view.KeyEvent;

public class Buffer {
  private SoftKeyboard ime;
  private StringBuilder comBuffer;
  private ArrayList<Integer> phoBuffer;
  
  
  public void removePhoArr(){
    int tmpPhoneme = phoBuffer.get(phoBuffer.size()-1);
    phoBuffer.clear();
    phoBuffer.add(tmpPhoneme);
  }

  public void handingPhoArrAt(int i) {
    for (int j = 0; j < i; j++) {
      phoBuffer.remove(0);
    }
  }
  
  public ArrayList<Integer> getPhoBuffer() {
    return phoBuffer;
  }


  public void appendLetter(int[] phonemeInt) {
    comBuffer.delete(0, comBuffer.length());

    for (int i = 0; i < phonemeInt.length; i++) {
      comBuffer.append(String.valueOf((char)phonemeInt[i]));
    }

    ime.getCurrentInputConnection().setComposingText(comBuffer, 1);
  }

  public void appendPhoneme(int phoneme) {
    phoBuffer.add(phoneme);
  }

  public void renewPhoneme(int phoneme) {
    phoBuffer.remove(phoBuffer.size() - 1);
    phoBuffer.add(phoneme);
  }

  public int getComBuffLength() {
    return comBuffer.length();
  }

  public void deleteComBuff() {
    comBuffer.deleteCharAt(comBuffer.length() - 1);
  }

  public void commitTyped() {
    if (comBuffer.length() > 0) {
      ime.getCurrentInputConnection().commitText(comBuffer, comBuffer.length());
      comBuffer.setLength(0);
    }
  }

  public void commitOther(int keyCode) {
    commitTyped();
    ime.getCurrentInputConnection().commitText(String.valueOf((char) keyCode), 1);
  }

  public void commitDelete() {
    ime.getCurrentInputConnection().commitText("", 0);
  }

  public void commitKeyEvent(int keyEventCode) {
    ime.getCurrentInputConnection().sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, keyEventCode));
    ime.getCurrentInputConnection().sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, keyEventCode));
  }

  
  public Buffer() {
    comBuffer = new StringBuilder();
    phoBuffer = new ArrayList<Integer>();

  }

  public void initBuffer(SoftKeyboard ime) {
    this.ime = ime;
    initBuffer();
  }
  
  public void initBuffer(){
    comBuffer.setLength(0);
    phoBuffer.clear();
  }

}




Java Source Code List

com.android.mykey.LatinKeyboardView.java
com.android.mykey.LatinKeyboard.java
com.android.mykey.SoftKeyboard.java
ime_preferences.ImePreferencesActivity.java
key_process.Buffer.java
key_process.FinalCombinationInfo.java
key_process.KeyInfo.java
key_process.KeyMap.java
key_process.KeyProcessor.java
korean_automata.CombinationState.java
korean_automata.KoreanAutomata.java
korean_automata.PhonemeCategoryConverter.java
korean_automata.Proc1.java
korean_automata.Proc2.java
korean_automata.Proc3.java
korean_automata.Proc4.java
korean_automata.StArea.java
korean_automata.StEmpty.java
korean_automata.StError.java
korean_automata.StFirstArea.java
korean_automata.StFirstVowelAndFirst.java
korean_automata.StFirstVowel.java
korean_automata.StFirst.java
korean_automata.StMultiFinal.java
korean_automata.StSingleFinalAndFirst.java
korean_automata.StSingleFinal.java
korean_automata.StVowel.java
korean_automata.VerifyComb.java
string_Key.StringKeyHandler.java
string_Key.StringKeyListAdapter.java
string_Key.StringKeyModifyActivity.java