Home | History | Annotate | Download | only in smartdial
      1 /*
      2  * Copyright (C) 2016 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 
     17 package com.android.dialer.smartdial;
     18 
     19 /**
     20  * Note: These methods currently take characters as arguments. For future planned language support,
     21  * they will need to be changed to use codepoints instead of characters.
     22  *
     23  * <p>http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#codePointAt(int)
     24  *
     25  * <p>If/when this change is made, LatinSmartDialMap(which operates on chars) will continue to work
     26  * by simply casting from a codepoint to a character.
     27  */
     28 public interface SmartDialMap {
     29 
     30   /*
     31    * Returns true if the provided character can be mapped to a key on the dialpad
     32    */
     33   boolean isValidDialpadCharacter(char ch);
     34 
     35   /*
     36    * Returns true if the provided character is a letter, and can be mapped to a key on the dialpad
     37    */
     38   boolean isValidDialpadAlphabeticChar(char ch);
     39 
     40   /*
     41    * Returns true if the provided character is a digit, and can be mapped to a key on the dialpad
     42    */
     43   boolean isValidDialpadNumericChar(char ch);
     44 
     45   /*
     46    * Get the index of the key on the dialpad which the character corresponds to
     47    */
     48   byte getDialpadIndex(char ch);
     49 
     50   /*
     51    * Get the actual numeric character on the dialpad which the character corresponds to
     52    */
     53   char getDialpadNumericCharacter(char ch);
     54 
     55   /*
     56    * Converts uppercase characters to lower case ones, and on a best effort basis, strips accents
     57    * from accented characters.
     58    */
     59   char normalizeCharacter(char ch);
     60 }
     61