Home | History | Annotate | Download | only in softkeyboard
      1 /*
      2  * Copyright (C) 2008-2009 Google Inc.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
      5  * use this file except in compliance with the License. You may obtain a copy of
      6  * the License at
      7  *
      8  * http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
     13  * License for the specific language governing permissions and limitations under
     14  * the License.
     15  */
     16 
     17 package com.example.android.softkeyboard;
     18 
     19 import android.content.Context;
     20 import android.inputmethodservice.Keyboard;
     21 import android.inputmethodservice.KeyboardView;
     22 import android.inputmethodservice.Keyboard.Key;
     23 import android.util.AttributeSet;
     24 
     25 public class LatinKeyboardView extends KeyboardView {
     26 
     27     static final int KEYCODE_OPTIONS = -100;
     28 
     29     public LatinKeyboardView(Context context, AttributeSet attrs) {
     30         super(context, attrs);
     31     }
     32 
     33     public LatinKeyboardView(Context context, AttributeSet attrs, int defStyle) {
     34         super(context, attrs, defStyle);
     35     }
     36 
     37     @Override
     38     protected boolean onLongPress(Key key) {
     39         if (key.codes[0] == Keyboard.KEYCODE_CANCEL) {
     40             getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS, null);
     41             return true;
     42         } else {
     43             return super.onLongPress(key);
     44         }
     45     }
     46 }
     47