Android Open Source - MorseStraightKey-Android Morse Keyboard View






From Project

Back to project page MorseStraightKey-Android.

License

The source code is released under:

GNU General Public License

If you think the Android project MorseStraightKey-Android 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 com.savanto.morsekeyboard;
//from   www. ja v a  2  s  .  c o  m
import android.content.Context;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView;
import android.util.AttributeSet;

/**
 * @author savanto
 *
 */
public class MorseKeyboardView extends KeyboardView
{
  /**
   * @param context
   * @param attrs
   */
  public MorseKeyboardView(Context context, AttributeSet attrs)
  {
    super(context, attrs);
    this.setPreviewEnabled(false);
  }

//  /**
//   * @param context
//   * @param attrs
//   * @param defStyle
//   */
//  public MorseKeyboardView(Context context, AttributeSet attrs, int defStyle)
//  {
//    super(context, attrs, defStyle);
//  }
//
  @Override
  protected boolean onLongPress(Keyboard.Key key)
  {
    switch (key.codes[0])
    {
      case MorseKeyboard.KEYCODE_SIGNAL:
        ((MorseKeyboardInputMethodService) this.getOnKeyboardActionListener()).onLongKey(MorseKeyboard.KEYCODE_DAH);
        break;
      case MorseKeyboard.KEYCODE_GAP:
        ((MorseKeyboardInputMethodService) this.getOnKeyboardActionListener()).onLongKey(MorseKeyboard.KEYCODE_MEDIUM_GAP);
        break;
    }
    return super.onLongPress(key);
  }
}




Java Source Code List

com.savanto.morsekeyboard.MorseCode.java
com.savanto.morsekeyboard.MorseKeyboardHelp.java
com.savanto.morsekeyboard.MorseKeyboardInputMethodService.java
com.savanto.morsekeyboard.MorseKeyboardSettings.java
com.savanto.morsekeyboard.MorseKeyboardView.java
com.savanto.morsekeyboard.MorseKeyboard.java
com.savanto.morsekeyboard.SeekBarPreference.java