blob: d27346ba645e7e84a86eb4f3e72f1d60fe5ccc55 [file] [log] [blame]
Jim Miller0b319702010-02-05 18:51:59 -08001/*
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
17package com.android.internal.widget;
18
19import android.content.Context;
Jim Miller0b319702010-02-05 18:51:59 -080020import android.inputmethodservice.KeyboardView;
21import android.util.AttributeSet;
Jim Miller0b319702010-02-05 18:51:59 -080022
23public class PasswordEntryKeyboardView extends KeyboardView {
24
Jim Miller280b6022010-02-09 19:05:02 -080025 static final int KEYCODE_OPTIONS = -100;
Jim Miller0b319702010-02-05 18:51:59 -080026 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
Jim Miller0b319702010-02-05 18:51:59 -080031 public PasswordEntryKeyboardView(Context context, AttributeSet attrs) {
Alan Viverette617feb92013-09-09 18:09:13 -070032 this(context, attrs, 0);
Jim Miller0b319702010-02-05 18:51:59 -080033 }
34
Alan Viverette617feb92013-09-09 18:09:13 -070035 public PasswordEntryKeyboardView(Context context, AttributeSet attrs, int defStyleAttr) {
36 this(context, attrs, defStyleAttr, 0);
37 }
38
39 public PasswordEntryKeyboardView(
40 Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
41 super(context, attrs, defStyleAttr, defStyleRes);
Jim Miller0b319702010-02-05 18:51:59 -080042 }
43
Jim Miller6465f772011-01-19 22:01:25 -080044 @Override
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
Jim Miller0b319702010-02-05 18:51:59 -080055}