• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 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.android.internal.widget;
18 
19 import android.content.Context;
20 import android.inputmethodservice.KeyboardView;
21 import android.util.AttributeSet;
22 
23 public class PasswordEntryKeyboardView extends KeyboardView {
24 
25     static final int KEYCODE_OPTIONS = -100;
26     static final int KEYCODE_SHIFT_LONGPRESS = -101;
27     static final int KEYCODE_VOICE = -102;
28     static final int KEYCODE_F1 = -103;
29     static final int KEYCODE_NEXT_LANGUAGE = -104;
30 
PasswordEntryKeyboardView(Context context, AttributeSet attrs)31     public PasswordEntryKeyboardView(Context context, AttributeSet attrs) {
32         this(context, attrs, 0);
33     }
34 
PasswordEntryKeyboardView(Context context, AttributeSet attrs, int defStyleAttr)35     public PasswordEntryKeyboardView(Context context, AttributeSet attrs, int defStyleAttr) {
36         this(context, attrs, defStyleAttr, 0);
37     }
38 
PasswordEntryKeyboardView( Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)39     public PasswordEntryKeyboardView(
40             Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
41         super(context, attrs, defStyleAttr, defStyleRes);
42     }
43 
44     @Override
setShifted(boolean shifted)45     public boolean setShifted(boolean shifted) {
46         boolean result = super.setShifted(shifted);
47         // invalidate both shift keys
48         int[] indices = getKeyboard().getShiftKeyIndices();
49         for (int index : indices) {
50             invalidateKey(index);
51         }
52         return result;
53     }
54 
55 }
56