blob: eb71fd2d96ee31d4e555374d3b15d8e15fb5f89f [file] [log] [blame]
The Android Open Source Project9d9730a2009-03-03 19:32:37 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of 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,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.stk;
18
19import android.text.method.NumberKeyListener;
20import android.view.KeyEvent;
21import android.view.inputmethod.EditorInfo;
22
23/**
24 * For entering dates in a text field.
25 */
26public class StkDigitsKeyListener extends NumberKeyListener {
27 @Override
28 protected char[] getAcceptedChars() {
29 return CHARACTERS;
30 }
31
32 public int getInputType() {
33 return EditorInfo.TYPE_CLASS_PHONE;
34 }
Wink Saville79085fc2009-06-09 10:27:23 -070035
The Android Open Source Project9d9730a2009-03-03 19:32:37 -080036 public static StkDigitsKeyListener getInstance() {
37 if (sInstance != null) {
38 return sInstance;
39 }
40 sInstance = new StkDigitsKeyListener();
41 return sInstance;
42 }
43
44 /**
45 * The characters that are used.
Wink Saville79085fc2009-06-09 10:27:23 -070046 *
The Android Open Source Project9d9730a2009-03-03 19:32:37 -080047 * @see KeyEvent#getMatch
48 * @see #getAcceptedChars
49 */
50 public static final char[] CHARACTERS = new char[] {
51 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '#', '+'};
52
53 private static StkDigitsKeyListener sInstance;
54}