PhoneNumberService.java revision 94bfdf9070ab1bca6866f4c0caf971dad03446a2
1/*
2 * Copyright (C) 2013 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.incallui.service;
18
19import android.graphics.Bitmap;
20
21/**
22 * Provides phone number lookup services.
23 */
24public interface PhoneNumberService {
25
26    /**
27     * Get a phone number number asynchronously.
28     *
29     * @param phoneNumber The phone number to lookup.
30     * @param listener The listener to notify when the phone number lookup is complete.
31     */
32    public void getPhoneNumberInfo(String phoneNumber, NumberLookupListener listener);
33
34    /**
35     * Get an image asynchronously.
36     *
37     * @param number The phone number for the image.
38     * @param url The url to fetch the image from.
39     * @param listener The listener to notify when the image lookup is complete.
40     */
41    public void fetchImage(String number, String url, ImageLookupListener listener);
42
43    public interface NumberLookupListener {
44
45        /**
46         * Callback when a phone number has been looked up.
47         *
48         * @param info The looked up information.  Or (@literal null} if there are no results.
49         */
50        public void onPhoneNumberInfoComplete(PhoneNumberInfo info);
51    }
52
53    public interface ImageLookupListener {
54
55        /**
56         * Callback when a image has been fetched.
57         *
58         * @param bitmap The fetched image.
59         */
60        public void onImageFetchComplete(Bitmap bitmap);
61    }
62
63    public interface PhoneNumberInfo {
64        public String getDisplayName();
65        public String getNumber();
66        public int getPhoneType();
67        public String getPhoneLabel();
68        public String getNormalizedNumber();
69        public String getImageUrl();
70        public boolean isBusiness();
71    }
72}
73