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 | 9c46637 | 2011-07-19 17:38:17 +0100 | [diff] [blame] | 31 | /** The country corresponding with the phone number. */ |
| 32 | public final String countryIso; |
Flavio Lerda | 71fc6ec | 2011-08-09 17:24:29 +0100 | [diff] [blame] | 33 | /** The geocoded location for the phone number. */ |
| 34 | public final String geocode; |
Flavio Lerda | 223a843 | 2011-07-11 18:40:25 +0100 | [diff] [blame] | 35 | /** |
| 36 | * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}. |
| 37 | * <p> |
| 38 | * There might be multiple types if this represents a set of entries grouped together. |
| 39 | */ |
| 40 | public final int[] callTypes; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 41 | /** The date of the call, in milliseconds since the epoch. */ |
| 42 | public final long date; |
Flavio Lerda | 9a208cc | 2011-07-12 21:05:47 +0100 | [diff] [blame] | 43 | /** The duration of the call in milliseconds, or 0 for missed calls. */ |
| 44 | public final long duration; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 45 | /** The name of the contact, or the empty string. */ |
| 46 | public final CharSequence name; |
| 47 | /** The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. */ |
| 48 | public final int numberType; |
| 49 | /** The custom label associated with the phone number in the contact, or the empty string. */ |
| 50 | public final CharSequence numberLabel; |
Flavio Lerda | 071aa0d | 2011-08-22 10:26:27 +0100 | [diff] [blame] | 51 | /** The URI of the contact associated with this phone call. */ |
| 52 | public final Uri contactUri; |
Daniel Lehmann | 362654a | 2011-07-17 14:16:47 -0700 | [diff] [blame] | 53 | /** |
Flavio Lerda | 071aa0d | 2011-08-22 10:26:27 +0100 | [diff] [blame] | 54 | * The photo URI of the picture of the contact that is associated with this phone call or |
Daniel Lehmann | 362654a | 2011-07-17 14:16:47 -0700 | [diff] [blame] | 55 | * null if there is none. |
Flavio Lerda | 5ee899e | 2011-08-23 14:47:41 +0100 | [diff] [blame] | 56 | * <p> |
| 57 | * This is meant to store the high-res photo only. |
Daniel Lehmann | 362654a | 2011-07-17 14:16:47 -0700 | [diff] [blame] | 58 | */ |
| 59 | public final Uri photoUri; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 60 | |
| 61 | /** Create the details for a call with a number not associated with a contact. */ |
Flavio Lerda | cb805e8 | 2011-07-18 10:31:44 +0100 | [diff] [blame] | 62 | public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, |
Flavio Lerda | 71fc6ec | 2011-08-09 17:24:29 +0100 | [diff] [blame] | 63 | String countryIso, String geocode, int[] callTypes, long date, long duration) { |
| 64 | this(number, formattedNumber, countryIso, geocode, callTypes, date, duration, "", 0, "", |
Flavio Lerda | 071aa0d | 2011-08-22 10:26:27 +0100 | [diff] [blame] | 65 | null, null); |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | /** Create the details for a call with a number associated with a contact. */ |
Flavio Lerda | cb805e8 | 2011-07-18 10:31:44 +0100 | [diff] [blame] | 69 | public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, |
Flavio Lerda | 71fc6ec | 2011-08-09 17:24:29 +0100 | [diff] [blame] | 70 | String countryIso, String geocode, int[] callTypes, long date, long duration, |
Flavio Lerda | 071aa0d | 2011-08-22 10:26:27 +0100 | [diff] [blame] | 71 | CharSequence name, int numberType, CharSequence numberLabel, Uri contactUri, |
Flavio Lerda | cb805e8 | 2011-07-18 10:31:44 +0100 | [diff] [blame] | 72 | Uri photoUri) { |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 73 | this.number = number; |
Flavio Lerda | 371d5f9 | 2011-07-09 19:45:32 +0100 | [diff] [blame] | 74 | this.formattedNumber = formattedNumber; |
Flavio Lerda | 9c46637 | 2011-07-19 17:38:17 +0100 | [diff] [blame] | 75 | this.countryIso = countryIso; |
Flavio Lerda | 71fc6ec | 2011-08-09 17:24:29 +0100 | [diff] [blame] | 76 | this.geocode = geocode; |
Flavio Lerda | 223a843 | 2011-07-11 18:40:25 +0100 | [diff] [blame] | 77 | this.callTypes = callTypes; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 78 | this.date = date; |
Flavio Lerda | 9a208cc | 2011-07-12 21:05:47 +0100 | [diff] [blame] | 79 | this.duration = duration; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 80 | this.name = name; |
| 81 | this.numberType = numberType; |
| 82 | this.numberLabel = numberLabel; |
Flavio Lerda | 071aa0d | 2011-08-22 10:26:27 +0100 | [diff] [blame] | 83 | this.contactUri = contactUri; |
Daniel Lehmann | 362654a | 2011-07-17 14:16:47 -0700 | [diff] [blame] | 84 | this.photoUri = photoUri; |
Flavio Lerda | 9de3868 | 2011-07-08 20:38:07 +0100 | [diff] [blame] | 85 | } |
| 86 | } |