Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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.contacts; |
| 18 | |
Daniel Lehmann | 362654a | 2011-07-17 14:16:47 -0700 | [diff] [blame] | 19 | import android.net.Uri; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 20 | import android.provider.CallLog.Calls; |
| 21 | import android.provider.ContactsContract.CommonDataKinds.Phone; |
| 22 | |
| 23 | /** |
| 24 | * The details of a phone call to be shown in the UI. |
| 25 | */ |
| 26 | public class PhoneCallDetails { |
| 27 | /** The number of the other party involved in the call. */ |
| 28 | public final CharSequence number; |
Flavio Lerda | 371d5f9 | 2011-07-09 19:45:32 +0100 | [diff] [blame] | 29 | /** The formatted version of {@link #number}. */ |
| 30 | public final CharSequence formattedNumber; |
Flavio Lerda | 223a843 | 2011-07-11 18:40:25 +0100 | [diff] [blame] | 31 | /** |
| 32 | * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}. |
| 33 | * <p> |
| 34 | * There might be multiple types if this represents a set of entries grouped together. |
| 35 | */ |
| 36 | public final int[] callTypes; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 37 | /** The date of the call, in milliseconds since the epoch. */ |
| 38 | public final long date; |
Flavio Lerda | 9a208cc | 2011-07-12 21:05:47 +0100 | [diff] [blame] | 39 | /** The duration of the call in milliseconds, or 0 for missed calls. */ |
| 40 | public final long duration; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 41 | /** The name of the contact, or the empty string. */ |
| 42 | public final CharSequence name; |
| 43 | /** The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. */ |
| 44 | public final int numberType; |
| 45 | /** The custom label associated with the phone number in the contact, or the empty string. */ |
| 46 | public final CharSequence numberLabel; |
Flavio Lerda | 178eeeb | 2011-07-11 19:51:40 +0100 | [diff] [blame] | 47 | /** The id of the contact associated with this phone call. */ |
| 48 | public final long personId; |
Daniel Lehmann | 362654a | 2011-07-17 14:16:47 -0700 | [diff] [blame] | 49 | /** |
| 50 | * The photo uri of the picture of the contact that is associated with this phone call or |
| 51 | * null if there is none. |
| 52 | */ |
| 53 | public final Uri photoUri; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 54 | |
| 55 | /** Create the details for a call with a number not associated with a contact. */ |
Flavio Lerda | 223a843 | 2011-07-11 18:40:25 +0100 | [diff] [blame] | 56 | public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, int[] callTypes, |
Flavio Lerda | 9a208cc | 2011-07-12 21:05:47 +0100 | [diff] [blame] | 57 | long date, long duration) { |
Daniel Lehmann | 362654a | 2011-07-17 14:16:47 -0700 | [diff] [blame] | 58 | this(number, formattedNumber, callTypes, date, duration, "", 0, "", -1L, null); |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | /** Create the details for a call with a number associated with a contact. */ |
Flavio Lerda | 223a843 | 2011-07-11 18:40:25 +0100 | [diff] [blame] | 62 | public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, int[] callTypes, |
Flavio Lerda | 178eeeb | 2011-07-11 19:51:40 +0100 | [diff] [blame] | 63 | long date, long duration, CharSequence name, int numberType, CharSequence numberLabel, |
Daniel Lehmann | 362654a | 2011-07-17 14:16:47 -0700 | [diff] [blame] | 64 | long personId, Uri photoUri) { |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 65 | this.number = number; |
Flavio Lerda | 371d5f9 | 2011-07-09 19:45:32 +0100 | [diff] [blame] | 66 | this.formattedNumber = formattedNumber; |
Flavio Lerda | 223a843 | 2011-07-11 18:40:25 +0100 | [diff] [blame] | 67 | this.callTypes = callTypes; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 68 | this.date = date; |
Flavio Lerda | 9a208cc | 2011-07-12 21:05:47 +0100 | [diff] [blame] | 69 | this.duration = duration; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 70 | this.name = name; |
| 71 | this.numberType = numberType; |
| 72 | this.numberLabel = numberLabel; |
Flavio Lerda | 178eeeb | 2011-07-11 19:51:40 +0100 | [diff] [blame] | 73 | this.personId = personId; |
Daniel Lehmann | 362654a | 2011-07-17 14:16:47 -0700 | [diff] [blame] | 74 | this.photoUri = photoUri; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 75 | } |
| 76 | } |