blob: 0672673c107c82648e702541cd85bdc44cd93675 [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
Flavio Lerdacb805e82011-07-18 10:31:44 +010019import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
20
Daniel Lehmann362654a2011-07-17 14:16:47 -070021import android.net.Uri;
Flavio Lerda9de38682011-07-08 20:38:07 +010022import android.provider.CallLog.Calls;
23import android.provider.ContactsContract.CommonDataKinds.Phone;
24
25/**
26 * The details of a phone call to be shown in the UI.
27 */
28public class PhoneCallDetails {
29 /** The number of the other party involved in the call. */
30 public final CharSequence number;
Flavio Lerda371d5f92011-07-09 19:45:32 +010031 /** The formatted version of {@link #number}. */
32 public final CharSequence formattedNumber;
Flavio Lerdacb805e82011-07-18 10:31:44 +010033 /** The structured phone number corresponding to {@link #number}. */
34 public final PhoneNumber structuredPhoneNumber;
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,
61 PhoneNumber structuredPhoneNumber, int[] callTypes, long date, long duration) {
62 this(number, formattedNumber, structuredPhoneNumber, callTypes, date, duration,
63 "", 0, "", -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,
68 PhoneNumber structuredPhoneNumber, int[] callTypes, long date, long duration,
69 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 Lerdacb805e82011-07-18 10:31:44 +010073 this.structuredPhoneNumber = structuredPhoneNumber;
Flavio Lerda223a8432011-07-11 18:40:25 +010074 this.callTypes = callTypes;
Flavio Lerda9de38682011-07-08 20:38:07 +010075 this.date = date;
Flavio Lerda9a208cc2011-07-12 21:05:47 +010076 this.duration = duration;
Flavio Lerda9de38682011-07-08 20:38:07 +010077 this.name = name;
78 this.numberType = numberType;
79 this.numberLabel = numberLabel;
Flavio Lerda178eeeb2011-07-11 19:51:40 +010080 this.personId = personId;
Daniel Lehmann362654a2011-07-17 14:16:47 -070081 this.photoUri = photoUri;
Flavio Lerda9de38682011-07-08 20:38:07 +010082 }
83}