Jim Miller | 0b31970 | 2010-02-05 18:51:59 -0800 | [diff] [blame] | 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; |
Jim Miller | 0b31970 | 2010-02-05 18:51:59 -0800 | [diff] [blame] | 20 | import android.inputmethodservice.KeyboardView; |
| 21 | import android.util.AttributeSet; |
Jim Miller | 0b31970 | 2010-02-05 18:51:59 -0800 | [diff] [blame] | 22 | |
| 23 | public class PasswordEntryKeyboardView extends KeyboardView { |
| 24 | |
Jim Miller | 280b602 | 2010-02-09 19:05:02 -0800 | [diff] [blame] | 25 | static final int KEYCODE_OPTIONS = -100; |
Jim Miller | 0b31970 | 2010-02-05 18:51:59 -0800 | [diff] [blame] | 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 | |
Jim Miller | 0b31970 | 2010-02-05 18:51:59 -0800 | [diff] [blame] | 31 | public PasswordEntryKeyboardView(Context context, AttributeSet attrs) { |
Alan Viverette | 617feb9 | 2013-09-09 18:09:13 -0700 | [diff] [blame] | 32 | this(context, attrs, 0); |
Jim Miller | 0b31970 | 2010-02-05 18:51:59 -0800 | [diff] [blame] | 33 | } |
| 34 | |
Alan Viverette | 617feb9 | 2013-09-09 18:09:13 -0700 | [diff] [blame] | 35 | 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 Miller | 0b31970 | 2010-02-05 18:51:59 -0800 | [diff] [blame] | 42 | } |
| 43 | |
Jim Miller | 6465f77 | 2011-01-19 22:01:25 -0800 | [diff] [blame] | 44 | @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 Miller | 0b31970 | 2010-02-05 18:51:59 -0800 | [diff] [blame] | 55 | } |