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