blob: 5718091c5d3866d0a1dc0205ff927c3258c0924d [file] [log] [blame]
Flavio Lerda9de38682011-07-08 20:38:07 +01001/*
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
17package com.android.contacts;
18
Daniel Lehmann362654a2011-07-17 14:16:47 -070019import android.net.Uri;
Flavio Lerda9de38682011-07-08 20:38:07 +010020import android.provider.CallLog.Calls;
21import android.provider.ContactsContract.CommonDataKinds.Phone;
22
23/**
24 * The details of a phone call to be shown in the UI.
25 */
26public class PhoneCallDetails {
27 /** The number of the other party involved in the call. */
28 public final CharSequence number;
Flavio Lerda371d5f92011-07-09 19:45:32 +010029 /** The formatted version of {@link #number}. */
30 public final CharSequence formattedNumber;
Flavio Lerda9c466372011-07-19 17:38:17 +010031 /** The country corresponding with the phone number. */
32 public final String countryIso;
Flavio Lerda71fc6ec2011-08-09 17:24:29 +010033 /** The geocoded location for the phone number. */
34 public final String geocode;
Flavio Lerda223a8432011-07-11 18:40:25 +010035 /**
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 Lerda9de38682011-07-08 20:38:07 +010041 /** The date of the call, in milliseconds since the epoch. */
42 public final long date;
Flavio Lerda9a208cc2011-07-12 21:05:47 +010043 /** The duration of the call in milliseconds, or 0 for missed calls. */
44 public final long duration;
Flavio Lerda9de38682011-07-08 20:38:07 +010045 /** 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 Lerda178eeeb2011-07-11 19:51:40 +010051 /** The id of the contact associated with this phone call. */
52 public final long personId;
Daniel Lehmann362654a2011-07-17 14:16:47 -070053 /**
54 * The photo uri of the picture of the contact that is associated with this phone call or
55 * null if there is none.
56 */
57 public final Uri photoUri;
Flavio Lerda9de38682011-07-08 20:38:07 +010058
59 /** Create the details for a call with a number not associated with a contact. */
Flavio Lerdacb805e82011-07-18 10:31:44 +010060 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber,
Flavio Lerda71fc6ec2011-08-09 17:24:29 +010061 String countryIso, String geocode, int[] callTypes, long date, long duration) {
62 this(number, formattedNumber, countryIso, geocode, callTypes, date, duration, "", 0, "",
63 -1L, null);
Flavio Lerda9de38682011-07-08 20:38:07 +010064 }
65
66 /** Create the details for a call with a number associated with a contact. */
Flavio Lerdacb805e82011-07-18 10:31:44 +010067 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber,
Flavio Lerda71fc6ec2011-08-09 17:24:29 +010068 String countryIso, String geocode, int[] callTypes, long date, long duration,
Flavio Lerdacb805e82011-07-18 10:31:44 +010069 CharSequence name, int numberType, CharSequence numberLabel, long personId,
70 Uri photoUri) {
Flavio Lerda9de38682011-07-08 20:38:07 +010071 this.number = number;
Flavio Lerda371d5f92011-07-09 19:45:32 +010072 this.formattedNumber = formattedNumber;
Flavio Lerda9c466372011-07-19 17:38:17 +010073 this.countryIso = countryIso;
Flavio Lerda71fc6ec2011-08-09 17:24:29 +010074 this.geocode = geocode;
Flavio Lerda223a8432011-07-11 18:40:25 +010075 this.callTypes = callTypes;
Flavio Lerda9de38682011-07-08 20:38:07 +010076 this.date = date;
Flavio Lerda9a208cc2011-07-12 21:05:47 +010077 this.duration = duration;
Flavio Lerda9de38682011-07-08 20:38:07 +010078 this.name = name;
79 this.numberType = numberType;
80 this.numberLabel = numberLabel;
Flavio Lerda178eeeb2011-07-11 19:51:40 +010081 this.personId = personId;
Daniel Lehmann362654a2011-07-17 14:16:47 -070082 this.photoUri = photoUri;
Flavio Lerda9de38682011-07-08 20:38:07 +010083 }
84}